Ejemplo n.º 1
0
        public async Task <DashboardData> Dashboard()
        {
            var nowPlaying = await NowPlaying();

            var currentInput = await _smartHouseService.GetCurrentState();

            var telemetryData = await _telemetryService.GetLastTemperature();

            var isTurnOn = (await _yamahaService.PowerStatus()) == PowerStatusEnum.On;
            var volume   = await _yamahaService.GetVolume();

            var isLightsTurnOn = await _smartBulbService.IsTurnOn();

            var isAirConditionerTurnOn = (await _telemetryService.GetAirConditionState()) == 1;

            return(new DashboardData
            {
                NowPlaying = nowPlaying,
                CurrentInput = currentInput.ToString(),
                TelemetryData = telemetryData,
                IsTurnOn = isTurnOn,
                Volume = volume,
                IsAirConditionerTurnOn = isAirConditionerTurnOn,
                IsLightsTurnOn = isLightsTurnOn
            });
        }
Ejemplo n.º 2
0
        public async Task Up()
        {
            var smartHouseState = await SmartHouseService.GetCurrentState();

            if (smartHouseState == SmartHouseState.Pandora)
            {
                var result = PandoraService.NextStation();

                NotifyClients();
                PushNotification(result.Message);
            }
            else if (smartHouseState == SmartHouseState.TV)
            {
                await TVService.Up();
            }
        }