Beispiel #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
            });
        }
Beispiel #2
0
        public async Task <bool> IsTurnOn()
        {
            await _smartBulbService.Initialize();

            return(await _smartBulbService.IsTurnOn());
        }