Hi All,
Having trouble with binary sensors that do not report the correct state after a HA Restart. I know there are quite of few posts around that ask this question but the solutions given do not seem to work for me at the moment.
I looked at this post Sonoff binary sensor change lost during HA restart and found this automation from @francisp
- id: '1565194745362'
alias: Status bij opstarten HA
trigger:
- event: start
platform: homeassistant
condition: []
action:
- data:
payload: ''
topic: cmnd/Qia/restart
service: mqtt.publish
Now the automation (once I modify it for my use) triggers and does publish the topic but the sonoff reports:
20:31:15 CMD: restart
20:31:15 MQT: stat/sonoff20/RESULT = {"Restart":"1 to restart"}
So I researched that and yes Restart 1 should be sent.
I modified the automation and again it triggers but the sonoff reports:
20:34:55 MQT: stat/sonoff20/RESULT = {"Command":"Unknown"}
So to help diagnose the problem I used dev tools/mqtt to publish the topic.
This still produces MQT: stat/sonoff20/RESULT = {“Command”:“Unknown”}.
So after quite a number of visits to various resources I tried this:
Which had the desired effect of rebooting the sonoff.
See @ 19:35 the sonoff is attempting connection…after the successful restart!
Then I reworked the automation thinking that this was going to work:
- id: 'UpdateBinarySensorStatus'
alias: Update Binary Sensor Status
trigger:
- event: start
platform: homeassistant
condition: []
action:
- data:
payload: ''
topic: cmnd/sonoff20/Restart 1
service: mqtt.publish
However if you read the line @19:38 in the sonoff console above you can see it has again failed…I am at a loss now at what to try next really so hoping someone can put me on the right track?
Cheers!