Govee H5054

From Leo's Notes
Revision as of 05:23, 22 March 2025 by Leo (talk | contribs)
This page was last edited on 22 March 2025, at 05:23.

Govee H5054 is a wireless water sensor to detect water leaks. It uses the 433 MHz radio to transmit events.

RTL 433

See the source code here: https://github.com/merbanan/rtl_433/blob/master/src/devices/govee.c

Here's a sample output from rtl_433 for this device:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
time      : 2025-03-21 18:13:09
model     : Govee-Water  id        : 14029
event     : Button Press detect_wet: 0             Raw Code  : 36cd30547e22  Integrity : CRC
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
time      : 2025-03-21 18:13:11
model     : Govee-Water  id        : 14029
Battery level: 0.050     Battery   : 1860 mV       event     : Battery Report Raw Code  : 36cd310507c7 Integrity : CRC
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
time      : 2025-03-21 18:13:12
model     : Govee-Water  id        : 14029
Battery level: 0.050     Battery   : 1860 mV       event     : Battery Report Raw Code  : 36cd310507c7 Integrity : CRC
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
time      : 2025-03-21 18:13:14
model     : Govee-Water  id        : 14029
event     : Button Press detect_wet: 0             Raw Code  : 36cd30547e22  Integrity : CRC

Other notes

The device will begin chirping when the battery voltage drops below 2 volts (verified with a bench power supply). Every time it chirps, it will broadcast its battery reading values.

Home assistant integration

The rtl_433 utility is able to listen for and decode specific 433 MHz radio transmission messages using a RTL-SDR USB dongle. It supports sending decoded messages to various destinations including MQTT. As a result, we can use rtl_433 to effectively act as a gateway between 433 MHz radio transmissions and our Home Assistant MQTT broker.

For my personal setup, I have a Nooelec RTL-SDR USB dongle plugged into a OpenWRT router. The rtl_433 package is available on OpenWRT 24's package repos. You can create a procd init script that runs rtl_433 within OpenWRT by creating a file in /etc/init.d/rtl_433 with the following contents:

#!/bin/sh /etc/rc.common
USE_PROCD=1
START=95
STOP=01

start_service() {
    procd_open_instance
    procd_set_param command /usr/bin/rtl_433 -C si -R 231 -F "mqtt://mqtt-broker-server:1883,devices=rtl_433/Govee-Water[/id]"
    procd_close_instance
}

If you are not using OpenWRT or if you want to run the command manually, run the following:

# rtl_433 -C si  -R 231 -F mqtt://mqtt-broker-server:1883,devices=rtl_433/Govee-Water[/id]

Breaking the command down, the arguments are as follows:

  • -C si: Convert units to scientific units
  • -R 231: Decode only Govee H5054 messages. You can list all the supported messages by passing -R help.
  • -F specifies the output. In our case, we want to use MQTT without authentication using the topic rtl_433/Govee-Water/<device-id>. rtl_433 will replace [/id] with the actual device id.

Once rtl_433 is running, we will need to get Home Assistant configured for these sensors. Add the MQTT integration in Home Assistant.

Next, use the auto-discovery script at: https://github.com/mekaneck/Govee-Water-Leak-Home-Assistant-Autodiscovery. The installation involves copying and pasting the script into the Home Assistant configuration file. The script contains a list of devices that should be added. You will need to determine the random 5 digit device ID that the sensors are set to from the factory, their serial number (optional but helpful for you to identify the sensors later on), and a friendly name. Save the configuration file, restart Home Assistant, and then run the script (under Settings -> Automation -> Scripts). After running the script, you should see the sensors appear under the MQTT integration.

If you need help determining the 5 digit device ID for each sensor, you can run rtl_433 without the -F flag (so that it outputs directly to standard out) and then press the sensor button. You should be able to see the device id in the output. For example, 14029:

# rtl_433 -C si
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2025-03-21 21:49:08
model     : Govee-Water  id        : 14029
event     : Button Press detect_wet: 0             Raw Code  : 36cd30547e22  Integrity : CRC