Skip to content
State machine (FSM) templates

Thermostat (State Machine)

Heating and cooling around a setpoint.

Template previewState machine (FSM)
Thermostat3 states · 4 transitions · 3 eventstemp_below_setpointtemp_reachedtemp_above_setpointtemp_reachedIdleHeatingCoolingAll 3 states are reachable and every transition names states that exist.INFONo state is marked `final`, so this machine never terminates. That is ordinary for a reactive controller and a smellfor a workflow.OKAll 3 states are reachable from `Idle`.OKAll 4 transitions name states that exist, so every arrow in the figure is drawn.

Make it your own.

title "Thermostat"
state Idle
state Heating
state Cooling
initial Idle
transition Idle -> Heating on "temp_below_setpoint"
transition Heating -> Idle on "temp_reached"
transition Idle -> Cooling on "temp_above_setpoint"
transition Cooling -> Idle on "temp_reached"