Home Assistant Add-on: rtl_433 with MQTT auto discovery

Anyone figure out a solution to it auto discovering a ton of stuff. I am up to over 7500 devices, most of which are tpms sensors that I don’t want. I haven’t been able to come up with a way to mass delete them lol.

Can anyone claim a higher number?:slight_smile:

7500! I’m not sure of the best way to handle that. I wonder if you can delete devices in bulk with https://github.com/home-assistant-ecosystem/home-assistant-cli

We recently changed the installation directions to recommend not running the autodiscovery addon all the time. Unless you’re trying to add a device, you can turn off “Start on boot”: https://github.com/pbkhrv/rtl_433-hass-addons/blob/a698bb7e676f8c46fc147cd257ba22f6f9495861/rtl_433_mqtt_autodiscovery/README.md#installation

Hello, I am using #70 decoder for honeywell 2gig sensors. The RTL_433/events is able to see everything as expected. Open a door, I get instant publish to the RTL MQTT stream. However, the auto discovery does not appear to work properly.

https://imgur.com/a/zipRiHk

You can see that the events that are needed are being skipped. How do I fix this? Is the only solution to update that python script?

I had 45000 and it caused my homeassistant to be very laggy :smiley:
And my echo devices also stopped working because of this…
I think you have to stop the addon after adding your devices!

And i just deleted the complete mqtt integration to get rid of the devices.

so i also have a problem: after reboot I have to restart the plugin for my devices to be recognised again by HA is this normal?

I tried to run the addon on my Intel NUC with plugged Realtek SDR (worked fine with Raspberry).
I get following error:

[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.12-101-g9eec4611 branch  at 202204282249 inputs file rtl_tcp RTL-SDR
/tmp/rtl_433_heredoc: line 8: warning: here-document at line 1 delimited by end-of-file (wanted `EOD')
Starting rtl_433 with rtl_custom.conf...
[rtl_custom] rtl_433 version 21.12-101-g9eec4611 branch  at 202204282249 inputs file rtl_tcp RTL-SDR
[rtl_custom] Use -h for usage help and see https://triq.org/ for documentation.
[rtl_custom] Registered 2 out of 218 device decoding protocols [ 214 217 ]
[rtl_custom] usb_claim_interface error -6
[cmd] /run.sh exited 2
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

doesn’t matter if I leave config as basic, or try this:

device :00000001

protocol    214
protocol    217

convert     si
report_meta newmodel

I have tried experimenting with multiple “device” definitions, or omit it completely. Simply can’t get it to start.

1 Like

You can also manually publish a topic to configure the device: MQTT - Home Assistant

Make sure “retain” is set in the mqtt autodiscovery addon configuration when running it, which will cause it to persist the messages across reboots.

Are you running HAOS or something else? It sounds like this can be caused when a different driver is running. I’d be surprised if this has anything to do (or that we can fix) from the addon.

I was pleasantly surprised at how easy this all worked. I plugged in my SDR dongle to the RPi started the RTL_433 add-on and my Clipsal-CMR113 (ancient energy monitor) was discovered by the Mosquitto broker. However, reading the RTL_433 MQTT Auto discovery log suggests one packet is being skipped:

INFO:root:Published Clipsal-CMR113: time
INFO:root:Skipped Clipsal-CMR113: current_1_A, current_2_A, current_3_A

How do you publish the current _1_A data too?

There also seems to be an issue with parsing the time as the HA core logs throw this exception:

Exception in message_received when handling msg on 'rtl_433/9b13b3f4-rtl433/devices/Clipsal-CMR113/time': '2022-08-04 21:09:02' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 47, in wrapper msg_callback(msg) File "/usr/src/homeassistant/homeassistant/components/mqtt/sensor.py", line 306, in message_received self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state state = self._stringify_state(available) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state if (state := self.state) is None: File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 398, in state raise ValueError( ValueError: Invalid datetime: sensor.clipsal_cmr113_utc provides state '2022-08-04 21:09:02', which is missing timezone information

Any advice on how I might fix this?

1 Like

The autodiscovery script only supports a subset of all of the device types listed at MQTT - Home Assistant. You can manually modify the configuration topic to get it to work. Otherwise, upstream has been receptive to pull requests adding additional configuration types to the python script.

That’s from HASS bridge emits incorrectly formatted time · Issue #1904 · merbanan/rtl_433 · GitHub and Datetime without timezone exceptions with HA 12.0 · Issue #35 · pbkhrv/rtl_433-hass-addons · GitHub. I’m thinking of updating the default configuration to specify the time as I think more sensors than I realized cause a timestamp to be recorded like that.

Hello,

Yesterday and today I spent around rtl_433.

After a whole day of trial and error, I figured out that I actually need to edit /config/rtl_433/rtl_433.conf.template file and put there relevant information. Currently, the config looks like the following:

frequency 433.92M 315M 345M 868M 
#report_meta newmodel
#frequency 433.92M
#frequency 345M
#frequency 868M
convert     si

protocol 162 # ThermoPro-TX2 temperature sensor
protocol 53  # Springfield Temperature and Soil Moisture 
protocol 209 # SimpliSafe Gen 3 Home Security System
protocol 102 # SimpliSafe Home Security System (May require disabling automatic gain for KeyPad decodes)

protocol 2   # Rubicson, TFA 30.3197 or InFactory PT-310 Temperature Sensor
protocol ...
protocol ...

rtl_433 log looks like the following:

[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.
/tmp/rtl_433_heredoc: line 265: warning: here-document at line 1 delimited by end-of-file (wanted `EOD')
Starting rtl_433 with rtl_433.conf...
[rtl_433] rtl_433 version 21.12-101-g9eec4611 branch  at 202204282249 inputs file rtl_tcp RTL-SDR
[rtl_433] Use -h for usage help and see https://triq.org/ for documentation.
[rtl_433] Publishing MQTT data to core-mosquitto port 1883
[rtl_433] Publishing device info to MQTT topic "rtl_433/9b13b3f4-rtl433/devices[/type][/model][/subtype][/channel][/id]".
[rtl_433] Publishing events info to MQTT topic "rtl_433/9b13b3f4-rtl433/events".
[rtl_433] Publishing states info to MQTT topic "rtl_433/9b13b3f4-rtl433/states".
[rtl_433] Registered 206 out of 218 device decoding protocols [ 162 53 209 102 2 12 32 34 40 45 69 84 88 97 110 117 130 134 136 143 145 155 157-158 166 168 172-173 175 190 193 213 1 4 6-8 10-11 13-17 19-26 29-31 33 35-39 41-44 46-52 54-64 67-68 70-83 85-87 89-96 98-101 103-105 108-109 111-116 119-129 131-133 135 137-142 144 146-154 156 159-161 163-165 167 169-171 174 177-189 191-192 194-197 199-208 210-212 214-215 217-218 ]
[rtl_433] Detached kernel driver
[rtl_433] Found Rafael Micro R820T tuner
[rtl_433] Exact sample rate is: 250000.000414 Hz
[rtl_433] [R82XX] PLL not locked!

I don’t see any errors in the supervisor, however, in the core log, I see the following entry:

logger: homeassistant
Source: components/sensor/__init__.py:398
First occurred: 9:15:56 PM (5 occurrences)
Last logged: 9:21:01 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 892, in _async_registry_updated
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 398, in state
    raise ValueError(
ValueError: Invalid datetime: sensor.thermopro_tx2_9_3_105_utc provides state '2022-08-09 21:15:15', which is missing timezone information

Also, the following entry is repeated every minute, it is spamming the log

Exception in message_received when handling msg on 'rtl_433/9b13b3f4-rtl433/devices/Thermopro-TX2/9/3/105/time': '2022-08-09 21:58:11' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 47, in wrapper msg_callback(msg) File "/usr/src/homeassistant/homeassistant/components/mqtt/sensor.py", line 306, in message_received self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state state = self._stringify_state(available) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state if (state := self.state) is None: File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 398, in state raise ValueError( ValueError: Invalid datetime: sensor.thermopro_tx2_9_3_105_utc provides state '2022-08-09 21:58:11', which is missing timezone information

I would appreciate if someone can point me to how to fix the above error.

Secondly, how can I tell if all the bands - 433.92M 315M 345M 868M are used to decode the signal, and not just 433?

Thanks

Adding added report_meta time:iso:tz:local to the config did not help. Still getting the following message in the core log every 10 seconds:

* Exception in message_received when handling msg on 'rtl_433/9b13b3f4-rtl433/devices/Thermopro-TX2/9/2/150/time': '2022-08-09 22:23:45' Traceback (most recent call last): File 
"/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 47, in wrapper msg_callback(msg) File "/usr/src/homeassistant/homeassistant/components/mqtt/sensor.py", line 306, in message_received self.async_write_ha_state() File 
"/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state state = self._stringify_state(available) File 
"/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state if (state := self.state) is None: File 
"/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 398, in state raise ValueError( ValueError: Invalid datetime: sensor.thermopro_tx2_9_2_150_utc provides state '2022-08-09 22:23:45', which is missing timezone information

Hello community

After spending quite a lot of time today setting up rtl_433 in HA, on HassOS, without supervisor, but with HACS, without success, I would like to ask for your help.
Unfortunately, there are always very specific solutions offered immediately on all topics. Almost never a cook recipe described.
Therefore I have a big request to you!
Can you please create such a recipe for the installation of the following components:
rtl_433 (the program itself)
rtl_433 add-on
or
rtl_433 MQTT Auto Discovery Add-on

with kind regards
Willi

Hallo Communitiy

Nachdem ich heute ziemlich viel Zeit mit dem Einrichten von rtl_433 in HA, auf HassOS, ohne Supervisor, aber mit HACS, erfolglos verbracht habe, möchte ich um deine Hilfe bitten.
Es werden leider bei allen Themen sofort immer sehr spezielle Lösungen angeboten. Fast nie ein Kochrezept beschrieben.
Daher habe ich ein grosse Bitte an Dich!
Kannst Du bitte ein solches Rezept für die Installation von folgenden Komponenten erstellen:
rtl_433 (das Programm selbst)
rtl_433 Add-on
bzw.
rtl_433 MQTT Auto Discovery Add-on

mit freundlichen Grüßen
Willi

Hi, I’m not sure if this works for HassOS, but hope it might help you anyway.

This is my docker-compose.yml file I am using for rtl_433:

version: '3'
services:
  mosquitto:
    image: eclipse-mosquitto
    volumes:
      - mosquitto:/mosquitto/:rw
    ports:
      - 1883:1883
     # - 9001:9001
    entrypoint: "mosquitto -c /mosquitto-no-auth.conf"
  
  rtl_433_autodiscovery:
    image: ghcr.io/pbkhrv/rtl_433-hass-addons-rtl_433_mqtt_autodiscovery-amd64
    depends_on:
      - "mosquitto"
      - "rtl_433"
    entrypoint: "python3 -u /rtl_433_mqtt_hass.py -H mosquitto -p 1883 -R rtl_433/+/events -D homeassistant -i 600"
  
  rtl_433:
    image: hertzg/rtl_433:latest
    depends_on:
      - "mosquitto"
    devices:
      - '/dev/bus/usb/001/010'
    command:
    #  - '-Mtime:unix:usec:utc'
      - '-Mbits'
      - '-Mlevel'
      - '-Mprotocol'
      - '-Mstats:2:300'
      - '-Fmqtt://mosquitto:1883,retain=1'

I am receiving some parsing errors in homeassistant which is why I commented ‘-Mtime:unix:usec:utc’ out (rtl_433, though I don’t think this helped). Configuring the autodiscovery container via environment variables did not work for me, which is why I added the entrypoint configuration. In homeassistant, you would add an MQTT integration for localhost. USB device for rtl_433 needs to be changed too, of course.

Hope this helps someone!

1 Like

That’s surprising, because the error shows the value without timezone information still. Is there any chance that message is marked with retain and hasn’t actually been updated by the sensor?

I think I’m going to add the timezone setting to the default configuration, so at least for new installs it will work out of the box. However, there’s also open discussions where I’m working on figuring out the proper setup for “last updated” to work correctly for all sensors.

I think you will see Tuning messages in the rtl_433 log. Note the default hop interval is 10 minutes: rtl_433/conf/rtl_433.example.conf at 963adb78f7a768b995c3027fc32749811d553c5d · merbanan/rtl_433 · GitHub

Have you looked at the Github? It breaks things down fairly clearly. For most installs (especially HassOS) the only thing you need to configure is the conf file, which is detailed at the bottom of the Github readme.

What specific issues are you having with your install/setup?

1 Like

Seems I managed to get rid of the message in log, it shows from time to time after rebooting hosts and/or restarting configs.

1 Like

Hi,

Ive got the RTL_433 running for some time and working fine configured manually. However i’d like to setup autodiscovery instead of all the manual configuration so I thought I would try the add ons.
Mqtt working fine.
rtl_433 MQTT Auto Discovery


[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.
mqtt found in this Home Assistance instance.
Starting rtl_433_mqtt_hass.py…
INFO:root:Discovering all devices
INFO:root:MQTT connected: Connection Accepted.
INFO:root:Subscribing to: rtl_433/+/events


mqtt_host: 192.168.1.115
mqtt_port: 1883
mqtt_user: 1234
mqtt_password: 1234
mqtt_retain: true
rtl_topic: rtl_433/+/events
discovery_prefix: homeassistant
discovery_interval: 600
force_update: true
log_level: default

However nothing appears under rtl_433 except the sensors publishing to it. ha_rtl_433

I also never get a homeassistant topic. Ive got all sorts of other not rtl_433 devices working with autodiscovery but cant figure this out.

I don’t see events in your screenshot. Is your rtl_433 config somehow disabling that? You should be getting a slightly different structure in rtl_433:

I got the USB dongle recognised but its not recognising the config file. Its not outputting to mqtt

[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.
[19:40:02] WARNING: rtl_433 now supports automatic configuration and multiple radios. The rtl_433_conf_file option is deprecated. See the documentation for migration instructions.
Starting rtl_433 -c /config/-F "mqtt://192.168.1.115:1883,user=username,pass=password,retain=0,devices=rtl_433[/id]"
rtl_433 version 21.12-101-g9eec4611 branch  at 202204282249 inputs file rtl_tcp RTL-SDR
Use -h for usage help and see https://triq.org/ for documentation.
Failed to stat "/config/-F "mqtt://192.168.1.115:1883,user=user,pass=password,retain=0,devices=rtl_433[/id]""
Registered 186 out of 218 device decoding protocols [ 1-4 8 11-12 15-17 19-23 25-26 29-36 38-60 63 67-71 73-100 102-105 108-116 119 121 124-128 130-149 151-161 163-168 170-175 177-197 199 201-215 217-218 ]
Found Rafael Micro R820T tuner
Exact sample rate is: 250000.000414 Hz
[R82XX] PLL not locked!
Sample rate set to 250000 S/s.
Tuner gain set to Auto.
Tuned to 433.920MHz.
Allocating 15 zero-copy buffers
baseband_demod_FM: low pass filter for 250000 Hz at cutoff 25000 Hz, 40.0 us
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
time      : 2022-09-15 19:40:16
model     : Secplus-v1
id        : 0
ID_0      : 0
ID_1      : 0
Switch-ID : 0
Pin       : 0002
Fixed_Code: 118098
Rolling_Code: 626638848
bitbuffer_add_bit: Warning: row count limit (50 rows) reached

here its getting sensor data but its not reading my configuration

ID        : 117
Channel   : 3
Battery   : 0
Temperature: 79.50 F
Humidity  : 40 %
Integrity : CRC
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
time      : 2022-09-15 19:52:28
model     : inFactory-TH
ID        : 117
Channel   : 3
Battery   : 0
Temperature: 79.50 F
Humidity  : 40 %
Integrity : CRC
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

ok so i now realise i had to make a configuraiton file, which I have done. However:


output -F "mqtt://192.168.1.115:1883,user=USERNAME,pass=PASSWORD,retain=0,devices=rtl_433[/id]"

results in:

Invalid output format -F “mqtt://192.168.1.115:1883,user=USERNAME,pass=PASSWORD,retain=0,devices=rtl_433[/id]”

(i have redacted my username and password)

ok config shoul;d be:

output mqtt://192.168.1.115:1883,user=USERNAME,pass=PASSWORD,retain=0,devices=rtl_433[/id]

solved, hope this helps others.

1 Like

Does anyone know how to change the rtl_433 files to accept more keys? I was able to add my sensor to mttq but it is not checking for essential keys. the files use the C language if I am not mistaken.
i also don’t know where the files for ril_433 on my raspberry pi3 b

The add-on worked without problems until the HA restart.
Now, the add-in does not send any information to mqtt broker.
I don’t know how to fix it :frowning:

rtl_433.conf

frequency 868M
convert si
output      mqtt://192.168.1.113:1883,user=XXX,pass=XXX,retain=1

rtl_433 logs

[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.
[11:41:56] INFO: The mqtt addon is not available.
[11:41:56] INFO: Manually update the output line in the configuration file with mqtt connection settings, and restart the addon.
[11:41:56] WARNING: rtl_433 now supports automatic configuration and multiple radios. The rtl_433_conf_file option is deprecated. See the documentation for migration instructions.
Starting rtl_433 -c /config//rtl_433/rtl_433.conf.template
rtl_433 version 21.12-101-g9eec4611 branch  at 202204282249 inputs file rtl_tcp RTL-SDR
Use -h for usage help and see https://triq.org/ for documentation.
New defaults active, use "-Y classic -s 250k" for the old defaults!
Publishing MQTT data to 192.168.1.113 port 1883
Publishing device info to MQTT topic "rtl_433/8c985c30-rtl433/devices[/type][/model][/subtype][/channel][/id]".
Publishing events info to MQTT topic "rtl_433/8c985c30-rtl433/events".
Publishing states info to MQTT topic "rtl_433/8c985c30-rtl433/states".
Registered 186 out of 218 device decoding protocols [ 1-4 8 11-12 15-17 19-23 25-26 29-36 38-60 63 67-71 73-100 102-105 108-116 119 121 124-128 130-149 151-161 163-168 170-175 177-197 199 201-215 217-218 ]
Found Fitipower FC0012 tuner
Exact sample rate is: 1000000.026491 Hz
Sample rate set to 1000000 S/s.
Tuner gain set to Auto.
Tuned to 868.000MHz.
Allocating 15 zero-copy buffers
MQTT Connected...
baseband_demod_FM: low pass filter for 1000000 Hz at cutoff 200000 Hz, 5.0 us
MQTT Connection established.

rtl_433 MQTT Auto Discovery logs

[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.
Using an external mqtt broker.
Starting rtl_433_mqtt_hass.py...
INFO:root:Discovering all devices
INFO:root:MQTT connected: Connection Accepted.
INFO:root:Subscribing to: rtl_433/+/events
INFO:root:Published Bresser-6in1/0/88298514: time, channel, battery_ok, wind_max_m_s, wind_avg_m_s, wind_dir_deg, rain_mm
INFO:root:Skipped Bresser-6in1/0/88298514: sensor_type, flags