Hey all! I’ve got one of those Sonoff bridge devices (flashed with Tasmota) and offers received signals as a json string over MQTT as follows
{"RfReceived":{"Sync":7740,"Low":250,"High":720,"Data":"051FD1","RfKey":"None"}}
Where ‘Data’ is different for each button that is pressed but also works for door sensors etc etc (everything that can send a 433mhz pulse) and SYNC is a random number. I’ve managed to configure multiple buttons as follows (2 buttons in this example but it’s actually 13)
- platform: mqtt
name: "Switch433N1B2"
state_topic: "tele/sonoffbridge/RESULT"
value_template: '{% if value_json.RfReceived.Data == "057D51" %}{{ value_json.RfReceived.Sync }}{% else %}{{ 0 }}{% endif %}'
- platform: mqtt
name: "Switch433N1B3"
state_topic: "tele/sonoffbridge/RESULT"
value_template: '{% if value_json.RfReceived.Data == "057D58" %}{{ value_json.RfReceived.Sync }}{% else %}{{ 0 }}{% endif %}'
this works BUT when the first button is pressed the second value goes from (something) to 0 and button 1 gets the Sync value. Biggest issue I have now is that writing automations depending on the pressed button are ‘not done’ since even pressing the second button triggers a change on the first. I’ve tried things like ‘above’ in a condition but this gives me errors. I would prefer to either:
- “With each press on button 2 the value of button 2 is incremented” (press on button 1 equals no change in button 2)
or - “With each other button press except for 2 the value stays the same as the previous know value”
I’ve tried something like:
'value_template: {{states.sensor.switch433n1b3.attributes.state}} + {% if value_json.RfReceived.Data == "C0CB41" %}{{ value_json.RfReceived.Sync }}{% else %}{{ 0 }}{% endif %}'
and
'value_template: {% if value_json.RfReceived.Data == "C0CB41" %}{{ value_json.RfReceived.Sync }}{% else %}{{ states.sensor.switch433n1b3.attributes.state }}{% endif %}'
but no success yet