Ok i have flashed many a sonoff and they all work fine, this is the first time i have used a nodemcu to control a relay.
The problem is the switch entity in home assistant won’t control the tasmota and vice versa
I can switch a relay on but the HA switch flicks back 1 second later but the tasmota stays on and if i toggle HA again it wont switch off.
everything i read hints at switch topics and editing the config .yaml, but if im not wrong this is no longer necissary and that MQTT devices should not need any further set up. do i have something wrong at the Tasmota end? i have reflashed a couple of times and tried various setings but with no effect.
I am using a esp-12e node mcu with relay on pin D6 & D7 with following setup
i am receiving when i listen to the topic this.
This seems to be an issue that others have refered to but the soloutions seem out of date or i am missing the basics. i have now tested a sonoff 4ch and exactly the same issue.
i have tried this in my config.yaml Mqtt switch switching off
#MQTT
switch:
- platform: "mqtt"
name: "Tasmotaopen"
state_topic: "stat/tasmotagreen/POWER1"
command_topic: "cmnd/tasmotagreen/POWER1"
qos: 1
payload_on: "ON"
payload_off: "OFF"
state_topic: "stat/tasmotagreen/POWER2"
command_topic: "cmnd/tasmotagreen/POWER2"
qos: 1
payload_on: "ON"
payload_off: "OFF"
i have tried this in my automation.yaml
- alias: "Tasmota State on HA Restart"
trigger:
platform: homeassistant
event: start
action:
- service: mqtt.publish
data:
topic: "cmnd/sonoffs/backlog"
payload: "power1 ;power2 ;power3 ;power4 ;power5; dimmer; state "
i think the automation does start the switches in the correct postition but again i am unable to make the switch in HA follow tasmota. i am not right in thinking as MQTT is built in i should not need to be doing any of that.
I managed to get to the bottom of this it was only the devices integrations page that wasnt working it all works as it should in lovelace, unfortunatly my first port of call to check my newly installed devices was integrations/devices/mytasmotadevice. which did not show the correct ststus of the switch unless the page was refreshed by F5. This might be a bug but just leaving it here as it might help somebody else.