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(); } }
public virtual void Thermostat_FanModeSet(FanMode mode) { this.nodeHost.SendRequest(new byte[] { (byte)CommandClass.ThermostatFanMode, (byte)Command.BasicSet, (byte)mode }); }
public async Task <WebServiceResult> SetFanModeAsync(Thermostat thermostat, FanMode fanMode) { string url = string.Format(@"{0}/v2/put/device.{1}", _sessionProvider.TransportUrl, thermostat.ID); string fanModeString = GetFanModeString(fanMode); string requestString = string.Format("{{\"fan_mode\":\"{0}\"}}", fanModeString); return(await SendPutRequestAsync(url, requestString)); }
public virtual void Thermostat_FanModeSet(FanMode mode) { this.nodeHost.SendRequest(new byte[] { (byte)CommandClass.COMMAND_CLASS_THERMOSTAT_FAN_MODE, (byte)Command.COMMAND_BASIC_SET, (byte)mode }); }
public static void SetFanMode(ZWaveNode node, FanMode mode) { node.SendRequest(new byte[] { (byte)CommandClass.ThermostatFanMode, (byte)Command.BasicSet, (byte)mode }); }
/// <summary> /// Set Fan Speed StandartSpeed/FullSpead/OptimalSpeed/HeavyIOSpeed /// </summary> /// <param name="fanmode"></param> /// <returns></returns> public string SetFanMode(FanMode fanmode) { proc.StartInfo.Arguments = this.sBaseString + "ipmi fan " + Convert.ToInt32(fanmode); proc.Start(); proc.WaitForExit(); string sLine = proc.StandardOutput.ReadToEnd().Trim(); return(sLine); }
private static string GetFanModeString(FanMode fanMode) { if (fanMode == FanMode.Auto) { return("auto"); } if (fanMode == FanMode.On) { return("on"); } throw new InvalidOperationException(); }
public void RequestFanMode(FanMode action) { if (action == FanMode.Toggle) { if (FanOutput) { PendingCommands.Add(new UsbCommand((byte)FanMode.Off)); } else { PendingCommands.Add(new UsbCommand((byte)FanMode.On)); } } else { PendingCommands.Add(new UsbCommand((byte)action)); } }
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(); }); }
public FanMode SetSpeedFan(string setting) { switch (setting) { case "slow": SpeedFan = FanMode.slow; return(SpeedFan); case "medium": SpeedFan = FanMode.medium; return(SpeedFan); case "hight": SpeedFan = FanMode.hight; return(SpeedFan); default: SpeedFan = FanMode.off; return(SpeedFan); } }
public string SetMode(string setting) { if (State) { switch (setting) { case "slow": Mode = ColdFan.SetSpeedFan("slow"); return("conditioner fan speed set: " + Mode); case "medium": Mode = ColdFan.SetSpeedFan("medium"); return("conditioner fan speed set: " + Mode); case "hight": Mode = ColdFan.SetSpeedFan("hight"); return("conditioner fan speed set: " + Mode); } } Mode = ColdFan.SetSpeedFan("off"); return("conditioner fan speed set: " + Mode); }
public Control(ISensor sensor, ISettings settings, float minSoftwareValue, float maxSoftwareValue) { this.identifier = new Identifier(sensor.Identifier, "control"); this.settings = settings; this.minSoftwareValue = minSoftwareValue; this.maxSoftwareValue = maxSoftwareValue; //fan add this.sensorType = sensor.SensorType; float softValue = 0; if (!float.TryParse(settings.GetValue( new Identifier(identifier, "value").ToString(), "-a"), NumberStyles.Float, CultureInfo.InvariantCulture, out softValue)) { this.softwareValue = 0; if (this.sensorType.Equals(SensorType.TinyFanControl)) { this.SoftwareValue = 50; //init value(when .config was not exist) } } else { this.softwareValue = softValue; } int mode; if (!int.TryParse(settings.GetValue( new Identifier(identifier, "mode").ToString(), ((int)ControlMode.Default).ToString(CultureInfo.InvariantCulture)), NumberStyles.Integer, CultureInfo.InvariantCulture, out mode)) { this.mode = ControlMode.Default; } else { this.mode = (ControlMode)mode; } int fanMode; if (!int.TryParse(settings.GetValue( new Identifier(identifier, "fanMode").ToString(), ((int)FanMode.Pin4).ToString(CultureInfo.InvariantCulture)), NumberStyles.Integer, CultureInfo.InvariantCulture, out fanMode)) { this.fanMode = FanMode.Pin4; } else { this.fanMode = (FanMode)fanMode; } int fanFollow;//again if (!int.TryParse(settings.GetValue( new Identifier(identifier, "fanFollow").ToString(), ((int)FanFollow.NONE).ToString(CultureInfo.InvariantCulture)), NumberStyles.Integer, CultureInfo.InvariantCulture, out fanFollow)) { this.fanFollow = FanFollow.NONE; } else { this.fanFollow = (FanFollow)fanFollow; } }
public void SetTheFanMode(FanMode fanMode) { FanMode = fanMode; }
public Control(ISensor sensor, ISettings settings, float minSoftwareValue, float maxSoftwareValue) { this.identifier = new Identifier(sensor.Identifier, "control"); this.settings = settings; this.minSoftwareValue = minSoftwareValue; this.maxSoftwareValue = maxSoftwareValue; //fan add this.sensorType = sensor.SensorType; float softValue = 0; if (!float.TryParse(settings.GetValue( new Identifier(identifier, "value").ToString(), "-a"), NumberStyles.Float, CultureInfo.InvariantCulture, out softValue)){ this.softwareValue = 0; if (this.sensorType.Equals(SensorType.TinyFanControl)) this.SoftwareValue = 50; //init value(when .config was not exist) } else this.softwareValue = softValue; int mode; if (!int.TryParse(settings.GetValue( new Identifier(identifier, "mode").ToString(), ((int)ControlMode.Default).ToString(CultureInfo.InvariantCulture)), NumberStyles.Integer, CultureInfo.InvariantCulture, out mode)) { this.mode = ControlMode.Default; } else { this.mode = (ControlMode)mode; } int fanMode; if (!int.TryParse(settings.GetValue( new Identifier(identifier, "fanMode").ToString(), ((int)FanMode.Pin4).ToString(CultureInfo.InvariantCulture)), NumberStyles.Integer, CultureInfo.InvariantCulture, out fanMode)) { this.fanMode = FanMode.Pin4; } else { this.fanMode = (FanMode)fanMode; } int fanFollow;//again if (!int.TryParse(settings.GetValue( new Identifier(identifier, "fanFollow").ToString(), ((int)FanFollow.NONE).ToString(CultureInfo.InvariantCulture)), NumberStyles.Integer, CultureInfo.InvariantCulture, out fanFollow)) { this.fanFollow = FanFollow.NONE; } else { this.fanFollow = (FanFollow)fanFollow; } }
public async Task SetFanMode(string icd, FanMode mode) => await _hubProxy.Invoke("SetFanMode", icd, mode.ToString());
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(); }); }
public async Task<WebServiceResult> SetFanModeAsync(Thermostat thermostat, FanMode fanMode) { string url = string.Format(@"{0}/v2/put/device.{1}", _sessionProvider.TransportUrl, thermostat.ID); string fanModeString = GetFanModeString(fanMode); string requestString = string.Format("{{\"fan_mode\":\"{0}\"}}", fanModeString); return await SendPutRequestAsync(url, requestString); }
private static string GetFanModeString(FanMode fanMode) { if (fanMode == FanMode.Auto) return "auto"; if (fanMode == FanMode.On) return "on"; throw new InvalidOperationException(); }