Project: decode 433 MHz weather and door sensors with an RTL-SDR and rtl_433, publish to MQTT, and auto-discover them in

Discuss integrations and ideas regarding Zigbee, Z-Wave, LoRa and proprietary systems
Post Reply
User avatar
ZerOne
Site Admin
Posts: 216
Joined: Sun Dec 13, 2020 8:21 am

A practical project that brings existing cheap 433 MHz sensors (weather station, temperature/humidity probes, some door contacts) into Home Assistant with a USB software-defined radio. It is based on the rtl_433 README and example configuration and the rtl_433_mqtt_hass.py helper script as at October 2026 (rtl_433 release 25.12). I have not run this exact setup. Check the project docs for the options on your version, and please post corrections.

What this does (and does not) do
  • rtl_433 listens with an RTL-SDR dongle and decodes the packets of many 433.92 MHz devices. The README describes it as a generic receiver mainly for the 433.92 MHz, 868 MHz, 315 MHz, 345 MHz and 915 MHz bands. It receives only. It does not transmit.
  • It publishes decoded readings to MQTT. A helper script then publishes Home Assistant MQTT discovery messages so entities appear automatically.
  • It only supports devices it has a decoder for. Check the supported-device list in the README before buying sensors. You can also run it in the same place for a while to see what is on the air near you.
What you need
  • An RTL-SDR USB dongle and a small antenna suitable for 433 MHz.
  • A small always-on Linux host or container (a Raspberry Pi works) on the same network as your MQTT broker. Put the dongle on a short USB extension, away from noisy USB 3 devices.
  • An MQTT broker (such as Mosquitto) with a username and password for rtl_433, and Home Assistant's MQTT integration with discovery enabled.
  • Compatible sensors. Many generic 433 MHz sensors are one-way and unencrypted, so the readings can be seen by anyone with a receiver.
Step 1: See what you can receive

Install rtl_433 from your distribution's package or build from source (see the README), then run it with no options:

Code: Select all

rtl_433
By default it listens on 433.92 MHz. You should see decoded lines from devices in range after a minute or two. Note the model and id fields. Neighbours' weather stations and car key fobs may show up too, so be mindful of what you choose to log and publish. If you need other frequencies, the -f option changes it (for example -f 868M).

Step 2: Publish to MQTT

The example configuration file documents the MQTT output: -F mqtt://host:port,options. By default the user and password come from the MQTT_USERNAME and MQTT_PASSWORD environment variables, which keeps the password out of the process list and the command history. Use SI units with -C si, which the HA helper script strongly recommends.

Code: Select all

export MQTT_USERNAME=rtl433
export MQTT_PASSWORD='your-password'
rtl_433 -C si -F mqtt://YOUR_BROKER_IP:1883,retain=0
rtl_433 publishes events, states and devices topics under a base topic that defaults to rtl_433/HOSTNAME. You can set it with base= in the MQTT options. Use MQTT Explorer or any MQTT client to confirm messages are arriving before moving on.

For anything permanent, put the options in an rtl_433 config file (the example config in the repository documents every option, including convert si and the output lines) and run it as a service (systemd or a container) so it restarts on boot.

Step 3: Home Assistant discovery

The repository's examples/rtl_433_mqtt_hass.py script subscribes to the rtl_433 events and publishes discovery topics so Home Assistant creates the entities. Its header notes that:
  • it needs the Python paho-mqtt library;
  • it can run as a daemon and republishes the configuration roughly every 10 minutes, or you can use MQTT retain so it only needs to run when things change;
  • if you changed rtl_433's topic structure you must pass the same topic to the script with -T;
  • you can test against a different discovery prefix first to avoid cluttering Home Assistant with stray entities, because transient devices and false positives linger until their config topic is cleared.
A basic run, using the options from the script's own help (check them for your version):

Code: Select all

export MQTT_USERNAME=rtl433
export MQTT_PASSWORD='your-password'
python3 rtl_433_mqtt_hass.py -H YOUR_BROKER_IP -r
The script's header documents the MQTT_USERNAME and MQTT_PASSWORD environment variables, which avoids putting the password on the command line where other users on the machine can see it. The -r option sets the MQTT retain flag.

Tidy-up and tips
  • Use the script's ID filter if you only want specific sensors, so neighbours' devices do not become entities.
  • Sensors with unreliable batteries, or that report only on change, may look "stale". The script has an option to force updates and one to expire values.
  • Do not rely on 433 MHz sensors for anything safety-critical.
  • rtl_433 only listens, but your MQTT broker should still need authentication. Do not expose it to the internet.
Links
Question for the group: has anyone built a whole-house sensor set on rtl_433? Which sensors (or weather station) work well in Australia, and which decoders were missing?
Post Reply

Return to “Other Wireless Sensor Integration”