Implement a basic state machine and make it work with alarms and presets.