Connecting and Monitoring Smart Sensors with Home Assistant and Node-RED

In the previous post, we built the foundation of our automation system — Docker running on the Raspberry Pi, with Home Assistant, Node-RED, and Mosquitto working together.
Everything is now alive and connected, but so far… it’s just a system waiting for data.

Time to change that.

At the vacation house, I already use a few smart sensors — temperature, humidity, smart sockets, smart appliances — connected through Govee, Tuya, Xiaomi and Smart Life apps.
They all work fine on their own, but I wanted to bring them together in one place, under my own control — combining cloud-based integrations (like Tuya and Govee) with local MQTT sensors.

In this part, we’ll start linking everything into our setup, and build the foundation for automation and monitoring across both Home Assistant and Node-RED – not just to see what’s happening, but to be notified when something isn’t right, like a sudden temperature drop or a power outage at the house.

Section 4 – Integrating MQTT and Smart Devices (Tuya, Govee, Smart Life)

With Home Assistant, Node-RED, and Mosquitto already working together, we can finally start bringing in real-world data from sensors and smart devices.
This is the point where the setup turns from a theoretical framework into a practical monitoring system for the vacation house.

We’ll begin with the devices that are already in use — sensors and smart plugs connected through Tuya, Govee, Xiaomi, and Smart Life — and then move on to adding locally connected devices communicating through MQTT.

Step 1 – Add Tuya and Smart Life devices

Since Tuya and Smart Life use the same backend cloud, we can integrate them through the official Tuya integration.

In Home Assistant, go to
Settings → Devices & Services → Add Integration → Tuya

  1. Log in with your Tuya Smart or Smart Life credentials.
  2. Once connected, Home Assistant will automatically import your devices.
    You’ll see each smart socket, temperature sensor, or appliance appear with its current state and readings.

These devices communicate through the Tuya Cloud, so an internet connection is required — but once integrated, they can participate fully in your local automations.

Step 2 – Installing HACS – unlocking the community

Even though Tuya worked great right out of the box, I knew that at some point I’d need a few extra integrations — things that aren’t officially supported in Home Assistant, or that get new features faster through the community.

That’s where HACS (Home Assistant Community Store) comes in.
It’s basically an app store for Home Assistant, but built and maintained by the community. You can find everything from experimental integrations to beautifully designed Lovelace cards that enhance the interface and dashboards.

Since my setup runs in Docker, I didn’t have the usual Add-on Store that comes with the full Home Assistant OS.
So the installation had to be done manually — which honestly fits the DIY spirit of this whole project.

cd /home/ioan/homeauto/homeassistant 
sudo bash -c "wget -O - https://get.hacs.xyz | bash -"
docker restart homeassistant

After the restart, I added the new integration from
Settings → Devices & Services → Add Integration → HACS,
connected it to my GitHub account, and just like that, a new HACS menu appeared in the sidebar.

From there, it’s easy to explore and install community-built extensions with just a few clicks.

My first goal with HACS was to explore ways to integrate my Govee temperature and humidity sensors online.
That exploration led to discovering Passive BLE Monitor — a fantastic community integration that reads Bluetooth sensor data directly, without going through the cloud.

Installing HACS quickly proved to be one of the best decisions in this project.
It opened the door to dozens of community integrations that extend Home Assistant far beyond its defaults — from new device types to automation helpers and dashboard enhancements.
In short, HACS is how you make Home Assistant truly yours.

Step 3 – Govee Integration – combining BLE and Cloud

At the vacation house, I already use several Govee temperature and humidity sensors — models H5075 (Bluetooth only) and H5179 (Wi-Fi + Bluetooth).
The idea was to bring them into Home Assistant, alongside the Tuya and Smart Life devices.

Through HACS, I installed the Passive BLE Monitor, and within minutes, my H5075 sensors appeared in Home Assistant — showing temperature, humidity, and battery level — all fully local, no cloud involved.

The H5179 models, however, were a different story. They do have Bluetooth hardware, but their firmware doesn’t broadcast readings using the standard BLE advertisement formats, so BLE discovery didn’t work.
Instead, they communicate through Govee’s new OpenAPI, which exposes both temperature and humidity via the cloud.

 curl -X GET "https://openapi.api.govee.com/router/api/v1/user/devices"  -H "Content-Type: application/json"  -H "Govee-API-Key: Your-API-Key"

Using that API directly, I was able to pull live readings from all my H5179 sensors — a real surprise, since the older Govee integrations only supported lights and plugs.
This means I can now read both local (BLE) and remote (cloud) sensors inside the same system.

curl -X POST "https://openapi.api.govee.com/router/api/v1/device/state" \
  -H "Content-Type: application/json" \
  -H "Govee-API-Key: Your-API-Key" \
  -d '{
    "requestId": "test-123",
    "payload": {
      "sku": "H5179",
      "device": "DE:76:17:29:AA:AA:AA:AA"
    }
  }'

Output will lool simillar to this:

{"requestId":"test-123","msg":"success","code":200,"payload":{"sku":"H5179","device":"DE:76:17:29:AA:AA:AA:AA","capabilities":[{"type":"devices.capabilities.online","instance":"online","state":{"value":true}},{"type":"devices.capabilities.property","instance":"sensorTemperature","state":{"value":55.04}},{"type":"devices.capabilities.property","instance":"sensorHumidity","state":{"value":80.3}}]}}

And that opened the door for the next step: bringing the cloud readings into my local system through Node-RED and MQTT.

It’s not just a workaround — it’s the flexibility I wanted from the start:
local when possible, cloud when necessary.
And with that, every sensor at the vacation house — whether Bluetooth or Wi-Fi — finally reports home.

Step 4 – Bringing Govee H5179 into Node-RED and Home Assistant

Once I confirmed that the H5179 sensors could be queried through Govee’s cloud API, the next goal was to make those readings part of the local automation system — not just visible in the Govee app.

That’s where Node-RED came back into play.

I built a small flow that pulls temperature and humidity from the cloud and publishes them into my MQTT broker.

The structure is simple but powerful:

[Inject] → [Change (API headers & payload)] → [HTTP Request] → [JSON Parse] → [Function (convert & split)] → [MQTT Out (temperature/humidity)]

[Inject] – Starts the flow every 5 minutes.

[Change (API headers & payload)] – This block is the heart of the communication with the Govee cloud API.
Every time Node-RED needs to retrieve fresh readings from a sensor, it first builds the HTTP request — and that happens right inside this Change node.
It prepares two things:

1. The headers

These tell the Govee API who we are and what kind of data we’re sending.
In the Change node, we set:

{
  "Content-Type": "application/json",
  "Govee-API-Key": "YOUR_API_KEY_HERE"
}
  • Content-Type tells the server that we’re sending JSON.
  • Govee-API-Key identifies your account — without it, Govee won’t return any data.

Node-RED stores this inside msg.headers, so the next node (HTTP Request) knows exactly how to send the request.

2. The payload

This is the actual “question” we’re asking Govee.
For example, to request the readings for a specific sensor:

{
  "requestId": "node-red",
  "payload": {
    "sku": "H5179",
    "device": "DE:76:17:29:AA:AA:AA:AA"
  }
}
  • requestId is just a label — it can be any string.
  • sku is the device type (H5179).
  • device is the unique ID of the sensor whose data we want.

This JSON goes into msg.payload, and together with the headers, forms a complete and valid request for the Govee API

[HTTP Request] – Sends a POST request to https://openapi.api.govee.com/router/api/v1/device/state with my API key and the device’s unique ID. Set Return on “a parsed JSON object”

[Function] – Extracts both temperature and humidity from the response, converts the Fahrenheit values returned by the API into Celsius, and publishes them into two MQTT topics — one for temperature, one for humidity.

let cap = msg.payload.payload.capabilities;

let tempFObj = cap.find(c => c.instance === "sensorTemperature");
let humObj   = cap.find(c => c.instance === "sensorHumidity");

if (!tempFObj || !humObj) {
    node.warn("Temperature or humidity not found in Govee response");
    return null;
}

let tempF = tempFObj.state.value;
let hum   = humObj.state.value;

// convert Fahrenheit → Celsius
let tempC = (tempF - 32) * 5 / 9;

let msgTemp = {
    topic: "home/vacationhouse/basement/temperature",
    payload: tempC.toFixed(1)
};

let msgHum = {
    topic: "home/vacationhouse/basement/humidity",
    payload: hum.toFixed(1)
};

return [ msgTemp, msgHum ];

[MQTT] – Govee sensor now reports to the system through two MQTT topics: one carrying the temperature, the other the humidity.

home/vacationhouse/basement/temperature
home/vacationhouse/basement/humidity

Node-RED updates both values on a schedule, making sure the dashboard in Home Assistant always reflects what’s happening in the house, room by room, in real time.

On the Home Assistant side, the rest was easy.
I simply defined the sensors in configuration.yaml:

mqtt:
  sensor:
    - name: "Basement Temperature"
      state_topic: "home/vacationhouse/basement/temperature"
      unit_of_measurement: "°C"

    - name: "Basement Humidity"
      state_topic: "home/vacationhouse/basement/humidity"
      unit_of_measurement: "%"

After a quick restart, the new MQTT entities appeared in Home Assistant, right next to the BLE-based sensors. From there, I added them manually to my dashboard — and once placed, they started updating in real time, just like the local sensors.

It’s a clean bridge between the cloud and the local network:
Node-RED does the fetching, Mosquitto carries the messages, and Home Assistant handles the visualization and automation.

Wrap-up

With the Tuya devices integrated, the BLE sensors online, and the Govee Wi-Fi sensors now feeding data through Node-RED and MQTT, the monitoring setup is finally taking shape.
We now have a solid foundation: data is flowing, the dashboard is alive, and everything is connected exactly the way I want — locally where possible, cloud-based where necessary.

But this is only the beginning.

In the next post, we’ll continue expanding the system with additional integrations and more advanced automations.
And since the vacation house sometimes loses internet or power, we’ll also build the script that detects when the main connection is down and automatically switches to the backup connection.

Plenty more to come — and things are just getting interesting.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top