Sonoff RF Bridge & Door sensor issues

Hi there

I’ve flashed a Sonoff RF Bridge with Tasmota and want to use it with 433Mhz door sensors to tell me when my garage doors are open and to switch on a light when they open and close.

I’ve got the sensors paired and have added the config to my binarysensors.yaml file but it doesn’t seem to be working and I’m not sure where I’m going wrong, I’ve watched a bunch of YouTube videos, read tons of forum posts, chopped and changed the config but am unable to get it to work so hopefully someone smart out there can help me get on the right track.

My binarysensors.yaml file

  • platform: mqtt
    name: ‘Garage Door Right’
    state_topic: ‘tele/sonoff-rf-bridge/RESULT’
    value_template: >-
    {% if value_json.RfReceived.Data == ‘6A0103’ %}
    {{‘ON’}}
    {% elif value_json.RfReceived.Data == ‘6A010F’ %}
    {{‘OFF’}}
    {% else %}
    {{states(‘binary_sensor.sonoff_rf_bridge_button1’) | upper}}
    {% endif %}
    device_class: door

  • platform: mqtt
    name: ‘Garage Door Left’
    state_topic: ‘tele/sonoff-rf-bridge/RESULT’
    value_template: >-
    {% if value_json.RfReceived.Data == ‘DB0103’ %}
    {{‘ON’}}
    {% elif value_json.RfReceived.Data == ‘DB010F’ %}
    {{‘OFF’}}
    {% else %}
    {{states(‘binary_sensor.sonoff_rf_bridge_button1’) | upper}}
    {% endif %}
    device_class: door

  • platform: mqtt
    name: ‘Garage Door Entrance’
    state_topic: ‘tele/sonoff-rf-bridge/RESULT’
    value_template: >-
    {% if value_json.RfReceived.Data == ‘220803’ %}
    {{‘ON’}}
    {% elif value_json.RfReceived.Data == ‘22080F’ %}
    {{‘OFF’}}
    {% else %}
    {{states(‘binary_sensor.sonoff_rf_bridge_button1’) | upper}}
    {% endif %}
    device_class: door

A copy and paste from my console on the RF Bridge with me opening and closing the sensors

09:13:30 MQT: homeassistant/light/C72BD1_LI_1/config = (retained)
09:13:30 MQT: homeassistant/switch/C72BD1_RL_1/config = (retained)
09:13:30 MQT: homeassistant/light/C72BD1_LI_2/config = (retained)
09:13:30 MQT: homeassistant/switch/C72BD1_RL_2/config = (retained)
09:13:30 MQT: homeassistant/light/C72BD1_LI_3/config = (retained)
09:13:30 MQT: homeassistant/switch/C72BD1_RL_3/config = (retained)
09:13:30 MQT: homeassistant/light/C72BD1_LI_4/config = (retained)
09:13:30 MQT: homeassistant/switch/C72BD1_RL_4/config = (retained)
09:13:30 MQT: homeassistant/light/C72BD1_LI_5/config = (retained)
09:13:31 MQT: homeassistant/switch/C72BD1_RL_5/config = (retained)
09:13:31 MQT: homeassistant/light/C72BD1_LI_6/config = (retained)
09:13:31 MQT: homeassistant/switch/C72BD1_RL_6/config = (retained)
09:13:31 MQT: homeassistant/light/C72BD1_LI_7/config = (retained)
09:13:31 MQT: homeassistant/switch/C72BD1_RL_7/config = (retained)
09:13:31 MQT: homeassistant/light/C72BD1_LI_8/config = (retained)
09:13:31 MQT: homeassistant/switch/C72BD1_RL_8/config = (retained)
09:13:31 MQT: homeassistant/binary_sensor/C72BD1_BTN_1/config = {“name”:“sonoff-rf-bridge Button1”,“stat_t”:"~stat/BUTTON1",“avty_t”:"~tele/LWT",“pl_avail”:“Online”,“pl_not_avail”:“Offline”,“uniq_id”:“C72BD1_BTN_1”,“device”:{“identifiers”:[“C72BD1”],“connections”:[[“mac”,“DC:4F:22:C7:2B:D1”]]},"~":“sonoff-rf-bridge/”,“value_template”:"{{value_json.STATE}}",“pl_on”:“TOGGLE”,“off_delay”:1} (retained)
09:13:31 MQT: homeassistant/binary_sensor/C72BD1_BTN_2/config = (retained)
09:13:31 MQT: homeassistant/binary_sensor/C72BD1_BTN_3/config = (retained)
09:13:31 MQT: homeassistant/binary_sensor/C72BD1_BTN_4/config = (retained)
09:13:31 MQT: homeassistant/binary_sensor/C72BD1_SW_1/config = (retained)
09:13:31 MQT: homeassistant/binary_sensor/C72BD1_SW_2/config = (retained)
09:13:31 MQT: homeassistant/binary_sensor/C72BD1_SW_3/config = (retained)
09:13:31 MQT: homeassistant/binary_sensor/C72BD1_SW_4/config = (retained)
09:13:31 MQT: homeassistant/binary_sensor/C72BD1_SW_5/config = (retained)
09:13:31 MQT: homeassistant/binary_sensor/C72BD1_SW_6/config = (retained)
09:13:31 MQT: homeassistant/binary_sensor/C72BD1_SW_7/config = (retained)
09:13:31 MQT: homeassistant/binary_sensor/C72BD1_SW_8/config = (retained)
09:13:31 MQT: homeassistant/sensor/C72BD1_status/config = {“name”:“sonoff-rf-bridge status”,“stat_t”:"~HASS_STATE",“avty_t”:"~LWT",“frc_upd”:true,“pl_avail”:“Online”,“pl_not_avail”:“Offline”,“json_attributes_topic”:"~HASS_STATE",“unit_of_meas”:" “,“val_tpl”:”{{value_json[‘RSSI’]}}",“ic”:“mdi:information-outline”,“uniq_id”:“C72BD1_status”,“device”:{“identifiers”:[“C72BD1”],“connections”:[[“mac”,“DC:4F:22:C7:2B:D1”]],“name”:“sonoff-rf-bridge”,“model”:“Sonoff Bridge”,“sw_version”:“8.1.0(tasmota)”,“manufacturer”:“Tasmota”},"~":“sonoff-rf-bridge/tele/”} (retained)
09:13:33 MQT: sonoff-rf-bridge/tele/STATE = {“Time”:“2020-01-31T09:13:33”,“Uptime”:“0T00:00:07”,“UptimeSec”:7,“Heap”:29,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:57,“MqttCount”:1,“Wifi”:{“AP”:1,“SSId”:“10A Fairview [2GHZ]”,“BSSId”:“64:D1:54:F6:27:D7”,“Channel”:1,“RSSI”:100,“Signal”:-47,“LinkCount”:1,“Downtime”:“0T00:00:01”}}
09:18:28 MQT: sonoff-rf-bridge/tele/HASS_STATE = {“Version”:“8.1.0(tasmota)”,“BuildDateTime”:“2019-12-25T12:33:25”,“Core”:“2_6_1”,“SDK”:“2.2.2-dev(38a443e)”,“Module”:“Sonoff Bridge”,“RestartReason”:“Software/System restart”,“Uptime”:“0T00:05:02”,“WiFi LinkCount”:1,“WiFi Downtime”:“0T00:00:01”,“MqttCount”:1,“BootCount”:12,“SaveCount”:26,“IPAddress”:“192.168.88.121”,“RSSI”:“100”,“LoadAvg”:19}
09:18:33 MQT: sonoff-rf-bridge/tele/STATE = {“Time”:“2020-01-31T09:18:33”,“Uptime”:“0T00:05:07”,“UptimeSec”:307,“Heap”:27,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:22,“MqttCount”:1,“Wifi”:{“AP”:1,“SSId”:“10A Fairview [2GHZ]”,“BSSId”:“64:D1:54:F6:27:D7”,“Channel”:1,“RSSI”:100,“Signal”:-47,“LinkCount”:1,“Downtime”:“0T00:00:01”}}
09:21:44 MQT: sonoff-rf-bridge/tele/RESULT = {“Time”:“2020-01-31T09:21:44”,“RfReceived”:{“Sync”:10700,“Low”:310,“High”:1060,“Data”:“6A0103”,“RfKey”:“None”}}
09:21:50 MQT: sonoff-rf-bridge/tele/RESULT = {“Time”:“2020-01-31T09:21:50”,“RfReceived”:{“Sync”:10740,“Low”:320,“High”:1050,“Data”:“6A010F”,“RfKey”:“None”}}
09:21:55 MQT: sonoff-rf-bridge/tele/RESULT = {“Time”:“2020-01-31T09:21:55”,“RfReceived”:{“Sync”:10720,“Low”:320,“High”:1040,“Data”:“DB0103”,“RfKey”:“None”}}
09:21:59 MQT: sonoff-rf-bridge/tele/RESULT = {“Time”:“2020-01-31T09:21:59”,“RfReceived”:{“Sync”:10670,“Low”:340,“High”:1020,“Data”:“DB010F”,“RfKey”:“None”}}

A copy and paste of my Entity ID under Device Info

binary_sensor.sonoff_rf_bridge_button1

Thanks in advance

Read this topic :

Hi Francis

Thanks for the post, I’ve based my configuration on that topic, you’ll note my configuration is identical apart from my specific details obviously.

I hope you realize mqtt binary sensors (or mqtt sensors) configured in configuration.yaml don’t show under
configuration -> entities. However, you should see them under developer tools -> states.

Ah ok I didn’t realize although having checked they’re not under developer tools --> states :frowning:

Did you restart HA after changing the configuration ?

Yes I restart after any changes that I make.

I’ve done quite a few integrations with Home Assistant and have managed OK with them all and understand how it works quite well now but just cannot get this to work, I’ve spent a few days on it already I think its something obvious that I’m just missing.

Well - here you have my config setup and it seems to work fine (with a 433 mhz doorbell and a Sonoff RF switch):

image

I’ve tried that format before and it also didn’t seem to work.

I have now moved the sensors from the binarysensors.yaml file (and deleted it) and put the contents as per below into my configuration.yaml but its still not working or being displayed under dev tools, states

binary_sensor:

  • platform: mqtt
    name: “Garage Door Right”
    state_topic: “tele/sonoff-rf-bridge/RESULT”
    value_template: ‘{{value_json.RfReceived.Data}}’
    payload_on: “6A0103”
    payload_off: “6A010F”
    device_class: door
    qos: 1
  • platform: mqtt
    name: “Garage Door Left”
    state_topic: “tele/sonoff-rf-bridge/RESULT”
    value_template: ‘{{value_json.RfReceived.Data}}’
    payload_on: “DB0103”
    payload_off: “DB010F”
    device_class: door
    qos: 1
  • platform: mqtt
    name: “Garage Door Entrance”
    state_topic: “tele/sonoff-rf-bridge/RESULT”
    value_template: ‘{{value_json.RfReceived.Data}}’
    payload_on: “220803”
    payload_off: “22080F”
    device_class: door
    qos: 1

I have restarted Hassio and also confirm that they controls are changing state in console on the RF Bridge.

Maybe read this topic :
https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371/4

We can’t see if anything is wrong in your yaml the way you post.

Make sure your configuration.yaml file doesn’t contain two binary_sensor: configurations where the second one is empty. For example, if you have this:

binary_sensor:
  - platform: mqtt
    name: 'Garage Door Right'
    state_topic: 'tele/sonoff-rf-bridge/RESULT'
    value_template: '{{value_json.RfReceived.Data}}'
    payload_on: '6A0103'
    payload_off: '6A010F'
    device_class: door
    qos: 1

<other definitions and information>

binary_sensor:

then Home Assistant will use the second binary_sensor: and because this second one is empty, no binary sensors will be defined.

1 Like

My apologies, I’ll pay careful attention when posting my config files in future.

It seems that by moving the sensors to my configuration.yaml file they’re being picked up now under developer tools --> states but that the state does not change i.e. they’re showing as off / closed when their state is open.

binary_sensor:
  - platform: mqtt
    name: "Garage Door Right"
    state_topic: "tele/sonoff-rf-bridge/RESULT"
    value_template: '{{value_json.RfReceived.Data}}'
    payload_on: "6A0103"
    payload_off: "6A010F"
    device_class: door
    qos: 1
  - platform: mqtt
    name: "Garage Door Left"
    state_topic: "tele/sonoff-rf-bridge/RESULT"
    value_template: '{{value_json.RfReceived.Data}}'
    payload_on: "DB0103"
    payload_off: "DB010F"
    device_class: door
    qos: 1
  - platform: mqtt
    name: "Garage Door Entrance"
    state_topic: "tele/sonoff-rf-bridge/RESULT"
    value_template: '{{value_json.RfReceived.Data}}'
    payload_on: "220803"
    payload_off: "22080F"
    device_class: door
    qos: 1

13:31:55 MQT: homeassistant/sensor/C72BD1_status/config = {"name":"sonoff-rf-bridge status","stat_t":"~HASS_STATE","avty_t":"~LWT","frc_upd":true,"pl_avail":"Online","pl_not_avail":"Offline","json_attributes_topic":"~HASS_STATE","unit_of_meas":" ","val_tpl":"{{value_json['RSSI']}}","ic":"mdi:information-outline","uniq_id":"C72BD1_status","device":{"identifiers":["C72BD1"],"connections":[["mac","DC:4F:22:C7:2B:D1"]],"name":"sonoff-rf-bridge","model":"Sonoff Bridge","sw_version":"8.1.0(tasmota)","manufacturer":"Tasmota"},"~":"sonoff-rf-bridge/tele/"} (retained)
13:31:57 MQT: sonoff-rf-bridge/tele/STATE = {"Time":"2020-01-31T13:31:57","Uptime":"0T00:00:07","UptimeSec":7,"Heap":28,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":80,"MqttCount":1,"Wifi":{"AP":1,"SSId":"10A Fairview [2GHZ]","BSSId":"64:D1:54:F6:27:D7","Channel":1,"RSSI":100,"Signal":-47,"LinkCount":1,"Downtime":"0T00:00:01"}}
13:32:12 MQT: sonoff-rf-bridge/tele/RESULT = {"Time":"2020-01-31T13:32:12","RfReceived":{"Sync":10690,"Low":340,"High":1020,"Data":"DB010F","RfKey":"None"}}
13:35:44 MQT: sonoff-rf-bridge/tele/RESULT = {"Time":"2020-01-31T13:35:44","RfReceived":{"Sync":10680,"Low":340,"High":1020,"Data":"6A010F","RfKey":"None"}}
13:35:46 MQT: sonoff-rf-bridge/tele/RESULT = {"Time":"2020-01-31T13:35:46","RfReceived":{"Sync":6640,"Low":350,"High":1010,"Data":"3F60A7","RfKey":"None"}}
13:36:52 MQT: sonoff-rf-bridge/tele/HASS_STATE = {"Version":"8.1.0(tasmota)","BuildDateTime":"2019-12-25T12:33:25","Core":"2_6_1","SDK":"2.2.2-dev(38a443e)","Module":"Sonoff Bridge","RestartReason":"Software/System restart","Uptime":"0T00:05:02","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:01","MqttCount":1,"BootCount":15,"SaveCount":29,"IPAddress":"192.168.88.121","RSSI":"100","LoadAvg":19}
13:36:57 MQT: sonoff-rf-bridge/tele/STATE = {"Time":"2020-01-31T13:36:57","Uptime":"0T00:05:07","UptimeSec":307,"Heap":27,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"10A Fairview [2GHZ]","BSSId":"64:D1:54:F6:27:D7","Channel":1,"RSSI":100,"Signal":-46,"LinkCount":1,"Downtime":"0T00:00:01"}}
13:38:04 MQT: sonoff-rf-bridge/tele/RESULT = {"Time":"2020-01-31T13:38:04","RfReceived":{"Sync":10570,"Low":300,"High":1040,"Data":"220803","RfKey":"None"}}

image

At least I’m making some progress

1 Like

When you were using binarysensors.yaml, did you have this line in configuration.yaml:

binary_sensor: !include binarysensors.yaml

Yes I added that on prior attempts to the configuration.yaml file and it didn’t work although I was changing a lot of stuff at the time and its possible I had broken something else that caused this not to work. I’ll change it back and see if it picks it up out of interest sake and report back.

It should work. Many people, including me, use it that way. All my MQTT-based binary_sensors are defined in a separate YAML file and my configuration contains a line that includes the separate file.

OK, I can confirm that it now picks up the sensors if they’re in their own yaml file my sytax was possibly incorrect before which is why I removed the line from my configuration.yaml file.

BUT

The state changes are still not being picked up in Home Assistant even though their state changes on the RF Bridge.

Sigh, painfully close I can feel it :slight_smile:

Now you need to confirm that Home Assistant is connected and communicating with the MQTT Broker.

Go to Developer Tools > MQTT and in Listen to a Topic enter tele/sonoff-rf-bridge/RESULT then either open the Garage Door or use some other method to cause the Sonoff RF Bridge to publish a payload. When the payload is published, you should see it in Listen to a topic.

Doesn’t pick anything up…

14:24:28 MQT: sonoff-rf-bridge/tele/RESULT = {"Time":"2020-01-31T14:24:28","RfReceived":{"Sync":9190,"Low":330,"High":1010,"Data":"110401","RfKey":"None"}}
14:24:29 MQT: sonoff-rf-bridge/tele/RESULT = {"Time":"2020-01-31T14:24:29","RfReceived":{"Sync":10510,"Low":340,"High":1010,"Data":"220803","RfKey":"None"}}
14:24:36 MQT: sonoff-rf-bridge/tele/RESULT = {"Time":"2020-01-31T14:24:36","RfReceived":{"Sync":10600,"Low":310,"High":1030,"Data":"22080F","RfKey":"None"}}
14:24:45 MQT: sonoff-rf-bridge/tele/RESULT = {"Time":"2020-01-31T14:24:44","RfReceived":{"Sync":10570,"Low":300,"High":1040,"Data":"220803","RfKey":"None"}}

Something I’ve noticed and not sure if that would have an impact but the Sonoff RF Bridge time is wrong its 1 hour behind almost as if its using a different timezone.

You can set the timezone in the tasmota console.

What mqtt server are you using ?

I’ve got Mosquito Broker installed?