muxa / esphome-state-machine

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

I can't get initial_state to work #37

Closed matsekberg closed 1 year ago

matsekberg commented 1 year ago

Declaration with initial state STOPPAD:

state_machine:

When starting up state is set to STARTAR:

[16:03:54][C][state_machine:032]: State Machine 'On/Off Toggle State Machine' [16:03:54][C][state_machine:034]: Current State: STARTAR [16:03:54][C][state_machine:036]: States: 4

[16:03:54][C][state_machine:042]: Inputs: 2

[16:03:54][C][state_machine:048]: Transitions: 2 [16:03:54][C][state_machine:051]: STARTA: STOPPAD -> STARTAR [16:03:54][C][state_machine:051]: STOPPA: STARTAD -> STOPPAR

and later:

[16:14:12][W][state_machine:101]: STARTA: no transition from STARTAR [16:14:14][W][state_machine:101]: STOPPA: no transition from STARTAR

matsekberg commented 1 year ago

If I move STOPPED to the first state position, same result, always STARTAR is set as initial:

[16:09:48][C][state_machine:032]: State Machine 'On/Off Toggle State Machine' [16:09:48][C][state_machine:034]: Current State: STARTAR [16:09:48][C][state_machine:036]: States: 4 [16:09:48][C][state_machine:039]: STOPPAD

[16:09:48][C][state_machine:042]: Inputs: 2

[16:09:48][C][state_machine:048]: Transitions: 2 [16:09:48][C][state_machine:051]: STARTA: STOPPAD -> STARTAR [16:09:48][C][state_machine:051]: STOPPA: STARTAD -> STOPPAR

matsekberg commented 1 year ago

My bad, the initial_state worked, missed some lines in the log :(