Home Assistant Add-on: rtl_433 with MQTT auto discovery

Would it be possible to add support for autodiscovery of the GS-WDS07 contact sensor (on/off) and battery (on/off)? It’s arguably the most popular 433 contact sensor.

Protocol 30 seems to pick it up relatively easily but I also see in the example conf file from your docs that there is this section:

# # Golden Security GS-WDS07 door and window sensor
# #  short is 476 us + 1344 us
# #  long is 1364 us + 448 us
# #  packet gap 13972 us
# #decoder n=gswds07,m=OOK_PWM,s=476,l=1364,r=15000,g=1600,bits>=24,bits<=25,invert

Pretty cool if you could!

Jon

P.S. As an RTL_433 newb moving from Sonoffs RF_Bridge the rtl_433 wrapper and the autodiscovery you have here is fundamentally amazing!!

Thanks for filing a feature request on Github Feature Request: Contact sensors like GS-WDS07 · Issue #15 · pbkhrv/rtl_433-hass-addons · GitHub. Let’s continue this conversation there.

Excellent add-on, thank you.
During installation I noticed a minor issue, not sure if it relates to the base RTL433 code and probably not worth making a proper issue of:
My standard mqtt_user’s password contains some “special” characters such as # and @. For some reason that caused the MQTT login to be rejected (error code 5). Once I created another HA user to use with rtl_433, with a more “friendly” password, everything works as it’s supposed to.

Hey all,

@allmyhinges

Wondering if I could get some help here. I am running Supervised in Proxmox and have a NooElec NESDR Mini 2 passed through to HA. I installed the rtl_433 add-on and the following config:

device        0
gain          0
frequency     433.92M
hop_interval  600
ppm_error     0
sample_rate   250k
report_meta level
report_meta noise
report_meta stats
report_meta time:usec
report_meta protocol
output json
output mqtt://192.168.1.244:1883,user=rtl_433,pass=HArtl433,events=rtl_433[/model][/id]
convert customary
stop_after_successful_events false

I mostly just took out the fluff from the example config and added my MQTT info.

Mosquitto broker is installed without logins and I can use MQTT explorer to see the MQTT messages coming through from my acurite sensor and the occasional TMPS driving by.

{"time":"2021-09-03 15:36:48.873488","protocol":40,"model":"Acurite-5n1","message_type":49,"id":754,"channel":"A","sequence_num":2,"battery_ok":0,"wind_avg_mi_h":0,"wind_dir_deg":247.5,"rain_in":0.06,"mic":"CHECKSUM"}

Now what I am struggling with is using the auto-discover to pull that into home assistant.
This is my auto-discover config:

mqtt_host: 192.168.1.244
mqtt_port: 1883
mqtt_user: rtl_433
mqtt_password: HArtl433
mrtt_retain: checked
rtl_topic: rtl_433
discovery_prefix: homeassistant
discovery_interval: 60

Here is the auto-discover log:

[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_mqtt_hass.py...

I have read through the Home Assistant mqtt discovery doc, but at this point I am kind of lost as to what is supposed to happen next.

What am I missing?

To check whether the auto-discover script is working, please check MQTT explorer - you should see topics under homeassistant/sensor/ with names related to Acurite. Here’s what that looks like on my install:

hass-auto-discovery-mqtt

What are you seeing on your end?

1 Like

All my MQTT messages are under rtl_433, which I believe is the rtl_433 add on.

image

Your auto-discovery add-on config lists discover_interval, but it should be discovery_interval - can you please double-check the config again?

As for how auto-discovery works:

The rtl_433 add-on posts messages under the “rtl_433” topic, like in your screenshot.

The auto-discovery add-on reads those messages from the rtl_433/* topics and posts special MQTT auto-discovery messages under “homeassistant” topic (those are controlled by the auto-discovery add-on config values “rtl_topic” and “discovery_prefix” respectively).

2 Likes

That was just a typo from me typing out the config instead of a screenshot. Here is the Auto Discovery configuration.

Do I need to add /* to the rtl_topic?

The default value for rtl_topic is rtl_433/+/events set yours to this and restart.

1 Like

Done. I waited an hour and I am not seeing any homeassistant messages in mqtt explorer, but the rtl_433 messages keep updating.

Seeing anything useful in the auto discover addon log?

1 Like

I do not and I refreshed before the screenshot.

image

Ah… i think this part of your rtl_433 config is the issue. Please remove the events=... part from the output key in your rtl_433.conf - rtl_433 will use a sensible default that the auto-discovery add-on understands.

2 Likes

That did it immediately! Guess that’s what I get for following instructions in other treads without fully understanding MQTT.

image

One more thing.

Rain Total is coming into rtl in inches, but being converted to mm in the auto discover script. How can that be changed?

The conversion is hard-coded into the auto-discovery script unfortunately with no easy way of adding an option to avoid it. As a workaround, you could create a template sensor in HA that would take the mm value and covert it back into inches - it would be a new “sensor” in HA that derives its value from the one being reported by rtl_433. There might also be a setting in HA somewhere to show everything in inches instead of mm? not sure, sorry.

1 Like

Interesting that it forces conversion. I don’t think there is a HA setting since HA just takes whatever is fed into it.

Appreciate the help!

There is a HA setting under Configuration → General that will force-convert temperature, at least for stuff displayed in the Lovelace dashboard. When I first started with HA, I remember this being a point of contention for me when trying to display HVAC temperatures in F, and computer/server monitoring temperatures in C.

Yeah I already have that set to Imperial, being in the US. This is a problem because it taking a measurement from inches to mm and logging the data in mm. So all future rain data will be logged in mm.

I did what allmyhinges said and just made a separate sensor that pulls the data instead of relying on the auto-discoved one.

1 Like

Is the docker itself available somewhere. I do not run HA in a fashion where supervisor is available. So I would like to run this separate.