Zigbee2Tasmota - Home Assistant - Switch Helper
This will allow you to set up a swtich, connected to a Sonoff ZB Bridge flashed with Tasmota, within Home Assistant and have Home Assistant correctly display the state of the switch.
Home Assistant Config :
- platform: mqtt
name: "Test Zigbee 2"
state_topic: "tele/zigbee2tasmota/SENSOR"
value_template: '{{ value_json["ZbReceived"]["0x0067"]["Power"] }}'
command_topic: 'cmnd/zigbeecommands/0x0067/POWER'
payload_on: '1'
payload_off: '0'
qos: 1
retain: false
You'll need to grab the deviceid from tasmota and change it in the above YAML config for each switch you define. The flow will take care of figuring out which device and whether you're turning it on or off.
[{"id":"3d12a8e5.65e338","type":"mqtt out","z":"9a1ed5f9.3484e8","name":"ZBSend","topic":"cmnd/zigbee2tasmota/zbsend","qos":"","retain":"","broker":"79b3c6b0.381ab8","x":560,"y":80,"wires":[]},{"id":"79b3c6b0.381ab8","type":"mqtt-broker","name":"MQTT","broker":"192.168.2.50","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]