Binary sensor (magnetic contact sensor) via RFBridge

Just a noob trying to add some basic functionality to my HA setup (433MHz based contact sensors via a Tasmota Flashed Sonoff RFBridge). Running version 2022.9.7.

This is the console output:

23:47:44.164 MQT: tele/rf-bridge/RESULT = {"Time":"2022-10-17T23:47:44","RfReceived":{"Sync":30756,"Low":968,"High":2952,"Data":"311F50","RfKey":"None"}}
23:47:46.454 MQT: tele/rf-bridge/RESULT = {"Time":"2022-10-17T23:47:46","RfReceived":{"Sync":29274,"Low":966,"High":2954,"Data":"311F0E","RfKey":"None"}}
# Example configuration.yaml entry

mqtt:
  binary_sensor:
    - name: "Window Contact Sensor"
      unique_id: "Contact01"
      state_topic: "tele/rf-bridge/RESULT"
      payload_on: "311F50"
      payload_off: "311F0E"
      availability:
        - topic: "home-assistant/window/availability"
          payload_available: "online"
          payload_not_available: "offline"
      qos: 1
      device_class: window
      value_template: "{{ value_json.RfReceived.Data }}"

I have added the Entity to a view. I get device showing unavailable. The tutorials on this are a bit old and lots of misleading videos showing an older YAML format on YT. I have 30 Tasmota light switches working just fine so MQTT set up is good. Please help!

Thanks

What happens if you remove the availability topic and trigger it?

1 Like

Why, then it works!!! :rofl: Thank you for this.

Any suggestions on how I can make this better or improve the experience with such sensors gratefully received.

Thanks

Yeah fairly certain they don’t supply an availability topic from the bridge.

You will need to set the retain flag (and make sure the bridge knows to do the same) otherwise it will show as unavailable on HA startup until it is triggered.

Also consider moving the 433Mhz data out of the sensor definition. There are lots of ways of doing that - I use a Python script. Makes this a bit neater.

I just actually posted the Python on another topic:

1 Like

Forgot the automation needed:

- alias: bridge_demultiplexer
  trigger:
  - platform: mqtt
    topic: tele/bridge/RESULT
  action:
  - service: python_script.bridge_demux
    data_template:
      payload: '{{trigger.payload_json.RfReceived.Data}}'
1 Like