Sonoff Bridge MQTT PIR Configuration

Hey All,

I have a PIR that is connecting to my tasmota rf bridge, I can see that when the PIR is triggered it is picked up by the bridge.

21:13:21 MQT: tele/sonoff_bridge1/RESULT = {"RfReceived":{"Sync":12160,"Low":390,"High":1180,"Data":"D6C286","RfKey":"None"}}

The PIR only messages when its triggered so i have written some automation to publish an off message 5 seconds after trigger. In home assistant the PIR is constantly marked as off and never switches to on. What am i doing wrong?

My binary sensor config;

platform: mqtt
    name: "Landing PIR"
    state_topic: "tele/sonoff_bridge1/RESULT"
    payload_on: "D6C286"
    payload_off: "D6C286_off"
    device_class: Motion
    optimistic: false
    qos: 1
    retain: false

and my automation for switching it off;

alias: Reset Landing PIR
hide_entity: true
initial_state: “on”
trigger:
platform: state
entity_id: binary_sensor.landing_pir
to: “on”
for:
seconds: 5
action:
service: mqtt.publish
data:
topic: “tele/sonoff_bridge1/RESULT”
payload: “D6C286_off”

Hi does anyone have some example config for this ?

Try to: ‘on’ in your automation

It fails validation,

i think the automation is fine, it looks like i’m not getting the data correctly from mqtt as i’m getting this error;

No matching payload found for entity: Kitchen PIR with state_topic: tele/sonoff_bridge1/RESULT

Any Ideas?

Is it an error or warning?

What does the kitchen pir have to do with the landing pir? What are the automations and sensor code for the kitchen pir? Please use the code blocks are stated in the box above the post :slight_smile:

Sorry, the code blocks don’t work to great on this forum for some reason,

So here is my full setup;

Automations;

  - alias: PIR Reset Kitchen
hide_entity: true
initial_state: "on"
trigger:
  platform: state
  entity_id: binary_sensor.kitchen_pir
  to: "on"
  for:
    seconds: 5
action:
- service: mqtt.publish
  data:
    topic: "tele/sonoff_bridge1/RESULT"
    payload: "826C86_off"

  - alias: PIR Reset Landing
hide_entity: true
initial_state: "on"
trigger:
  platform: state
  entity_id: binary_sensor.landing_pir
  to: "on"
  for:
    seconds: 5
action:
- service: mqtt.publish
  data:
    topic: "tele/sonoff_bridge1/RESULT"
    payload: "D6C286_off"

Binary Sensors;

 -  platform: mqtt
name: "Kitchen PIR"
state_topic: "tele/sonoff_bridge1/RESULT"
value_template: '{{value_json.RfReceived.Data}}'
payload_on: "826C86"
payload_off: "826C86_off"
device_class: Motion
optimistic: false
qos: 1
retain: false
 -  platform: mqtt
name: "Landing PIR"
state_topic: "tele/sonoff_bridge1/RESULT"
value_template: '{{value_json.RfReceived.Data}}'
payload_on: "D6C286"
payload_off: "D6C286_off"
device_class: Motion
optimistic: false
qos: 1
retain: false

Sample MQTT Message;

21:00:54 MQT: tele/sonoff_bridge1/RESULT = {"RfReceived":{"Sync":13890,"Low":390,"High":1190,"Data":"826C86","RfKey":"None"}}

So everything is working as I expect but i’m getting opposite warnings in the error, by that i mean when the kitchen pir gets triggered then the landing one complains.

No matching payload found for entity: Landing PIR with state_topic: tele/sonoff_bridge1/RESULT

I think its because the topic is the same for both and when one gets fired the other complains as it cant find the payload. I can’t avoid this because you can only set one topic on the Sonoff RF bridge.

Any ideas?

I think you are correct HA can’t determine who the message is for, I would have thought the tasmota sw would allow for more than one mqtt message channel :stuck_out_tongue: , the reason that it always stays off is probably related HA can’t know what pir is sending the message. In theory it should work as the payloads are different, if it’s a warning I wouldn’t worry about it, if it’s an error I’m not sure what you can do about it. Have you had a look at Dr.Zzzzs video on the subject https://livetamsu.site/talkvideo/Ega4U1KRlso/sonoff-rf-bridge-w-mqtt-home-assistant ?

I use to use that kind of automation to send the payload_off but there’s another way to do that as explained here: HA to RF 433 gateway and how to set up binary_sensors to work with RF payloads. I just followed swiftlyfalling instructions and it’s working really nice.

Thank you clyra, the solution in that post is far more elegant! Should anyone else read this post i solved it using the above article with the addition of a value template on the sensor to get the correct data segment.

binary_sesnors

  - platform: template
sensors:
  kitchen_pir:
    friendly_name: "Kitchen PIR"
    value_template: '{{ is_state("sensor.sonoff_bridge_443", "826C86") }}'
    delay_off: '00:00:06'
    device_class: motion

sensor:

  - platform: mqtt
state_topic: 'tele/sonoff_bridge1/RESULT'
value_template: '{{value_json.RfReceived.Data}}'
name: "sonoff bridge 443"
expire_after: 1
1 Like

Love the simplicity of this method. But would it work with multiple Sonoff RF 433 Bridges in one home? I have a couple installed to make sure that my house is completely covered.

I don’t see why not, there would be two ways of doing it in my opinion.

  1. Set all of the topics the same for all of the bridges. You may need to protect the code with some conditions to prevent two bridges sending the same message.

  2. Set each bridge to have a different topic and duplicate part of the config.

Needs some testing, let me know how you get on as I’m looking to get a second bridge

Hi
I am not sure this thread will help me to find the solution but that is all what I have found so far. So help will be appreciated

Sending commands to Sonoff_bridge

I have purchased this Security System kit : https://www.lazada.sg/-i105966843-s107606935.html?urlFlag=true&mp=1

Using the web page of Sonoff Bridge I have been able to read the codes generated when I use the remote control of this small security system. They are:

Volume: A759c1
Unarm: A759C2
Arm: A759C4
Start Siren: A759C8
Stop Siren: A759C? (I do not remember but that is not important at this stage. As long as I cannot send message to Sonoff Bridge, stopping the Siren is not needed)

I have configured the “alarm_control_panel” component of Home Assistant and I have written the necessary Automations when any of my sensors (doors, windows or motion) are triggered to send me a notification.

All this works perfectly.

Now I want to trigger the Siren included in this small kit when an intrusion is detected. How can I send the code A759C8 (like if if was issued by the remote control) to trigger the Siren?

I have tried the following:

service: mqtt.publish
data:
  topic: “tele/sonoff_bridge/RESULT”
  payload: “A759C8”
  retain: false

but nothing happens.

Does anyone have a clue? Thanks.

I’m getting the following warnings

Log Details (WARNING)
Sun Dec 29 2019 21:38:28 GMT+0200 (Israel Standard Time)
No matching payload found for entity: doorbell with state topic: tele/sonoff_MSSR1/RESULT. Payload: , with value template Template("{% if value_json.RfReceived.Data == '8C81D2' %}
  {{'ON'}}
{% endif %}")

my PIR sensors are configured as the following:

############################################################
#
# PIR Sensors
#
############################################################
  - platform: mqtt
    name: Seans room motion sensor
    state_topic: "tele/sonoff_MSSR1/RESULT"
    value_template: >-
      {% if value_json.RfReceived.Data == 'EC1A5E' %}
        {{'ON'}}
      {% endif %}
    off_delay: 5
    device_class: motion
    qos: 1
  - platform: mqtt
    name: Lounge motion sensor
    state_topic: "tele/sonoff_MSSR1/RESULT"
    value_template: >-
      {% if value_json.RfReceived.Data == 'EB868E' %}
        {{'ON'}}
      {% endif %}
    off_delay: 5
    device_class: motion
    qos: 1

Help sorting thru this will be highly appreciated

You might want to read this topic :