private async void SetHvacModeAsync(HvacMode hvacMode) { var thermostat = GetFirstThermostat(); if (thermostat.HvacMode == hvacMode) { return; } try { _statusProvider.Stop(); thermostat.HvacMode = hvacMode; var result = await _nestWebService.SetHvacModeAsync(thermostat, hvacMode); if (_exceptionHandler.IsErrorHandled(result.Error, result.Exception)) { return; } await _statusUpdater.UpdateStatusAsync(); } finally { _statusProvider.Start(); } }
private async void SetHvacModeAsync(HvacMode hvacMode) { var thermostat = GetFirstThermostat(); if (thermostat.HvacMode == hvacMode) { return; } await PauseStatusProviderWhile(async() => { thermostat.HvacMode = hvacMode; var result = await _nestWebService.SetHvacModeAsync(thermostat, hvacMode); if (IsErrorHandled(result.Error, result.Exception)) { return; } await _statusUpdater.UpdateStatusAsync(); }); }