Home Assistant Add-on: rtl_433 with MQTT auto discovery

If you don’t care about possibly missing some data, you can use hop_interval to rotate between frequencies. If missed data is a problem (like doorbells, motion sensors, etc) you’d need multiple radios.

1 Like

Hello, the official rtl433 integration seems to have 198 protocols, however the hassio-addon seems to only recognise 186 of them. However, in the source code it seems to use the last build of rtl_433. I tried to rebuild it but still the same. Does anyone know how this is possible?

On startup it gives this log:

Registered 15 out of 186 device decoding protocols

2 Likes

You would need to override this arg using --build-arg in your docker build command. I think you’d have to do it from the CLI, or change it in the Dockerfile in the addon directory and click “rebuild” in the UI.

Actually… it looks like we’re already using the latest stable release: https://github.com/merbanan/rtl_433/releases

Is it possible the other integration is using master, or is using an older revision that actually had protocols removed for some reason?

Yes, i already looked at that code, and it seems to use the latest version of the rtl_433 code. I’m not very familiar with docker-code myself and have no idea of the integration is using the wrong branch, it could be the problem. But it’s very strange since it selects the latest version, but doesn’t have the functionality of it.

@Anonymoesje wrote:

the official rtl433 integration seems to have 198 protocols

First, I think this is bit of a misnomer that’s causing some confusion. I don’t believe there is any rtl_433 integration official or otherwise. There is this add on discussed in this thread that isn’t part of the rtl_433 project that packages rtl_433 and the MQTT auto discovery script. (I think the add on is using a newer version of the MQTT auto discovery script than what is currently commited to the rtl_433 project, but that’s a separate point.)

Yes, i already looked at that code, and it seems to use the latest version of the rtl_433 code.

I think you are confusing latest release and latest “version” of rtl_433. 21.05 may be the “latest” stable release, but it’s 5 months old (May 9th) which is fairly old in rtl_433 time.

The number of “protocols” increases every time a new decoder is added to add support for a device. It should probably use the term “decoder” instead of “protocol”.

The current code in the master branch of rtl_433 on GitHub has 198 protocols defined. The list in README.md is up to date.

You can see the list of the 186 protocols that were defined in the README.md for 21.05.

The decoders that have been added since 21.05 was released on May 9th:

    [187]  RojaFlex shutter and remote devices
    [188]  Marlec Solar iBoost+ sensors
    [189]  Somfy io-homecontrol
    [190]  Ambient Weather WH31L (FineOffset WH57) Lightning-Strike sensor
    [191]  Markisol, E-Motion, BOFU, Rollerhouse, BF-30x, BF-415 curtain remote
    [192]  Govee Water Leak Dectector H5054, Door Contact Sensor B5023
    [193]  Clipsal CMR113 Cent-a-meter power meter
    [194]  Inkbird ITH-20R temperature humidity sensor
    [195]  RainPoint soil temperature and moisture sensor
    [196]  Atech-WS308 temperature sensor
    [197]  Acurite Grill/Meat Thermometer 01185M
    [198]* EnOcean ERP1

The Dockerfile line as pointed out by @deviantintegral is pulling code tagged 21.05 (aka the 21.05 release from May 9th) from GitHub for building rtl_433 in the container. If you want the latest, change the argument to checkout master instead of 21.05:

ARG rtl433GitRevision=21.05
RUN git checkout ${rtl433GitRevision}
1 Like

Ah that makes sense! I confused version with release. I will try this out tomorrow, thank you a lot!

1 Like

I’m sorry, i got real busy.
But i tried it today, but i noticed that this integration is done through the add-on store, which i’ve never used before for editing custom code. It seems to be different then custom components. Where can i find the files in the file system, and is it possible to edit those? Or would i have to create a fork of this repository with the changes and import it to Home Assistant?

Edit: I created the fork, and it works! Thank you a lot.

Hi all,
I wanted to see if anyone has experienced break change symptoms with the newest update. I see this in the logs but cannot find reference in the documentation.

[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.
[08:46:14] 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.conf
rtl_433 version 21.05 branch  at 202105091238 inputs file rtl_tcp RTL-SDR
Use -h for usage help and see https://triq.org/ for documentation.
Failed to stat "/config/rtl_433.conf"
Registered 157 out of 186 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-186 ]
No supported devices found.
[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.

The logs say the conf file is depreciated. The file gets deleted every time I start the add on.

1 Like

For reference, here’s the code for the legacy “single file / single radio” configuration. Note it doesn’t call rm or anything like that before the exit call, so I’m surprised the file is being deleted:

While you could go ahead and switch configuration to the newer format, deleting configs is a Bad Thing and I’d like to get it sorted. I’ll try and replicate.

What about line 52?

rm -f $conf_directory/*.conf

That happens outside an IF block, so it will always be executed?

I created a basic rtl_433 file in /config/rtl_433.conf, and set the addon config option to rtl_433.conf. I didn’t bother setting up valid mqtt configs, but we can see the error causes the exit (fine) and I can confirm the file still exists in the root configuration directory:

[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 -c /config/rtl_433.conf
[19:18:07] WARNING: rtl_433 now supports automatic configuration and multiple radios. The rtl_433_conf_file option is deprecated. See the documentation for migration instructions.
rtl_433 version 21.05 branch  at 202105091238 inputs file rtl_tcp RTL-SDR
Use -h for usage help and see https://triq.org/ for documentation.
Publishing MQTT data to ${host} port ${port}
Publishing device info to MQTT topic "rtl_433/local-rtl433/devices[/type][/model][/subtype][/channel][/id]".
Publishing events info to MQTT topic "rtl_433/local-rtl433/events".
Publishing states info to MQTT topic "rtl_433/local-rtl433/states".
MQTT connect (${host}:${port}) failed: cannot parse address
[cmd] /run.sh exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

I just started playing with one of these Ecowitt WH51 Soil Moisture sensors, and while rtl_433 can read them just fine, I’m having difficulties with auto discovery, very similar to an earlier post in this thread.

However, I’m running the latest version already(0.2.1), and I only see 2 entities:

Fineoffset-WH51-00fd5c-B = 1.0%
Fineoffset-WH51-00fd5c-UTC = 14 seconds ago

RAW MQTT packet:

{
  "time": "2021-12-08 22:30:49",
  "model": "Fineoffset-WH51",
  "id": "00cdci",
  "battery_ok": 0.77778,
  "battery_mV": 1400,
  "moisture": 26,
  "boost": 0,
  "ad_raw": 166,
  "mic": "CRC"
}

Error logs:


Exception in async_discover when dispatching 'mqtt_discovery_new_sensor_mqtt': ({'device_class': 'moisture', 'name': 'Fineoffset-WH51-00cdci-H', 'unit_of_measurement': '%', 'value_template': '{{ value|float }}', 'state_topic': 'rtl_433/9b13b3f4-rtl433/devices/Fineoffset-WH51/00cdci/moisture', 'unique_id': 'Fineoffset-WH51-00cdci-H', 'device': {'identifiers': 'Fineoffset-WH51-00cdci', 'name': 'Fineoffset-WH51-00cdci', 'model': 'Fineoffset-WH51', 'manufacturer': 'rtl_433'}, 'platform': 'mqtt'},)Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 198, in async_discover config = schema(discovery_payload)
File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 218, in __call__ return self._exec((Schema(val) for val in self.validators), v)
File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 341, in _exec raise e if self.msg is None else AllInvalid(self.msg, path=path) 
File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 337, in _exec v = func(v)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable return schema(data)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: value must be one of ['aqi', 'battery', 'carbon_dioxide', 'carbon_monoxide', 'current', 'date', 'energy', 'gas', 'humidity', 'illuminance', 'monetary', 'nitrogen_dioxide', 'nitrogen_monoxide', 'nitrous_oxide', 'ozone', 'pm1', 'pm10', 'pm25', 'power', 'power_factor', 'pressure', 'signal_strength', 'sulphur_dioxide', 'temperature', 'timestamp', 'volatile_organic_compounds', 'voltage'] for dictionary value @ data['device_class']

It looks like it doesn’t recognize the moisture class, and isn’t handling the battery values correctly. Any suggestions how to troubleshoot this?

I don’t see moisture as a valid device class at Sensor - Home Assistant

The commit upstream goes back to Add MQTT output by zuckschwerdt · Pull Request #1016 · merbanan/rtl_433 · GitHub and it doesn’t make any specific mention of testing out moisture sensors.

When manually creating a new sensor the device class may be optionally assigned. A full list of available sensor device classes is below:

So, perhaps the device class just needs to be removed entirely.

I did some more digging, and it looks like rtl_433_mqtt_hass.py is responsible for assigning the moisture class to moisture sensors. From what I can tell, a quick fix would be to replace this with the humidity class?

Yes, that would be a good first try. If it works, it would be great to get a PR up soon as it seems like they are close to tagging a stable (and that happens only every 6 months or so):

Apparently I never hit submit when editing my previous post last night. I forked that repo, made the change, and tested it successfully.

I’ve submitted the tiny change, hopefully I didn’t miss a step since this is my first time attempting to contribute.

2 Likes

Hello
I am trying to follow the work around for that issue:
HASS bridge emits incorrectly formatted time · Issue #1904 · merbanan/rtl_433 · GitHub -
“# HASS bridge emits incorrectly formatted time”

I have changed my rtl_433.conf as suggested by deviantintegral :

output      mqtt://192.168.XXX.XXX:1883,user=XXXXXX,pass=XXXXX

frequency   433.92M

protocol 19

convert     si

# report_meta newmodel

report_meta time:iso:tz:local

Yet the time output remain as before.
Am I doing something wrong?

1 Like

OK I was able to work around it by placing a new config file in the /config/rtl_433/ folder.

1 Like

Great add on! It was able to successfully find my Honeywell 5800 series 345mhz door sensors. However, it only shows some of the sensors on the device, specifically missing the “reed_open” and “contact_open” messages (which are the ones that really matter for a door sensor!) I am able to see the messages when I sniff MQTT, but they dont show up as sensors in homeassistant. Is this the expected behavior? What’s the easiest way for me to add these specific sensors?

@dave5k - I’m about 75% of the way setting this up myself for the first time- so beginner’s response.

I setup sensors for each of my 5800’s like this:

sensor garage_door:
  platform: mqtt
  state_topic: "rtl_433/+/events"
  name: "Garage Door"
  qos: 0
  value_template: "{% if value_json.id is equalto 695285 and value_json.reed_open is equalto 1 %} Open {% else %} Closed {% endif %}"

When a 5800 sees an event, it fires off a MQTT message that includes the reed_open and contact_open and I trigger a response from that.

Edit- the “695285” in the above is the number physically written on my sensor under the cover (I needed to drop the preceding “A0” on sticker), it’s what Peter’s auto discovery tool uses in the name, and it’s the hex equivalent of the “id” from the rtl_433 tool- i.e. mine is “A9BF5”. (I used this tool: https://www.rapidtables.com/convert/number/decimal-to-hex.html.