For the past months I have used my own ha-fsm to control/monitor everything from my alarm system to pool control and energy consumption.
ha-fsm is a generic add-on to appdaemon which allows the user to define States, Transitions between them, and Conditions to say when the Transisitions are valid/true.
Actions can be any python code you like, and they are triggered when a Transistion is activated, or a State is entered and/or left
Last it also allows you to visualize the state machine graphically, which is great for debugging/understanding.
Go see the details and find out if it is something for you:
/Peter