Ejemplo n.º 1
0
        private async void SetFanModeAsync(FanMode fanMode)
        {
            var thermostat = GetFirstThermostat();

            if (thermostat.FanMode == fanMode)
            {
                return;
            }

            try {
                _statusProvider.Stop();

                thermostat.FanMode = fanMode;
                var result = await _nestWebService.SetFanModeAsync(thermostat, fanMode);

                if (_exceptionHandler.IsErrorHandled(result.Error, result.Exception))
                {
                    return;
                }

                await _statusUpdater.UpdateStatusAsync();
            }
            finally {
                _statusProvider.Start();
            }
        }
Ejemplo n.º 2
0
        private async void SetFanModeAsync(FanMode fanMode)
        {
            var thermostat = GetFirstThermostat();

            if (thermostat.FanMode == fanMode)
            {
                return;
            }

            await PauseStatusProviderWhile(async() => {
                thermostat.FanMode = fanMode;
                var result         = await _nestWebService.SetFanModeAsync(thermostat, fanMode);
                if (IsErrorHandled(result.Error, result.Exception))
                {
                    return;
                }

                await _statusUpdater.UpdateStatusAsync();
            });
        }