Home Assistant Add-on: rtl_433 with MQTT auto discovery

You can also manually create a homeassistant configuration with an mqtt client. MQTT Explorer is pretty good. I did this for my doorbell (via the MQTT Device Trigger - Home Assistant addon) which is not supported by the discovery script yet.

2 Likes

I’m having the same issue. I just updated about 5 days ago. Every time I restart the rtl_433 add-in, my /config/rtl_433.conf gets deleted which caused all my 433 devices to not get updated. Fortunately, I was able to fix my issue by just updating the /rtl_433/rtl_433.conf.template as follows:

output mqtt://${host}:${port},user=${username},pass=${password},retain=${retain},events=rtl_433[/model][/id]

That matches the previous output format my MQTT devices were expecting.

3 Likes

How did this pan out? I am specifically looking for my electric meters that are named SCM+ (having singled out the protocol for SCM+) but my meters are not being added to HA due to this exact error.

If you at all can replicate it, I’d appreciate testing steps. The only rm call is at rtl_433-hass-addons/rtl_433/run.sh at b24832540cf708d9ec377e6c0588bd96e46895b2 · pbkhrv/rtl_433-hass-addons · GitHub and that shouldn’t be executed if the “single file” configuration is available: rtl_433-hass-addons/rtl_433/run.sh at b24832540cf708d9ec377e6c0588bd96e46895b2 · pbkhrv/rtl_433-hass-addons · GitHub

Mind clarifying what error you’re referring to?

Is is possible to add a prefix to each auto discovered device? For example, new devices would show up in the Home Assistant MQTT integration page as something like “RTL433 Acurite xxxxx.” I have Zigbee2MQTT prefix “Z2M” so I can easily sort the devices in Home Assistant. Would like to do the same with RTL433.

Thanks.

It would need to be added to the upstream bridge script as a command line option, and then we could add it as a configuration to the addon.

Could you link to how zigbee2mqtt does it? I don’t see it mentioned at Home Assistant | Zigbee2MQTT.

I misspoke. I guess I just manually renamed them in Zigbee2MQTT a long time ago and forgot. When I rename in the Zigbee2MQTT though it does pass the name change through to the Home Assistant entity automatically. I think this is what I was thinking of.

Either way, the prefix is probably something only I do so if you add it, that would be awesome, but please don’t go out of your way.

Thanks

1 Like

I also have an item that is skipped in the log file;

Published Cotech-367959/72: time, battery_ok, temperature_F, humidity, rain_mm, wind_dir_deg, wind_avg_m_s, wind_max_m_s, uv
Skipped Cotech-367959/72: light_lux

The light lux is not available in HA.

It does appear in the rtl_433 log

rtl_433] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[rtl_433] 
[rtl_433] time      : 2022-01-14 23:07:10
[rtl_433] model     : Cotech-367959
[rtl_433] ID        : 72
[rtl_433] Battery   : 1
[rtl_433] Temperature: 47.2 F
[rtl_433] Humidity  : 85 %
[rtl_433] Rain      : 49.5 mm
[rtl_433] Wind direction: 168
[rtl_433] Wind      : 0.3 m/s
[rtl_433] Gust      : 0.7 m/s
[rtl_433] Light Intensity: 0 lux
[rtl_433] UV Index  : 0
[rtl_433] Integrity : CRC
[rtl_433] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

How can I fix this ?

The scripts look for lux and not light_lux. That’s why it’s not picked up. You could submit an issue at the RTL-433 project page in Github asking for the measurement name to be changed.

It’s at lines 123 and 144 in the file rtl_433/cotech_36_7959.c at 32c1f4a65fd238be70dee4af7ef8c58cec7af554 · merbanan/rtl_433 · GitHub

1 Like

Thanks for the reply.
Sorry but I don’t understand, on lines 123 & 144 in the file ‘light_lux’ is specified.

Are you saying that the weatherstation is sending ‘lux’, if so where can I see that.

Since I posted this issue I have added several of my old CurrentCost devices and they are all detected. However all of the power readings are skipped.

Are these issues connected ?

The weather station code in RTL_433 is sending the string light_lux but the Python script is looking for simply lux, and therefore doesn’t recognize it.

Asking the maintainers at RTL_433 to change something that’s already established probably isn’t going to work, anyway. It would probably be easier for @deviantintegral or pbkhrv to update the Python script to add synonyms/aliases as a feature to support more/different existing RTL_433-recognized devices like this particular weather station.

I’d been working on an ESPHome custom component to handle this SainLogic weather station, and set it aside yesterday to setup these two add-ons. Now, RTL_433 is definitely capturing the data messages every fifteen seconds, and the script is recognizing them, but I still don’t see any sensors being created in Home Assistant. :frowning: Just wondering if I completely missed something, somewhere?

homeassistant/sensor/Cotech-367959-121/Cotech-367959-121-UTC/config : {"device_class": "timestamp", "name": "Cotech-367959-121-UTC", "icon": "mdi:clock-in", "state_topic": "rtl_433/b854a4b8-rtl433/devices/Cotech-367959/121/time", "unique_id": "Cotech-367959-121-UTC", "device": {"identifiers": "Cotech-367959-121", "name": "Cotech-367959-121", "model": "Cotech-367959", "manufacturer": "rtl_433"}, "force_update": "true"}
homeassistant/sensor/Cotech-367959-121/Cotech-367959-121-B/config : {"device_class": "battery", "name": "Cotech-367959-121-B", "unit_of_measurement": "%", "value_template": "{{ float(value|int) * 99 + 1 }}", "state_topic": "rtl_433/b854a4b8-rtl433/devices/Cotech-367959/121/battery_ok", "unique_id": "Cotech-367959-121-B", "device": {"identifiers": "Cotech-367959-121", "name": "Cotech-367959-121", "model": "Cotech-367959", "manufacturer": "rtl_433"}, "force_update": "true"}
homeassistant/sensor/Cotech-367959-121/Cotech-367959-121-F/config : {"device_class": "temperature", "name": "Cotech-367959-121-F", "unit_of_measurement": "\u00b0F", "value_template": "{{ value|float }}", "state_topic": "rtl_433/b854a4b8-rtl433/devices/Cotech-367959/121/temperature_F", "unique_id": "Cotech-367959-121-F", "device": {"identifiers": "Cotech-367959-121", "name": "Cotech-367959-121", "model": "Cotech-367959", "manufacturer": "rtl_433"}, "force_update": "true"}
homeassistant/sensor/Cotech-367959-121/Cotech-367959-121-H/config : {"device_class": "humidity", "name": "Cotech-367959-121-H", "unit_of_measurement": "%", "value_template": "{{ value|float }}", "state_topic": "rtl_433/b854a4b8-rtl433/devices/Cotech-367959/121/humidity", "unique_id": "Cotech-367959-121-H", "device": {"identifiers": "Cotech-367959-121", "name": "Cotech-367959-121", "model": "Cotech-367959", "manufacturer": "rtl_433"}, "force_update": "true"}
homeassistant/sensor/Cotech-367959-121/Cotech-367959-121-RT/config : {"name": "Cotech-367959-121-RT", "unit_of_measurement": "mm", "value_template": "{{ value|float }}", "state_topic": "rtl_433/b854a4b8-rtl433/devices/Cotech-367959/121/rain_mm", "unique_id": "Cotech-367959-121-RT", "device": {"identifiers": "Cotech-367959-121", "name": "Cotech-367959-121", "model": "Cotech-367959", "manufacturer": "rtl_433"}, "force_update": "true"}
homeassistant/sensor/Cotech-367959-121/Cotech-367959-121-WD/config : {"name": "Cotech-367959-121-WD", "unit_of_measurement": "\u00b0", "value_template": "{{ value|float }}", "state_topic": "rtl_433/b854a4b8-rtl433/devices/Cotech-367959/121/wind_dir_deg", "unique_id": "Cotech-367959-121-WD", "device": {"identifiers": "Cotech-367959-121", "name": "Cotech-367959-121", "model": "Cotech-367959", "manufacturer": "rtl_433"}, "force_update": "true"}

Even after manually adding the MQTT sensor definitions in configuration.yaml and reviewing the incoming data using MQTT Explorer, nothing shows up in the sensor values. :frowning: :frowning: :frowning:

The python script comes from rtl_433/examples/rtl_433_mqtt_hass.py at 32c1f4a65fd238be70dee4af7ef8c58cec7af554 · merbanan/rtl_433 · GitHub, and we’re working at getting rid of having to patch it. Any changes there will eventually make it to the addon, though it’s taking me longer than I’d like to get there!

At a glance, those look correct. Here’s what I have for my sensor, in case it helps:

homeassistant/sensor/LaCrosse-TX141THBv2-0-166/LaCrosse-TX141THBv2-0-166-H/config : {"device_class": "humidity", "name": "LaCrosse-TX141THBv2-0-166-H", "unit_of_measurement": "%", "value_template": "{{ value|float }}", "state_topic": "rtl_433/local-rtl433/devices/LaCrosse-TX141THBv2/0/166/humidity", "unique_id": "LaCrosse-TX141THBv2-0-166-H", "device": {"identifiers": "LaCrosse-TX141THBv2-0-166", "name": "LaCrosse-TX141THBv2-0-166", "model": "LaCrosse-TX141THBv2", "manufacturer": "rtl_433"}}

Do you have other mqtt sensors or devices showing up? I suppose a first double check would be to make sure Home Assistant can actually talk to the MQTT broker.

No, I’ve pretty much avoided MQTT for the years I’ve been using Home Assistant. I’ll admit it, I didn’t want another interface. I used ESPHome for most of my sensors, and MQTT just wasn’t necessary. Well, a few things have changed since then. First, the Mosquitto MQTT add-on is much better integrated these days, and second, if RTL433 will feed me the data via MQTT, then I’ll begrudgingly add MQTT to my mix.

Of course, as soon as I’m willing to try it, it just falls flat without telling me much. Go figure. :crazy_face:
I can check my logs for any details, but if MQTT Explorer can attach to the HA/Mosquitto server and see all the messages, then I presume they should be flowing whereever necessary within HA.

There’s a very basic mqtt client inside of the mqtt integration on the Home Assistant side. If you subscribe to # in it, you can double check that messages are being picked up.

1 Like

I created a separate thread for my problem. It turned out to be HA’s in-built MQTT integration. HA had established a page of settings that were looking elsewhere. I pointed the in-built MQTT integration to the Mosquitto MQTT add-in instead, and now things are working well. :slight_smile:

Hey all,

Been using rtl_443 for a while with great success and it continues to work great. I am trying to update from 0.1.2 to 0.1.3 and am getting this error:

The command '/bin/ash -o pipefail -c git checkout ${rtl433GitRevision}' returned a non-zero code: 1

I know just enough about docker and command lines to get myself in trouble, but I don’t know where to start to track this down.

I searched the rtl_433 github issues page and this thread with no hits. Any help is appreciated to make sure my systems are up to date.

1 Like

Do the logs earlier show what rtl433GitRevision is set to? Any more errors from the checkout command?

This is the log when I restart the container:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Starting rtl_433 with rtl_433.conf...
[rtl_433] rtl_433 version 21.05 branch  at 202105091238 inputs file rtl_tcp RTL-SDR

When running the update I do not see anything in the container logs or the Home Assistant logs related to the container updating.

This is interesting; in the last few days, one of my installs is doing the same thing. It’s not even showing tuning the radio.

I tried stopping the container, and then running rtl_433’s upstream Docker images, and they’re not working either. I’ll get more log output, but no messages are shown from weather stations in the area. Rebooting doesn’t help either. I read a suggestion to physically unplug and replug the NESDR to ensure it gets a power reset, but I can’t do that remotely.

This is on a RPi 4, still on HAOS 6.6.

My radio is working just fine, but I do not get any more messages in the rtl_433 log than what is posted above. It seems in the past few updates they removed the config file so I can’t set the logging level anymore.

I am running HA OS Supervised 7.2 and version core 2021.12.10 on Proxmox.