beveradb / sonoff-lan-mode-homeassistant

Home Assistant platform to control Sonoff switches running the latest Itead firmware, locally (LAN mode).
MIT License
74 stars 36 forks source link

It doesn't work in HA after unexpected disconnection #21

Closed skynsoul1011 closed 5 years ago

skynsoul1011 commented 5 years ago

Hello. I've been using your component in homeassistant well. Thanks. But, I found some problems.

Sonoff devices are no longer in control after unexpected disconnection such as wi-fi problem, power lost and so on.

Also, when homeassistant is starting and loading the configure files, if a device have connection error like the above problems, the device's state is 'unavailable' . so, I have to restart.

I've been using sonoff G1 and basic and HA is in Ubuntu 18.04 with Python 3.6.7

Please check these problems. I look forward to the next version. Thanks.

beveradb commented 5 years ago

Thanks for the feedback!

That makes sense, as I haven't spent much time doing testing of those scenarios yet unfortunately.

I'll try and spend some time working on improving the component over the next few days to handle disconnections more gracefully.

Cheers, Andrew

TylerTheFox commented 5 years ago

This issue sometimes takes multiple restarts (5 is the most I've seen) of hass to fix the unavailable issue after wifi disconnection/device restart.

mattsaxon commented 5 years ago

I believe I've fixed this in latest PR here https://github.com/beveradb/pysonofflan/pull/48