One way, focusing on the light and button. Viewing the power system as a separate concern.
| current State | event | new State |
|---------------|--------------|-----------|
| Unpowered | press button | Unpowered |
| Unpowered | powered | Off |
| Off | press button | On |
| Off | unpowered | Unpowered |
| On | press button | Off |
| On | unpowered | Unpowered |
You could go further and model the battery state as well... But it itself has no relevance to the state of the light.
You can also fill in the other events combinations, I'm going with undefined => no change in state from event, as this is a controller, not a verifier fsm.
We can flip it so that processes (like on/off) are the events themselves, where as above they were the states.
| current State | event | new State |
|-------------------------------------|----------|-----------------------------------------|
| Not Pressed,Plugged In,Battery Flat | On | Pressed,Plugged In,Battery Flat |
| Not Pressed,Plugged In,Battery Flat | Charging | Not Pressed,Plugged In,Battery not Flat |
| Pressed,Plugged In,Battery Flat | Off | Not Pressed,Unplugged,Battery Flat |
| Pressed,Plugged In,Battery Flat | Off | Not Pressed,Plugged In,Battery Flat |
...
Notice that this one isn't deterministic, the event "Off" implies two possible states, from the same starting state.