1 out of 4 RF door sensors via Sonoff Bridge doesn't retain status

I have four Kerui 433MHz door/window sensors installed via Sonoff RF Bridge with Tasmota 8.1.0. Mosquitto broker on HA Core 2021.8.5.

One of them (as window sensor) is changing status from Open to Closed (never the other way around) on HA restart or reload. As opposed to the others (used as door sensors), this one usually stays open. The state **resets to “Closed” whenever I restart HA.

What could be the issue? I tried looking into Retain option of MQTT but that’s no longer an option (configuration.yaml) doesn’t check out with retain: true.

There is no “close” event in the RF Bridge console.

The config is

  - platform: mqtt
    state_topic: "tele/rfbridge/RESULT"
    name: 'Window Sensor LR'
    value_template: "{{value_json.RfReceived.Data}}"
    payload_on: "E4335E"
    payload_off: "E43357"
    qos: 0
    device_class: window

Tried QOS 0 and 1, no difference.

I also searched around here and did read the Strategies for receiving data post but I have five or six other 433 devices working correctly and I haven’t seen anything in there to help my issue.

Any tips? Thanks!

Have you used an MQTT client to observe the payload published to tele/rfbridge/RESULTand confirm it receives E43357?

If the MQTT Binary Sensor never receives that value, it will report on (Open) upon receiving E4335E and then remain that way indefinitely (or the next restart).

The retain option applies to entities that publish payloads. An MQTT Binary Sensor doesn’t publish anything so it has no need to offer a retain option.

It works and reports perfectly well when I open and close the window. The issue is, the state resets to “Closed” whenever I restart HA. And I think it got reset when my router reset but I’m not 100% positive. I’m now looking into RF Bridge Tasmota commands, there’s a SensorRetain flag that might be just what I’m looking for. I’m kinda reluctant to tinker with it as it works with all other device but what the hell…

Thanks!

That’s an important detail you overlooked to mention in the first post.

That’s perfectly normal behavior if the payload published to tele/rfbridge/RESULT (by the Sonoff RF Bridge) was not published as a retained message or it was but you have multiple devices reporting their status via the same topic and, on startup, the payload isn’t the one meant for the window sensor.

I admit I’m lost now. I don’t wanna take any more of your time but I don’t know how to solve this. (I added this to the original post). I feel this is where demultiplexing comes in but boy that’s some complex stuff for something so seemingly simple.

I’m wondering if using ESPHome on the Bridge would be easier?

For posterity: the SensorRetain flag in Tasmota doesn’t help the issue BTW.

If you think the second strategy is complicated, use the first strategy.