elric91 / homeassistant_zigate

Custom components for Home Assistant
MIT License
22 stars 5 forks source link

Add restore_state support for sensors #22

Closed cmorlok closed 6 years ago

cmorlok commented 6 years ago

A lot of sensors (i.e. the Xiaomi temperature sensors) send state updates only if the data has changed. There is no way to poll the current state. Thus, after a restart of home assistant, it can take hours or even days until a value is available.

Use the restore_state (together with the recorder component) to set the state initially to the last known value.

cmorlok commented 6 years ago

Somehow this breaks the state machine. I see the updated states in /dev-state, but no subsequent templates get updated.

elric91 commented 6 years ago

Very interesting and clearly the way we should head on Can you raise a hand when you think it is stabilized : I will merge and pack a new release ASAP as it has been awaited by several users (sorry, do not have yet the time to dig in the state machine problem)

cmorlok commented 6 years ago

It turned out that the issue with the state machine is not related to the restore_state change, see #23.

The change looks good so far, but I will do some more testing.

max5962 commented 6 years ago

Any news about that pull request ?

elric91 commented 6 years ago

I'll have a look at it this WE

cmorlok commented 6 years ago

Have been using this for more than a month now without any issues.

max5962 commented 6 years ago

Is it possible to accept this pull request ? :)

acesyde commented 6 years ago

Oh yeah please accept it, after restart I can't retrieve values :(