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

Update state in Home Assistant correctly when changed by device #10

Closed beveradb closed 5 years ago

beveradb commented 5 years ago

As discussed in #7 - state is currently not handled at all, and in fact messages sent by the Sonoff device on the websocket connection are not ever even received as the connection isn't currently retained.

This PR is to implement a bare-minimum functional solution to solve this, so users can press the physical button(s) on their device and have the state update correctly in Home Assistant.

beveradb commented 5 years ago

It works! Merging now, since the existing code is dreadful and this is infinitely better. I'd like future updates to go through some sort of code review if possible, but since nobody else is working on this yet I'm not sure how that would work.