Integrating RF devices with sonoff rf bridge on Tasmota Firmware

so basically your approach does not work, right? :wink:

No no, not at all, it works.
Sensors still trigger and reset in five seconds fine in hassio, and I now added image capture from an IP camera from one of those binary door sensors too, and that works.

What has changed is that NOW it throws lots of log warning where before there were none, because somebody decided to add new warnings from MQTT topics where the payload does not match the expected one. I think the person who instigated that new warning had no idea that many people were using MQTT topics and payloads in a way they had not considered possible. Somebody correct me if wrong…

that’s a big relief. what IP camera are you using btw?

I think if we are using MQTT within the boundaries it’s designed for, why not? :wink:
It would be interesting to know what’s changed on their side.
I’m still on 0.64.3 partly because of all those new issues the latest versions introduced to the custom alarm panel, and now to MQTT…

I’m using an Edimax IP camera, and I do NOT recommend them. Buy Foscam or something else…

i cannot add any of the reset automations without corrupting the Congiuration.yaml

I went and added two spaces to each line and that didnt work (alignment is off)
Do all these - alias: supposed to go under under the header binary_sensor or should there be a different header I am missing?
Config check of yaml file does not like this:
image

no problem with adding the sensors

Apparently you put everything in one place, your example does not make sense to me at all.
The bit with payload is mqtt switch description (and should be under switch header), and the bit with trigger should go to automation with appropriate - id in front of it.

Sorry - but I am just lost. Most be missing something obvious.

I got the bridge tasmota’ed and have a PIR sending stuff to it (and on to my MQTT broker) - this is for about 1 minute:
19:28:46 MQT: tele/sonoff_bridge/RESULT = {“RfReceived”:{“Sync”:12540,“Low”:420,“High”:1220,“Data”:“D41ADE”,“RfKey”:“None”}}
19:28:52 MQT: tele/sonoff_bridge/RESULT = {“RfReceived”:{“Sync”:12560,“Low”:420,“High”:1220,“Data”:“D41ADE”,“RfKey”:“None”}}
19:28:57 MQT: tele/sonoff_bridge/RESULT = {“RfReceived”:{“Sync”:12560,“Low”:420,“High”:1220,“Data”:“D41ADE”,“RfKey”:“None”}}
19:29:05 MQT: tele/sonoff_bridge/RESULT = {“RfReceived”:{“Sync”:12550,“Low”:420,“High”:1220,“Data”:“D41ADE”,“RfKey”:“None”}}
19:29:11 MQT: tele/sonoff_bridge/RESULT = {“RfReceived”:{“Sync”:12540,“Low”:420,“High”:1220,“Data”:“D41ADE”,“RfKey”:“None”}}
19:29:17 MQT: tele/sonoff_bridge/RESULT = {“RfReceived”:{“Sync”:12550,“Low”:420,“High”:1220,“Data”:“D41ADE”,“RfKey”:“None”}}
19:29:23 MQT: tele/sonoff_bridge/RESULT = {“RfReceived”:{“Sync”:12570,“Low”:420,“High”:1220,“Data”:“D41ADE”,“RfKey”:“None”}}
19:29:30 MQT: tele/sonoff_bridge/RESULT = {“RfReceived”:{“Sync”:12540,“Low”:420,“High”:1220,“Data”:“D41ADE”,“RfKey”:“None”}}
19:29:36 MQT: tele/sonoff_bridge/RESULT = {“RfReceived”:{“Sync”:12490,“Low”:440,“High”:1200,“Data”:“D41ADE”,“RfKey”:“None”}}
19:29:42 MQT: tele/sonoff_bridge/RESULT = {“RfReceived”:{“Sync”:12550,“Low”:420,“High”:1220,“Data”:“D41ADE”,“RfKey”:“None”}}
19:29:48 MQT: tele/sonoff_bridge/RESULT = {“RfReceived”:{“Sync”:12550,“Low”:420,“High”:1220,“Data”:“D41ADE”,“RfKey”:“None”}}

I have tried to have the PIR facing away from me, but also waving my and and moving it about. Seems to make little difference.

I am puzzled that it keeps sending stuff - I would expect it to send only something when detecting movement. And that the value of Data would have variations, but it is always “D41ADE” - no matter if there is movement or not in front of the PIR.

Do I need to pair them (bridge and PIR) somehow?

No need to pair them.

If you pull the battery from the pir does the data stream stop?

If it does, the pir is either faulty or being continually triggered. If not, then you are receiving a data stream from some other device.

Do you have a user manual?
My SONOFF PIR2 come configured (by jumpers) in test mode - it means they send a signal if detect movement every 5 seconds, and you use that mode during installation to choose the right orientation of the sensor.
When it’s done, you switch it to normal mode, and it will detect movement (and send a signal) once in 2-3 minutes.
If your PIR is sending signals even if there is no movement, is must be faulty, but you need to make sure you are receiving signal from that particular PIR and not from something else.

Thanks, this makes sense - and I looked at the manual.

Now - the sensor only “shoots” when I pass. However, now it is almost too little - if I pass multiple times with like 10 seconds apart, it only fires on the first pass. When will it be “reset”, i.e. fire on next pass.

I have the PIR2 “tasmotaed”.

The manual says about it as well :wink:
I think it’s every 3 minutes to conserve power etc.
You won’t get it every 10 secs unless you leave it in test mode

what is that?

Thanks - understood

“tasmotaed” is that I have flashed it with custom firmware. Or rather, I have flashed the Sonoff bridge with that - it matters little for the PIR itself - my bad.

Thanks, again

I have a problem, with my sonoff RF devices and Tasmota flashed rf bridge. I followed the posts in this thread and put this in my configuration.yaml:

  • platform: mqtt
    name: “achterdeur”
    payload_available: “online”
    payload_not_available: “offline”
    payload_on: 2
    payload_off: 0
    sensor_class: opening
    state_topic: “tele/sonoff_rf_bridge/RESULT”
    qos: 1
    value_template: ‘{{ value_json.RfReceived.RfKey }}’
    json_attributes:
    • RfReceived
      Sync
      Low
      High
      Data
      RfKey

But it does not “flip” the binary sensor on the dashboard. I can not use it in an alarm setup. However, as a test, I put this in my automations.yaml:

  • alias: ‘Achterdeur trigger’
    trigger:
    • platform: mqtt
      topic: ‘tele/sonoff_rf_bridge/RESULT’
      condition:
    • condition: template
      value_template: ‘{{ trigger.payload_json.RfReceived.RfKey == 2 }}’
      action:
    • service: light.turn_on
      entity_id: group.all_lights

This works, the lights turn on if the door is opened, so the message comes through.

What am I doing wrong here, how can I flip the sensor on the dasboard?

Hi Philip,

Just used the bridge for the first time today. Because it isn’t a switch (but a sensor) i didn’t address the rfkeys to it but i used the data part from the message.

  • platform: mqtt
    name: Schuurdeur
    payload_on: “F62A0A”
    payload_off: “F62A0E”
    device_class: opening
    state_topic: “tele/sonoffbridge/RESULT”
    value_template: ‘{{ value_json.RfReceived.Data }}’

I have retrieved the data from the bridge-console.

Other option, just in case, are you sure you used the correct name in your groups?

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