Example #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();
            }
        }
Example #2
0
 public virtual void Thermostat_FanModeSet(FanMode mode)
 {
     this.nodeHost.SendRequest(new byte[] {
         (byte)CommandClass.ThermostatFanMode,
         (byte)Command.BasicSet,
         (byte)mode
     });
 }
Example #3
0
        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));
        }
Example #4
0
 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
     });
 }
Example #5
0
 public static void SetFanMode(ZWaveNode node, FanMode mode)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.ThermostatFanMode,
         (byte)Command.BasicSet,
         (byte)mode
     });
 }
Example #6
0
        /// <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);
        }
Example #7
0
        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));
     }
 }
Example #9
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();
            });
        }
Example #10
0
        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);
            }
        }
Example #11
0
        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);
        }
Example #12
0
        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;
            }
        }
Example #13
0
 public void SetTheFanMode(FanMode fanMode)
 {
     FanMode = fanMode;
 }
Example #14
0
 public static void SetFanMode(ZWaveNode node, FanMode mode)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.ThermostatFanMode,
         (byte)Command.BasicSet,
         (byte)mode
     });
 }
Example #15
0
        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;
              }
        }
Example #16
0
 public async Task SetFanMode(string icd, FanMode mode) => await _hubProxy.Invoke("SetFanMode", icd, mode.ToString());
Example #17
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();
			});
		}
Example #18
0
 public void SetTheFanMode(FanMode fanMode)
 {
     FanMode = fanMode;
 }
Example #19
0
		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);
		}
Example #20
0
		private static string GetFanModeString(FanMode fanMode) {
			if (fanMode == FanMode.Auto)
				return "auto";
			if (fanMode == FanMode.On)
				return "on";

			throw new InvalidOperationException();
		}
Example #21
0
 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
     });
 }