Ability to directly set state (from HA) WITH on_enter
automation run
#35
Labels
enhancement
New feature or request
on_enter
automation run
#35
On
state_machine.set
Action docs:It would be great if we could have an option to directly set the state but still activate (at least) the
on_enter
, of the inputs and transitions.The use case here is a state machine with many complex states and transitions for a light switch with PIR motion sensor and led indicator light per switch. I want to push a HA dashboard button to set a mode/state directly. ie turn off motion mode, etc ect.
Without the above I would have to write complex logic in the device (using
state_machine.state
etc) to first check what the current state of the machine is, and determine what sequence of transitions I need to action to arrive at the desired new state. It is like I have to write all possible state transitions again, not being DRY, and breaking when state machine logic is changed.I need the
on_enter
automation to run as it sets the light, sets the indicator led to show the mode etc etc.I cannot easily just use the
state_machine.transition
Action in my case as the transition action would be dependent on the current state.Currently I guess an easier way would be to have more simple logic determining the
state_machine.transition
Action required to reach the desired new state based on the current state, however this may sill break if the state machine logic is updated, and would still be complex on complex state machines.For reference this is my project: https://community.home-assistant.io/t/australian-light-switch-with-motion-sensor-local-control-show-and-tell/444612
The text was updated successfully, but these errors were encountered: