Beispiel #1
0
        public void Poll()
        {
            var type = typeof(TMeasurement);

            if (type.IsAssignableFrom(typeof(IPower)))
            {
                _device.DoCommand("PollPower");
                return;
            }

            if (type.IsAssignableFrom(typeof(ITemperature)))
            {
                _device.DoCommand("PollTemperature");
                return;
            }

            if (type.IsAssignableFrom(typeof(IHumidity)))
            {
                _device.DoCommand("PollHumidity");
                return;
            }

            if (type.IsAssignableFrom(typeof(IIlluminance)))
            {
                _device.DoCommand("PollIlluminance");
                return;
            }

            throw new NotImplementedException();
        }
Beispiel #2
0
        public void SetPower(BinarySwitchPower power)
        {
            switch (power)
            {
            case BinarySwitchPower.On:
                _device.DoCommand("PowerOn");
                break;

            case BinarySwitchPower.Off:
                _device.DoCommand("PowerOff");
                break;
            }
        }
Beispiel #3
0
 public void SetSetpoint(ThermostatSetpointType setpointType, ITemperature temperature)
 {
     _device.DoCommand("SetSetpoint", "Setpoint", setpointType.ToString(), "Temperature", temperature.ToString());
 }
Beispiel #4
0
 public void Poll()
 {
     _device.DoCommand("PollBinarySensor");
 }
Beispiel #5
0
 public void SetMode(ThermostatMode mode)
 {
     _device.DoCommand("SetThermostatMode", "ThermostatMode", mode.ToString());
 }
Beispiel #6
0
 public void SetPower(int power)
 {
     _device.DoCommand("Dim", "Power", power.ToString());
 }
Beispiel #7
0
 public void SetValue(IColor color)
 {
     _device.DoCommand("SetColor", "Color", color.ToHexString());
 }