Multiple Sonoff Bridges

Hi,

does anyone have an idea, how to implement multiple sonoff bridges in my setup.
i’ve 2 sonoff bridges because of the distance between my sensors and the brdiges.

my problem is, that sometimes only one of my sonoff bridges receives the rf-payload.
I’ve multiple door sensors and I don’t know, how to configure it to work with both sonoff bridges.

so the mqtt message of my binary_sensors could be received by any of those two sonoff bridges.

thanks for your inputs!
Florian

I have two sonoff rf bridges.

In automations.yaml :

- id: '1565365902541'
  alias: rfbridge_demultiplexer
  trigger:
  - platform: mqtt
    topic: home/OpenMQTTGateway/SRFBtoMQTT
  - platform: mqtt
    topic: home/OpenMQTTGateway1/SRFBtoMQTT
  action:
  - data_template:
      payload: '{{trigger.payload_json.value}}'
    service: python_script.rfbridge_demux

And the following python script (in the folder python script)

d = { '9823336':['ikea_switch1_sensor','ON','false'],
      '9823332':['ikea_switch2_sensor','ON','false'],
      '9823330':['ikea_switch3_sensor','ON','false'],
      '9823329':['ikea_switch4_sensor','ON','false'],
      '14163857':['doorbell_sensor','ON','false'],
      '13666408':['firealarm','ON','false'],
      '564886':['garagedoor','ON','false'],
      '16726408':['lichteetkamerboven','ON','false'],
      '16765268':['impuls','ON','false'],
      '16766303':['impulsb','OFF','false'],
      '16765265':['flamingo1','ON','false'],
      '352003':['buurvrouw','ON','false'],
      '1213858':['lichtwaskot','ON','false'],
      '1224498':['buurvrouw1','ON','false'],
      '16762193':['impulsa','OFF','false'],
      '16762196':['impulsa','ON','false'],
      '2291358':['voordeur','ON','true'],
      '2291351':['voordeur','OFF','true'],
      '152232' :['schuindak','ON','false']
    }


p = data.get('payload')

if p is not None:
  if p in d.keys():
    service_data = {'topic':'sensor/{}'.format(d[p][0]), 'payload':'{}'.format(d[p][1]), 'qos':0, 'retain':'{}'.format(d[p][2])}
  else:
    service_data = {'topic':'sensor/unknown', 'payload':'{}'.format(p), 'qos':0, 'retain':'false'}
    logger.error('<rfbridge_demux> Received unknown RF command: {}'.format(p))
  hass.services.call('mqtt', 'publish', service_data, False)

For more information see this topic :

thanks!!
sometimes a solution is so simple, that you can’t figure it out…
I took the Strategy 1 - and of course it worked perfect :wink:

thanks for your input!!

Hi @francisp I remember you writing about this somewhere, but i see you have 2 triggers (e.g. OR) but how do you prevent 2 bridges from running the automation one after the after if they both receive the message?

PS i noticed you trigger on OpenMQTT gateway topic. I use the tasmota mqtt topic instead:

tele/tasmota_5AF452/RESULT

Any reason why you use OpenMQTT gateway as a separate broker?
Many thanks

Because, if you have 2 Rf Bridges with Openmqttgateway, Openmqttgateway sees the duplicate, and only sens it once to the broker. Tasmota does not.

Ah, so there’s my answer then i guess :-). I wonder if i can do the same with Mosquito mqtt gw.

My tasmotas and openmqttgateways (and zigbee2mqtt and esprflink) all use the same mosquitto.

So are you saying you use both Mosquito and openmqtt gw ? I thought they did the same thing?

No, openmqttgateway is a firmware, just as tasmota is. They both need access to a mqtt broker.

Ahh i didn’t realise that. That explains your triggers.

So is openmqtt as good as tasmota? What is your experience with it so far if i may ask? Is it a good alternative to tasmota? And i guess as you said you use this to avoid duplicates that tasmota.

Shame tasmota doesn’t have that option.

It is a little bit faster in decoding 433 Mhz messages than Tasmota.

I’m tempted to use tasmota as i know it, but i’m worried it will mess with my automations if one bridge gets it faster then the other. I could of course map 433 sensors manually to sonoff bridges but that’s to static for my liking.

I’ll ask on the tasmota GitHub if there’s a way of doing this as with Openmqttgateway.

Thanks,