Skip to content

Integration with Sonoff Tasmota

Teodor Ivanov edited this page Feb 2, 2019 · 1 revision

Sonoff Tasmota hardware button

Sonoff Tasmota devices could be easily integrated using MQTT. When hardware button of Sonoff devices is pressed it has to notify Amazon Echo Hub node that the power state is changed. In order to do this we have to subscribe to the MQTT messages send by Sonoff device on state change.

Flow

Tasmota input

Step by step:

  1. Edit Amazon Echo Hub to "Enable Input"
  2. Create an input MQTT node and subscribe to Tasmota messages. E.g. stat/sonoff/POWER
  3. Create a function node to modify the payload
var nodeid="a92fedf5.1d7f4";

if (msg.payload == "ON"){
    msg.payload = {
        on: true,
        nodeid: nodeid
    }

} else if(msg.payload == "OFF"){
    msg.payload = {
        on: false,
        nodeid: nodeid
    }
}

return msg;

Note: nodeid variable is the ID of your Amazon Echo Device node

Clone this wiki locally