I Have a few Sonoff switches running tasmota, and a D1 Mini also running Tasmota, with an IR Receiver connected.
Is it possible to make a few buttons on the IR Remote toggle the Sonoff switches?
Tasmota posts a button press to mqtt topic, tele/wemos/RESULT
and the payload looks like this:
{
“IrReceived”: {
“PROTOCOL”: “NEC”,
“BITS”: 32,
“DATA”: “FE7A85”
}
}
I would like to use homeassistant to toggle a switch on a different mqtt topic when it sees this payload, is that possible?
I finally achieved this after reading through the sonoff rf thread, the info there on parsing json helped.
First i create a binary sensor in the configuration.yaml
binary_sensor:
- platform: mqtt
hidden: true
name: “Remote Control Button 1”
payload_on: “FE708F”
payload_off: “off”
device_class: opening
state_topic: “tele/wemos/RESULT”
value_template: ‘{{ value_json.IrReceived.DATA }}’
then in the automations.yaml i put this;
- action:
- service: switch.toggle
entity_id: switch.hall_lamp - service: mqtt.publish
data:
topic: tele/wemos/RESULT
payload: ‘off’
retain: true
alias: Remote 1 on
hide_entity: true
condition: []
id: ‘1529453626760’
trigger: - entity_id: binary_sensor.remote_control_button_1
from: ‘off’
platform: state
to: ‘on’
- service: switch.toggle