slashback100 / presence_simulation

Home Assistant Presence Simulation
423 stars 22 forks source link

Communicate on/off state changes to ha state machine (#79) #80

Closed slashback100 closed 1 year ago

slashback100 commented 1 year ago

Manually turning off a presence simulation does not seem to reliably persist across HA restarts. I think the issue is that the calls to internal_turn_on / internal_turn_off update self._state, but don't communicate that state change to the HA state machine via self.async_write_ha_state(). And so if HA restarts, _restore_state_sync won't see the state change.

This patch fixes that by calling self.async_write_ha_state() inside the turn_on/turn_off routines.