public async Task <Result> TurnOff() { var sb = new StringBuilder(); var powerStatus = await _yamahaService.PowerStatus(); PushNotification("Please wait..."); if (await _playerService.IsPlaying()) { _playerService.Stop(); sb.AppendLine("Stoping radio"); } if (_mpdService.GetStatus().State == Libmpc.MpdState.Play) { _mpdService.Stop(); sb.AppendLine("Stopping MPD"); } if (powerStatus == PowerStatusEnum.On) { await Task.Delay(TimeSpan.FromSeconds(1)); await _yamahaService.TurnOff(); sb.AppendLine("Yamaha Turn Off"); await _tvService.Power(); } if (await _telemetryService.GetAirConditionState() == 1) { await _telemetryService.AirCondition(0); } if (await _sunriseSunsetService.IsNight()) { await _smartBulbService.Initialize(); await _smartBulbService.TurnOff(); } NotifyClients(); PushNotification("Smart house is turn off"); return(new Result() { ErrorCode = 0, Message = sb.ToString(), Ok = true }); }
public async Task <string> TurnOff() { return(await YamahaService.TurnOff()); }