Using Multiple RF bridges and increase reliability and performance

Hi!
This is my very first post. Not sure if my work makes any sense to anyone, but I hope that it might be of interest or help to any of you out there. Please let me know what you think.

I have many RF devices in my house, like window sensors, door sensors, light switches, smoke detectors and movement sensors. Not that my house is huge, but still I noticed that reception was not always reliable. So I decided to buy an additional RF bridge. They are just a few bucks, so, just ordere a second one. Using multiple RF bridges was not as straightforward as I though it would be. Though it does have some nice benefits:

  • Improved reliability
  • Improved performance
  • Improved coverage

My set up (relevant part)

  • Hassio 0.92.1 on RasPI
  • Node-RED 0.20.5 - on hassio plugin 3.0.3
  • Mosquitto MQTT Server bundled with Hivemq’s web client - on hassio plugin 1.0.1
  • 2 Sonoff RF bridges flashed with Tasmota 6.5.0
  • 8 Door/Window RF 433 sensors that send separate ‘open’ and ‘ closed’ messages
  • 2 RF 433 Single light switches (toggles)
  • 4 RF 433 PIR Movement detectors
  • 3 RF 433 Smoke detectors
  • 1 RF 433 CO detector

What I encountered
When using 2 RF bridges, obviously any incoming RF signal will be received twice. Even though for ON/OFF and OPEN/CLOSED messages this is so not much of a problem, it is rather inconvenient when using toggle switches.

Also, for some reason, sometimes messages get processed with a slight delay.

So, first thing i did was to store any received RF signal in a database. I will not go into detail about how i did that, as that is out of scope for this post. But it helped me measure and define the best solution for myself.

Options
Easiest option is to stay away from toggles. As long as you are using clear ON and OFF RF signals, it is easy to use 2 or more bridges. However, this option might not be realistic in your case and It certainly wasn’t in mine.

First approach I tried was to configure HA to assign each sensor to a dedicated RF Bridge. That is a simple solution that works well. This is the solution that some other articles on this forum describe.

Configuration would look something like:
- platform: mqtt
name: “Bathroom Window"
state_topic: "tele/RF_Bridge-2/RESULT"
value_template: '{{value_json.RfReceived.Data}}'
payload_on: "F6370A"
payload_off: "F6370E"
device_class: Window
availability_topic: "tele/RF_Bridge-2/LWT"
payload_available: "Online"
payload_not_available: “Offline"

One would expect that the bridge closest to the RF Bridge would be the best to assign it to. But I noticed that even though reliability did increase significantly, still some messages were missed by the assigned RF Bridge, while they were received (but ignored) by the other RF Bridge. Rather frustrating…

Also, if one RF Bridge would become offline, half the sensors would be offline. Even though the other RF Bridge would still be receiving the RF signals. This would be especially disturbing for smoke detectors…

So I wasn’t yet satisfied. :slight_smile:

Even more so, I wanted to be able to use even a third RF Bridge in the future, since I plan to have RF PIR movement detectors in my garden for automated garden lighting. :slight_smile:

Approach
I decided that all RF Bridges were to be used for all RF sensors. The rules I defined were:

  • In case an RF signal is received within 2 seconds after the same RF signal was received from another RF Bridge, it is a duplicate signal
  • In case an RF signal is received within 2 seconds after the same RF signal was received from the same RF Bridge, it is NOT a duplicate signal
  • Otherwise it is NOT a duplicate

With that I could state that:

  • the RF reception would be ONLINE if at least one RF Bridge is ONLINE

Configuration
I configured both RF Bridges exactly similar by first configuring one and then copying the settings to the second one. Then I changed the MQTT Topics to
RF_Bridge/1
RF_Bridge/2

Then, in HA, I configured my sensors like this:
- platform: mqtt
name: “Bathroom Window"
state_topic: "tele/RF_Bridge/+/RESULT"
value_template: '{{value_json.RfReceived.Data}}'
payload_on: "F6370A"
payload_off: "F6370E"
device_class: Window

With this, the Bathroom Window sensor responds to any RF signal received. Like stated, this is the easy part for ON/OFF sensors. This does not work for toggles.

So, I have set up a deduplicate flow in Node-RED. I have set up a sequence:

  • MQTT, listen to tele/RF_Bridge/+/RESULT
  • Read JSON
  • Change node
    • Set Topic to contain the received RF data
    • Set Payload to contain the RF Bridge that received
  • Store the milliseconds passed since the last message with the same Topic / RF data
  • JavaScript: determine whether the message is a duplicate. If so, ignore.
  • Switch: based on Topic / RF data determine all the actions required.

I could not do this with the standard deduplicate node. Maybe someone else can.

Availability
Last hurdle was to set the availability of the RF Bridges as a whole. I noticed that the reliability of the RF Bridges individually was only about 85%. With 2 RF Bridges, that would be 100% - ( 1 - 85%) x ( 1 - 85%) = 97,75%. So, a significant increase.

In HA I have a sensor set up for the availability of each RF Bridge
- platform: mqtt
name: "RF Bridge 1"
state_topic: "tele/RF_Bridge/1/LWT"
payload_on: "Online"
payload_off: "Offline"
device_class: Connectivity
- platform: mqtt
name: "RF Bridge 2"
state_topic: "tele/RF_Bridge/2/LWT"
payload_on: "Online"
payload_off: "Offline"
device_class: Connectivity

Then, in Node-RED, I have set up a sequence:

  • Event State: binary_sensor.rf_bridge_1
  • Change node: Store the current state for later use
  • Check the state of binary_sensor.rf_bridge_2
    And vice versa

Then set up a Switch node:

  • if both are offline, publish OFFLINE to tele/RF_Bridge/availability
  • otherwise, publish ONLINE to tele/RF_Bridge/availability

Then, last thing I noticed when HA boots, the sequence is not triggered. So, as I have an automation in HA that published a message to MQTT in ha/homeassistant, I used that message to check both RF Bridges at start-up.

Now, all RF sensors in HA may use:
availability_topic: "tele/RF_Bridge/availability"
payload_available: "Online"
payload_not_available: "Offline"

Conclusion
It works like a charm and I am happy! Reliability has increased significantly. Since the first RF Bridge that receives an RF message processes it, performance is improved also. By placing 1 RF Bridge on the grond floor to the front of the house and the other one on first floor towards the back, coverage is improved too.

Perhaps I could have taken an easier path, but this is what I could do with my limited knowledge.

Probably when I want to add another RF Bridge, I will need to make some modifications.

Please let me know what you think. I could post code samples if you like.

5 Likes

Surely are over complicating it.
Wouldn’t the following work with multiple rfbridges (toggles) providing they responded within 3 secs.?
I dont have multiple bridges to prove it but logic seems right.

  - platform: mqtt
    name: "RFPIR1"
    state_topic: "tele/rfbridge/+/RESULT"
    value_template: >-
      {% if value_json.RfReceived.Data == 'CODE54' %}
        {{'ON'}}
      {% else %}
        {{states('binary_sensor.rfpir1') | upper}}
      {% endif %}
    off_delay: 3
    device_class: motion
    qos: 1  
2 Likes

Thanks for your thoughts, Andrew.

Since toggles only send the same RF signal for ON and for OFF, how would your example work when the toggle is to make the sensor to go from ON to OFF state?

Because you have off delay set to 3secs it would make no odds having two rf bridges receive the same code within 3 secs so whichever received the first rf command would toggle. The 2nd received command (within 3 secs ) would be ignored.

ie the RX signal is held in the on state for 3 secs before releasing

I have now implemented this (2 bridges ) and all RX functions work unaltered besides the wild card to utilise both boxes. I can unplug either and no alteration to the 433Mhz service happens.
Toggles function without issue.

I also have 433mhz Rx light switch :-
Off cause for the Tx side I have to define which bridge sends the code as you cant have both trying to do it (as I did originally and nothing worked)