RTL_433 for 34mhz Honeywell Window Sensors

hello, I am running Home Assistant on one Raspberry Pi and RTL_433 on a separate Raspberry Pi. I am able to run RTL_433 on one Pi using:
‘$ rtl_433 -f 344975000 -F “mqtt://,user=mqtt,pass=password,events=rtl_433[/model][/id]”’

On Home Assistant I can see my sensors coming into MQTT:
time": “2021-02-07 04:33:02”,
“model”: “Honeywell-Security”,
“id”: 983108,
“channel”: 10,
“event”: 132,
“state”: “open”,
“contact_open”: 1,
“reed_open”: 0,
“alarm”: 0,
“tamper”: 0,
“battery_ok”: 1,
“heartbeat”: 1


  • platform: mqtt
    state_topic: “rtl_433”
    name: “Back Door”
    qos: 0
    device_class: opening
    value_template: ‘{% if value_json.id is equalto 980218 %} {{value_json.state}} {% else %} {{states.sensor.back_door.state}} {% endif %}’

But anything I try in yaml is not working, the error i consistently receive is:
invalid config for [sensor.mqtt] Got ‘opening’. (See ?, line ?).

I am spinning around at this point but any help would be greatly appreciated!

You have defined an MQTT Sensor with a device_class of “opening”. That’s not a valid choice for an MQTT Sensor but it is valid for an MQTT Binary Sensor.

If you want it to remain as an MQTT Sensor you will have to remove the device_class option because the ones supported by an MQTT Sensor don’t apply to a window.

On the other hand, if you made a mistake and do want it to be an MQTT Binary Sensor, simply move its configuration from the sensor: domain to the binary_sensor: domain.

In addition, your value_template may not meet the needs of an MQTT Binary Sensor. The template must produce ON when the window is open and OFF when it’s closed. Are you certain the template does that?

Thanks! Makes sense about the binary sensor I will switch that over.

As far as the template I am not certain at all! Just winging it

Hi Taras, do you have any suggestions on what my value_template should be?

Try this:

- platform: mqtt
  state_topic: rtl_433
  name: Back Door
  device_class: opening
  value_template: >
    {% if value_json.id == 980218 %}
      {{ 'ON' if value_json.state == 'open' else 'OFF' }}
    {% else %}
      {{ states('sensor.back_door') }}
    {% endif %}’

Thanks but still no luck. Do you think I have to include “Honeywell-Security” in the state topic? I tried a couple variations to no avail. Frustrating because I can see the sensors when i listen to all in mqtt

The sensor’s configuration, in your first post, contains the following:

state_topic: rtl_433

That’s what I also used in my suggestion because I assumed it was correct.

Looking at the results of what you just posted, I see that the assumption may have been incorrect. Unless you have data showing that payloads are in fact published to rtl_433 then I suggest you use this instead:

- platform: mqtt
  state_topic: rtl_433/Honeywell-Security/980218
  name: Back Door
  device_class: opening
  value_template: "{{ 'ON' if value_json.state == 'open' else 'OFF' }}"

For each MQTT Binary Sensor you define, simply ensure the last six digits of its state_topic matches the physical sensor’s id value.