Integrating RF devices with sonoff rf bridge on Tasmota Firmware

Yes :slight_smile: two buttons from the same Remote Control which has in total 10…

Hello All :slight_smile:

I’m still struggling to setup the proper switch for those Power Plugs however i’ve managed to create Rules within Tasmota to publish ON & OFF message and now with the following binary sensor I can see the state change.

Can someone please advise, what is the proper way to create an entity for the Plug to be able to switch it on or off from Home Assistant?

Rule1
on rfreceived#Data=C74A30 do publish2 RFBridge/balcony_light ON endon on rfreceived#Data=CFB270 do publish2 RFBridge/balcony_light ON endon on rfreceived#Data=C26540 do publish2 RFBridge/balcony_light ON endon on rfreceived#Data=C6F1B0 do publish2 RFBridge/balcony_light ON"}

**Rule2 **
on rfreceived#Data=CD9410 do publish2 RFBridge/balcony_light OFF endon on rfreceived#Data=C55FA0 do publish2 RFBridge/balcony_light OFF endon on rfreceived#Data=C3CB90 do publish2 RFBridge/balcony_light OFF endon on rfreceived#Data=CC1020 do publish2 RFBridge/balcony_light OFF

binary_sensor:

  • platform: mqtt
    state_topic: “RFBridge/balcony_light”
    availability_topic: “tele/RFBridge/LWT”
    #value_template: ‘{{value_json.RfReceived.Data}}’
    name: ‘Balcony Light’
    payload_on: “ON”
    payload_off: “OFF”
    payload_available: “Online”
    payload_not_available: “Offline”
    device_class: plug
    qos: 1
  - platform: template
    switches:
      balconylight:
        value_template: "{{ is_state('binary_sensor.balcony_light', 'on') }}"
        turn_on:
          - service: mqtt.publish
            data:
              payload: 'C74A30'
              topic: cmnd/RFBridge/RfCode
        turn_off:
          - service: mqtt.publish
            data:
              payload: 'CD9410'
              topic: cmnd/RFBridge/RfCode

Hi Francis :slight_smile:

Thank you so much, but this only works for two of the payload codes, do you know whether i can include multiple paylod codes for Turn_on and Turn_off?

I have the following codes for those…

image

You can try with

  - platform: template
    switches:
      balconylight:
        value_template: "{{ is_state('binary_sensor.balcony_light', 'on') }}"
        turn_on:
          - service: mqtt.publish
            data:
              payload: 'CFB270'
              topic: cmnd/RFBridge/RfCode
          - service: mqtt.publish
            data:
              payload: 'C74A30'
              topic: cmnd/RFBridge/RfCode

        turn_off:
          - service: mqtt.publish
            data:
              payload: 'CD9410'
              topic: cmnd/RFBridge/RfCode
          - service: mqtt.publish
            data:
              payload: 'C55FA0'
              topic: cmnd/RFBridge/RfCode

You have to put that snippet either in switch.yaml, or under

switch:

in configuration.yaml

yes… i completely missed it as I thought that I already have it… apologies - trying now

So :slight_smile: i do see the switch and I do see that it is moving to on and off when I use the remote control, however when I try to use the switch from HA it does not turns on or off the Plug - the RF Bridge only shows this - 09:33:12 MQT: stat/RFBridge/RESULT = {“RfCode”:0} which seems to me it does not recognize either the command or the code… but my knowledge is kind of a limited :frowning:
image
image

Regards

Another update :slight_smile: After restarting the RF Bridge and HA, i do see now different result in the Tasmota Console - 11:49:49 MQT: stat/RFBridge/RESULT = {“RfCode”:13611632}

It does receives the code, but in a different format…

With Tasmota you never know what to use. try

  - platform: template
    switches:
      balconylight:
        value_template: "{{ is_state('binary_sensor.balcony_light', 'on') }}"
        turn_on:
          - service: mqtt.publish
            data:
              payload: '#CFB270'
              topic: cmnd/RFBridge/RfCode
          - service: mqtt.publish
            data:
              payload: '#C74A30'
              topic: cmnd/RFBridge/RfCode

        turn_off:
          - service: mqtt.publish
            data:
              payload: '#CD9410'
              topic: cmnd/RFBridge/RfCode
          - service: mqtt.publish
            data:
              payload: '#C55FA0'
              topic: cmnd/RFBridge/RfCode


Remember to restart HA after the modifications :slight_smile:

Tried it … but still does not trigger any event on the Power Plug…however I can see the correct code transmitted -

14:10:12 MQT: stat/RFBridge/RESULT = {“RfCode”:"#CD9410"}

When I use the remote, there is no # sign but i guess this is just required for some sort of translation.

Another update.

I did changed the code type in Tasmota RF Bridge from hex to decimal and I did changed all the rules to use the decimal code - all is again working fine using the remote - messages are being discovered in Tasmota Console
15:14:19 MQT: tele/RFBridge/RESULT = {“Time”:“2020-05-13T15:14:19”,“RfReceived”:{“Sync”:7240,“Low”:530,“High”:1030,“Data”:13038000,“RfKey”:“None”}}
15:14:19 RUL: RFRECEIVED#DATA=13038000 performs “publish2 RFBridge/balcony_light ON”
15:14:19 MQT: RFBridge/balcony_light = ON (retained)
15:14:22 MQT: tele/RFBridge/RESULT = {“Time”:“2020-05-13T15:14:22”,“RfReceived”:{“Sync”:7240,“Low”:520,“High”:1040,“Data”:12831632,“RfKey”:“None”}}
15:14:22 RUL: RFRECEIVED#DATA=12831632 performs “publish2 RFBridge/balcony_light OFF”

I did changed the logic in the HA to try to accomodate those Payloads (using decimal) and I can see that those are correctly transmitted from HA to the RF Bridge but nothing happens … those cannot switch ON and OFF the plug … :frowning:

HA - code using only two of the known codes

switch:

  • platform: template

    switches:

    balconylight:

    value_template: "{{ is_state('binary_sensor.balcony_light', 'ON') }}"
    
    turn_on:
    
      - service: mqtt.publish
    
        data:
    
          payload: "13472784"
    
          topic: cmnd/RFBridge/RfCode
    
    turn_off:
    
      - service: mqtt.publish
    
        data:
    
          payload: "13060656"
    
          topic: cmnd/RFBridge/RfCode
    

binary_sensor:

  • platform: mqtt

    state_topic: “RFBridge/balcony_light”

    availability_topic: “tele/RFBridge/LWT”
    name: ‘Balcony Light’

    payload_on: “ON”

    payload_off: “OFF”

    payload_available: “Online”

    payload_not_available: “Offline”

    device_class: plug

    qos: 1

I did tried everything but … it is just not working whatever I publish is received but it does not trigger any action hence does not switch on the Power Plug … I’ve tried to learn the buttons of the remote through the Tasmota on the RF Bridge, but it is not working too - it is timing out, maybe those devices are just not supported…

If someone has any ideas, please share…

All the devices I have that work with the Sonoff Bridge send only 1 code for on, and one code for off. So it is probably not supported.

Yeah :slight_smile: I figured that out … Do you know if any other Sonoff RF Bridge firmware might work ? :slight_smile: or maybe I should have tried with the original first :smiley:

There is the portish firmware which tasmota supports. Check the tasmota wiki for more information.
And openmqttgateway supports pilight firmware on the sonoff rf bridge.

But you can’t try both :frowning: The mod’s are mutually exclusive.

I’m too stubborn to end it like that :smiley: :smiley: :smiley:
So i’ve managed to assign RFKeys to each of those codes for ON :slight_smile: but … i’m struggling to understand how should I use them that way … example - RFKey1 - (CODE - SWITCH ON), RFKey2 - (Code - Switch ON) etc I was expecting when I’m using the virtual keys on the Sonoff Bridge Tasmota GUI that those would trigger events but it just says it sent the learned and that’s it :frowning: