muxa / esphome-state-machine

ESPHome State Machine component
MIT License
74 stars 7 forks source link

Ability to set initial_state dynamically #7

Open muxa opened 3 years ago

muxa commented 3 years ago

When controlling, for instance, light wit a state machine, the light state will be restored from HA, but the state machine won't be. We need a way to restore state machine initial state somehow.

muxa commented 2 years ago

Looks like this can be achieved by making initial_state templatable.

majkrzak commented 1 year ago

It can also be perserved in the rtc memory, like in light component for example: https://github.com/esphome/esphome/blob/6919930aaa230f0437d0975d902e98cc7dbbf11f/esphome/components/light/light_state.cpp#L59