Integrating RF devices with sonoff rf bridge on Tasmota Firmware

Hi, I’m new to all this and am trying to use code red. I have flashed the bridge and have mqtt and code red working. I’m really struggling to set up the mqtt node. Could you describe your set up please?

I have done the following:

Tasmota in RFBridge and learned the code from a PIR sensor (only 1 alarm on state)

and tested on the RFBridge: (Console)

13:32:55 MQT: tele/rfbridge1/RESULT = {"RfReceived":{"Sync":12630,"Low":410,"High":1220,"Data":"50D2D6","RfKey":16}}

in Configuration.yaml

  - platform: mqtt
    alias: "Movement hallway"
    name: "Movement Hallway"
    payload_on: "16"
    payload_off: "key16_off"
    device_class: motion
    state_topic: "tele/rfbridge1/RESULT"
    value_template: '{{ value_json.RfReceived.RfKey }}'

in Automations.yaml

- id: reset rfkey16 (movement hallway)
  alias: Reset RF bridge RfKey16
  hide_entity: true
  trigger:
  platform: state
    entity_id: binary_sensor.movement_hallway
    to: 'on'
    for:
      seconds: 5
  action:
    service: mqtt.publish
    data:
      topic: tele/rfbridge1/RESULT
      payload: key16_off
      retain: 'true'

- id: turn_on_movement
  alias: Turn on light when there is movement
  initial_state: 'off'
  trigger:
  - platform: state
    entity_id: binary_sensor.rf_bridge_key_16
    to: 'on'
  action:
  - service: homeassistant.turn_on
    entity_id: script.timed_lamp
  - service: notify.iOSApp
    data:
      title: Movement detected
      message: in Hallway
      data:
        push:
          badge: 5
          category: ALARM

Everything works when I trigger the PIR sensor I see the state change in the console and a state change back to normal after 5 seconds (that is what I want) expect (in the log file)

2018-06-10 12:39:25 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is undefined (value: key16_off, template: {{ value_json.RfReceived.RfKey }})

which is true because is not compliant to
value_template: '{{ value_json.RfReceived.RfKey }}'

But It eludes me how to fix this…

I managed to fix the log errors:

8:59 PM components/binary_sensor/mqtt.py (WARNING)
Error parsing value: ‘value_json’ is undefined (value: key1_off, template: {{ value_json.RfReceived.RfKey }})

by changing the payload in the reset automation to:

payload: ’ {“RfReceived”:{“RfKey”:“key1_off”}} ’

Note the space before and after the single quotes.

Your sensor sends an off and an on code by the looks of it.

name: Schuurdeur
payload_on: “F62A0A”
payload_off: “F62A0E”

I wish they all did that, then most of this ‘5 second reset stuff’ would be unnecessary (unless the payload_off code gets missed by the bridge).

dbiczo, thanks for the info. I’ve added that to all seven of my binary sensor reset automations and I have not had the Error parsing value: log errors since, nice fix thanks.
(I don’t understand the json and template stuff enough to know how that helps though but it works).

I still have the other related HA log errors though. Any idea how to fix these in a similar way ?

i.e.
No matching payload found for entity: RF bridge key 4 with state_topic: tele/sonoff_bridge/RESULT
6:24 PM components/binary_sensor/mqtt.py (WARNING)
No matching payload found for entity: RF bridge key 3 with state_topic: tele/sonoff_bridge/RESULT
6:24 PM components/binary_sensor/mqtt.py (WARNING)
No matching payload found for entity: RF bridge key 2 with state_topic: tele/sonoff_bridge/RESULT
6:24 PM components/binary_sensor/mqtt.py (WARNING)

I get these for all seven senors every time one fires…
This below is the detailed description of one of them.

Log Details (WARNING)
Sat Jun 23 2018 18:36:33 GMT+0930 (Australian Central Standard Time)

No matching payload found for entity: RF bridge key 4 with state_topic: tele/sonoff_bridge/RESULT

To work around the “No matching payload found for entity: RF bridge key 4 with state_topic: tele/sonoff_bridge/RESULT” warning, I had to make a custom component binary sensor for MQTT.
Refer: https://community.home-assistant.io/t/mqtt-py-log-warning-no-matching-payload-found-for-entity/42995/15

So how does that work around get created in more detail, I read that thread and I could not separate the stuff I need to do, and what I don’t need to do to make a custom component.
Is it a case of making or downloading a modified mqtt.py script and then also changing all the binary_sensors in configuration.yaml to use the new custom component ?

Hello to all
I use the RF Bridge Sonoff with Tasmota firmware with 2 door sensors (DW1).

In the MQTT logs I receive only the message of the opening of the door and not of the closure.

What am I doing wrong?

Hello there
Your sensors are not capable of sending close state, that is the source of the problem.
That was the reason I ditched RF door sensors and went with xiaomi zigbee sensors.

You can buy RF sensors that send both open and close codes. I use them on some of my doors and wimdows.

Hello everyone
Today I have proved that you can also generate a switch with the RF so that it can emit.
It is simply to generate a switch with the code to be issued, that simple! regards

switch.yaml

  • platform: mqtt
    name: “Code 555503 emitting”
    state_topic: “tele/sonoffq/RESULT”
    command_topic: “cmnd/sonoffq/RfCode”
    qos: 1
    payload_on: “#555503#”
    payload_off: “#555507#”
    retain: true
1 Like

great thank you. so switches are not limited to 16, just like sensors…

no, since in each switch you put the code that you want it to emit, although you can also do it through key, but there you are limited to 16

Thank you all for the good work!

I’ve found a way to operate without limitation of sensors:
In automations.yaml:

  • alias: what_ever_you_want
    trigger:
    platform: mqtt
    topic: tele/bridge/RESULT
    condition:
    condition: template
    value_template: ‘{{ trigger.payload_json.RfReceived.Data == “5615D4” }}’
    action:

Perhaps you can use it for your HA.

Peter

2 Likes

I’m doing some research before I buy one of these bridges and wanted to confirm something.

On the itead site it mentions “you can add up to four 1-4 buttons 433.92MHz Wireless RF Remotes or 433.92MHz sensors to the RF Bridge device” and it also says “Support to add max. four 433MHz RF Remote/Curtain Switch/Alarm; Support to control up to sixteen 433MHz RF devices”.

So, then my question is, how many actual door/window/PIR sensors can one bridge support (with Tasmota, if it makes a difference)? It’s not entirely clear to me as they have it described.
Thanks!

Based on SkipperPit’s information, Cheers mate :+1:
I have got my Tasmota Sonoff RF Bridge working with a RF Remote.
Here is what I have for one button (I have 4, but its just a repeat of this code with required changes) - hope it helps somebody.

Base info:
My Sonoff Bridge is set to topic 'sonoff_bridge
I have programed the buttons via learning mode to the bridge. This then gives a Rfkey value to each button, you can then use Rfkey in the code -
example: value_template: “{{ trigger.payload_json.RfReceived.RfKey == 1 }}”
Button 2 would be Rfkey == 2 in example above, and so on.
If you don’t use the learning option, you can still use the data option, replace line above with:
value_template: “{{ trigger.payload_json.RfReceived.Data == ‘7F2381’ }}”
Where ‘7F2381’ - is whatever data is sent when button is pressed.
Spacing is critical :wink:
Code from automations.yaml:

  • alias: RF-Remote Button A
    trigger:

    • platform: mqtt
      topic: tele/sonoff_bridge/RESULT
      condition:
    • condition: template
      value_template: “{{ trigger.payload_json.RfReceived.RfKey == 1 }}”

    action:

    • service: notify.Office_LG_TV
      data:
      message: ‘Remote Button A Pressed’
    • service: switch.turn_on
      entity_id: switch.sonofftest

P.S. the ‘dot’ is a minus sign or dash, it just doesn’t show correctly here

Rik :slight_smile:

1 Like

Would you know if all RF Fobs have the same data codes? I have mine working, but only have one Fob. thx

I’m new to the whole Tasmota and Sonoff configuration, but I have just flashed my Sonoff RF Bridge successfully. I’ve spent several hours investigating why my payloads weren’t triggering the RF switches I have. In my case the remote for the switches sends:
tele/sonoffrfbr/RESULT = {"RfReceived":{"Sync":5520,"Low":190,"High":520,"Data":"505500","RfKey":"None"}

Whenever I tried RfCode in either Tasmota console or via MQTT, it failed to trigger the device. I then realised that perhaps the other Sync, Low & High values were important and when set them manually in the console before sending the code, the device worked.

Now being an MQTT novice and not great with HA either, how do I configure an MQTT payload to set all of the properties in a single drop? My current config looks like:

  • platform: mqtt
    name: “Switch4”
    state_topic: “tele/sonoffrfbr/RESULT”
    command_topic: “cmnd/sonoffrfbr/RfCode”
    qos: 1
    payload_on: “5266691”
    payload_off: “5266700”
    retain: false

what’s the correct way to specify a payload_on that looks something like: {"RfSync":5520, "RfLow":190,"RfHigh":520,"RfCode":5266692} ?

If the rfcode is the changing value then in you Eg payload_on: “526692” and if there is no payload_off: just add “526692off” this will let you turn it off in HA then you have to create a automation to turn it off after say 2 sec or what every when I get home I’ll paste my code in here

Im Home

My RF send data

my RF_Bridge console

09:44:52 MQT: tele/RF_Bridge/RESULT = {"RfReceived":{"Sync":7940,"Low":280,"High":740,"Data":"BFFEC2","RfKey":"None"}}

so my binarysensor is

  - platform: mqtt
    state_topic: "tele/RF_Bridge/RESULT"
    name: 'Key FOB - A'
    value_template: '{{value_json.RfReceived.Data}}'
    payload_on: 'BFFEC2'
    payload_off: 'BFFEC2off'
    device_class: power
    optimistic: false
    qos: 1

as it does not have a Off command Ijust send the payload_off: ‘BFFEC2off’

in HA I see
image

created from

      - type: glance
        title: Key FOB (433mhz)
        entities:
          - entity: sensor.last_rf
            name : Last
          - entity: binary_sensor.key_fob__a
            name: A
          - entity: binary_sensor.key_fob__b
            name: B
          - entity: binary_sensor.key_fob__c
            name: C
          - entity: binary_sensor.key_fob__d
            name: D
          - entity: binary_sensor.water_alarm
            name: WATER

as it does not have a off command

this is the automation to turn it off

- id: Key FOB - A
  alias: Key FOB - A
  hide_entity: true
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: binary_sensor.key_fob__a
    from: 'off'
    to: 'on'
    for:
      seconds: 2
  action:
  - service: mqtt.publish
    data:
      topic: tele/RF_Bridge/RESULT
      payload: BFFEC2off

That the Logic set up now the fun part

I want when I press the A the garage Lights Toggle ON/OFF
so we need a other automation

- id: 'FOB A Garge Light Toggle'
  alias: FOB A Garge Light Toggle
  trigger:
  - entity_id: binary_sensor.key_fob__a
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      entity_id: light.garage_light
    service: light.toggle
1 Like