markoo
November 3, 2017, 9:26pm
1
Hello!
I was looking how to connect my MQTT broker with homegenie. I connect it. But i don’t know and I didn’t find any example to make a widget like a switch widget that will publish topic to my MQTT broker that is my light turned off or on. Can anyone help me or give me an advice how to do that?
Many thanks and kind regards,
Marko
Its something I have done, but I dont think i’ve committed the later version of this repo… but some info in here:
<?xml version="1.0" encoding="utf-16"?>
<ProgramBlock xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ConditionType>OnTrue</ConditionType>
<Conditions />
<Commands />
<ScriptCondition>Program.Setup(()=>
{
Program.AddOption("ClientId", System.Environment.MachineName, "0. Enter unique ID for this client", "text");
Program.AddOption("ServerAddress", "", "MQTT server address (Do not use 127.0.0.1)", "text");
Program.AddOption("ServerPort", "1883", "MQTT server port", "text");
Program.AddOption("ServerTopic", "home/espgenie", "Topic", "text");
});
//
return true;</ScriptCondition>
<ScriptSource>string server = Program.Option("ServerAddress").Value.Trim();
int port = 1883;
int.TryParse(Program.Option("ServerPort").Value, out port);
string topic = Program.Option("ServerTopic").Value.Trim();
// string topic = "#"; // listen all
string clientid = Program.Option("ClientId").Value.Trim();
This file has been truncated. show original