How to monitor a switch's state and do X if switch has remained in state B