public void Tick(Trigger trigger) { var now = CommonTime.GetTimeOfDay(_dateTime.Now); var onOrOff = (now, trigger.TriggerType) switch { (_, TriggerType.OnButtonPressed) => true, (_, TriggerType.OffButtonPressed) => false, (CommonTimes.Morning, TriggerType.DoorOpened) => true, (CommonTimes.Evening, TriggerType.DoorOpened) => true, (CommonTimes.Evening, TriggerType.DoorClosed) => false, (CommonTimes.Night, TriggerType.MotionDetected) => true, _ => false }; _light.Set(onOrOff); }