Example #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");
            }
        }
Example #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");
            }
        }
Example #3
0
        public void SetRollerPosition(int Pos)
        {
            IsRoller = true;

            if (Pos < 0)
            {
                Pos = 0;
            }

            if (Pos > 100)
            {
                Pos = 100;
            }

            MQTT.Publish(string.Format("shellies/{0}/roller/0/command/pos", ID), Pos.ToString());
        }
Example #4
0
        static void SendMQTT_Shelly25(string ID, bool SW)
        {
            Counter1++;
            bool Shelly25_Bool1 = true;

            if (Counter1 > 2)
            {
                Shelly25_Bool1 = false;

                if (Counter1 > 4)
                {
                    Counter1 = 0;
                }
            }

            MQTT.Publish(string.Format("shellies/shellyswitch25-{0}/input/{1}", ID, Shelly25_Bool1 ? "1" : "0"), SW ? "on" : "off");
            Thread.Sleep(25);
            MQTT.Publish(string.Format("shellies/shellyswitch25-{0}/relay/{1}", ID, Shelly25_Bool1 ? "1" : "0"), SW ? "on" : "off");
        }
Example #5
0
        static void Main(string[] args)
        {
            //Test();
            //return;

            Logging.Init();
            Tasks.Init();
            SmartHome.Init();
            ActionsParser.Init();
            MQTT.Init();

            NancyHost Host = new NancyHost(new Uri("http://localhost:8080"));

            Host.Start();

            //Application.EnableVisualStyles();
            //Application.Run(new MainForm());

            while (true)
            {
                Tasks.Tick();
                Thread.Sleep(250);
            }
        }
Example #6
0
 static void SendMQTT_ShellyDW(string ID, bool State)
 {
     MQTT.Publish(string.Format("shellies/shellydw2-{0}/sensor/state", ID), State ? "open" : "closed");
 }
Example #7
0
 static void SendMQTT_Shelly1(string ID, bool SW)
 {
     MQTT.Publish(string.Format("shellies/shelly1-{0}/input/0", ID), SW ? "on" : "off");
     Thread.Sleep(25);
     MQTT.Publish(string.Format("shellies/shelly1-{0}/relay/0", ID), SW ? "on" : "off");
 }
Example #8
0
 public virtual void ForceUpdate()
 {
     MQTT.Publish(string.Format("shellies/{0}/command", ID), "update");
 }
Example #9
0
 public void Calibrate()
 {
     IsRoller = true;
     MQTT.Publish(string.Format("shellies/{0}/roller/0/command", ID), "rc");
 }