Beispiel #1
0
        public override void Toggle(bool On)
        {
            MQTT.Publish(string.Format("shellies/{0}/relay/0/command", ID), On ? "on" : "off");

            if (Program.TEST)
            {
                RelayValue = On ? "on" : "off";
                SmartHome.BroadcastChange(this, "relay/0");
            }
        }
Beispiel #2
0
        public void Stop()
        {
            IsRoller = true;
            MQTT.Publish(string.Format("shellies/{0}/roller/0/command", ID), "stop");

            if (Program.TEST)
            {
                RollerState = "stop";
                SmartHome.BroadcastChange(this, "roller/0");
            }
        }
Beispiel #3
0
        public virtual void ReceiveUpdateProperty(string Name, string StrValue)
        {
            LastUpdate = DateTime.Now;

            for (int i = 0; i < Properties.Length; i++)
            {
                if (Properties[i].PropertyName == Name)
                {
                    object Value = Utils.ParseType(Properties[i].PropertyType, StrValue);

                    if (Properties[i].Get() != Value)
                    {
                        Properties[i].Set(Value);

                        SmartHome.BroadcastChange(this, Name);
                    }
                }
            }
        }