Closed ETYFun closed 2 months ago
I think this is a duplicate of #41 . This example seems rather contrived though, can you explain what you're actually trying to do here? You can't trigger a state transition in an output, but then, this only provides one external method call (the press_button
at the bottom) so I'm not sure why a state machine would be helpful to you at all for this example.
@glyph I'm trying to trigger a state transition based on internal timer or any conditional triggers. Not sure if the automat was originally developed for finite state machines or agents.
A timer cannot be "internal" to the automat state machine, unless you're literally talking about time.sleep.
The usual solution here is a private input method with a public method that does the transition around it, but I think I would need a much more comprehensive picture of the actual application you are trying to build here, not just "internal state transition" or "conditional trigger". You can implement a conditional trigger in Python as an if
statement so at that level it's not clear how that fits in to the state machine itself.
Similar to #72 this should now be addressed by https://automat.readthedocs.io/en/latest/tutorial.html#conditional-state-transitions
I'm a novice trying to create an internally triggered state transition but was unsuccessful. Is there any way to trigger a state transition within the state machine instead of relying on external commands?
Here's my example timer code that should ring after 5 seconds:
This code does not trigger a state transition to _dormant state (by _stop_timer). Please show me a way to correct this.
Thank you