コード例 #1
0
        public static Fan_Device ConvertToFanDevice(MyStromResponse objectToConvert)
        {
            Fan_Device fanIn = new Fan_Device
            {
                Id            = 3,
                Name          = "UmLuft",
                Icon          = "~/content/images/fan.png",
                Power         = objectToConvert.power.ToString("0.00") + " Watt",
                Relay         = objectToConvert.relay.ToString(),
                DeviceIsInUse = "Nein",
                PowerValue    = objectToConvert.power
            };

            if (objectToConvert.relay && objectToConvert.power > _tresholdValue)
            {
                fanIn.DeviceIsInUse = "Ja";
            }

            return(fanIn);
        }
コード例 #2
0
        public static Suction_Device ConvertToSuctionDevice(MyStromResponse objectToConvert)
        {
            Suction_Device suction = new Suction_Device
            {
                Id            = 4,
                Name          = "AbLuft",
                Icon          = "~/content/images/blowout.png",
                Power         = objectToConvert.power.ToString("0.00") + " Watt",
                Relay         = objectToConvert.relay.ToString(),
                DeviceIsInUse = "Nein",
                PowerValue    = objectToConvert.power
            };

            if (objectToConvert.relay && objectToConvert.power > _tresholdValue)
            {
                suction.DeviceIsInUse = "Ja";
            }

            return(suction);
        }
コード例 #3
0
        public static Watering_Device ConvertToWateringDevice(MyStromResponse objectToConvert)
        {
            Watering_Device light = new Watering_Device
            {
                Id            = 5,
                Name          = "Bewässerung",
                Power         = objectToConvert.power.ToString("0.00") + " Watt",
                Relay         = objectToConvert.relay.ToString(),
                RainInMin     = "1 Minute / 75 ml",
                Icon          = "~/content/images/no-rain.png",
                DeviceIsInUse = "Nein",
                PowerValue    = objectToConvert.power
            };

            if (objectToConvert.relay && objectToConvert.power > _tresholdValue)
            {
                light.Icon          = "~/content/images/rain.png";
                light.DeviceIsInUse = "Ja";
            }

            return(light);
        }
コード例 #4
0
        public static Light_Device ConvertToLightDevice(MyStromResponse objectToConvert)
        {
            Light_Device light = new Light_Device
            {
                Id            = 1,
                Name          = "SanLight Q5W",
                Power         = objectToConvert.power.ToString("0.00") + " Watt",
                Relay         = objectToConvert.relay.ToString(),
                Temp          = objectToConvert.temperature.ToString("0.00") + " °C",
                Icon          = "~/content/images/light-off.png",
                DeviceIsInUse = "Nein",
                PowerValue    = objectToConvert.power
            };

            if (objectToConvert.relay && objectToConvert.power > _tresholdValue)
            {
                light.Icon          = "~/content/images/light-on.png";
                light.DeviceIsInUse = "Ja";
            }

            return(light);
        }