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"); } }
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"); } }
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()); }
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"); }
static void SendMQTT_ShellyDW(string ID, bool State) { MQTT.Publish(string.Format("shellies/shellydw2-{0}/sensor/state", ID), State ? "open" : "closed"); }
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"); }
public virtual void ForceUpdate() { MQTT.Publish(string.Format("shellies/{0}/command", ID), "update"); }
public void Calibrate() { IsRoller = true; MQTT.Publish(string.Format("shellies/{0}/roller/0/command", ID), "rc"); }