protected override async Task Handle() { if (_evt.IsOffEvent && IsBedtime) { await _bedroomLights.On(); } }
protected override async Task Handle() { if (_frontDoorLock.Status == LockStatus.Unlocked) { DateTime sunsetTime = await _weather.SunsetTime(); var currTime = DateTime.Now; if (currTime > (sunsetTime.AddHours(-1.5))) { await _livingRoomLight.On(); await _livingRoomLight.SetBrightness(100); } } }
protected override async Task Handle() { if (_evt.IsButtonPushedEvent) { var brightness = _livingRoomLight.Brightness; var currTime = DateTime.Now; switch (_evt.Value) { case "1": await _livingRoomLight.On(); if (currTime.Hour > 5 && currTime.Hour < 8) { await _livingRoomLight.SetBrightness(80); await _livingRoomLight.SetColor(12, 80); await _alexaLivingRoom.Speak($"Good morning Jacob. The current forecast is {_weather.CurrentCondition()}. The temperature outside is {_weather.TemperatureFeelsLike()}."); } else { await _livingRoomLight.SetBrightness(100); } break; case "2": if (brightness <= 80) { await _livingRoomLight.SetBrightness(brightness + 20); } else { await _livingRoomLight.SetBrightness(100); } break; case "3": if (brightness > 20) { await _livingRoomLight.SetBrightness(brightness - 20); } else if (brightness > 10) { await _livingRoomLight.SetBrightness(brightness - 10); } else { await _livingRoomLight.SetBrightness(1); } break; case "4": await _livingRoomLight.Off(); if (currTime.Hour > 6 && currTime.Hour < 8) { await _frontDoorLock.Unlock(); } break; } } }