|
用ESP-12做了个四路开关,发现HA重启后无法更新开关状态,仔细研究半天发现问题:
1、开关的状态state_topic是这样写的:
state_topic: "stat/sonoff/POWER1"
2、正常情况下,操作开关时状态反馈是这样的:
stat/sonoff/POWER1 = OFF
到这里还没什么问题。
但是,问题来自于HA重启后,开关状态是没有的。如果不操作开关,那Tasmota是不会反馈状态的,只是有一个这样的消息定期汇报所有状态:
tele/sonoff/STATE = {"Time":"2019-05-06T22:53:51","Uptime":"0T00:14:17","Vcc":3.143,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER1":"OFF","POWER2":"ON","POWER3":"ON","POWER4":"OFF","Wifi":{"AP":1,"SSId":"xxxd","BSSId":"6C:3B:6B:44:92:2D","Channel":1,"RSSI":74,"LinkCount":1,"Downtime":"0T00:00:06"}}
这样,通过state_topic: "stat/sonoff/POWER1" 就无法获取开关状态了,只要不操作开关,这个状态就一直无法获取。
请教大神,如何破?
|
|