more G-Labs products

Author Topic: Communicating with the dashboard widgets  (Read 489 times)

September 06, 2016, 12:20:32 AM
Read 489 times

IanR

  • **
  • Information
  • Jr. Member
  • Posts: 31
Hello
I am trying to learn how to code in c# and Hg.
I have written a code using the examples I have found, to communicate with my Arduino (to and from). I can see the communications in the activity bubble in the top right. But the widget on the dashboards will not change with the change of input.
Please can you have a look at the code and see where I am going wrong.

Code: [Select]
Action<string>
HandleStringReceived = (string message) => {
Program.Notify("X10 Auto Bright", "Arduino" + "<br>" + "Com6" + " " + message); // write to bubble
const string Dashboard = "HomeAutomation.Dashboard";
  if (message == "on")
    {
Program.AddVirtualModules("HomeAutomation.Dashboard", "light", "homegenie/generic/light", 1, 1); // change widget states
    Program.Notify("X10 Auto Bright", "Arduino" + "<br>" + "Com6" + " " + "Set on"); // write to bubble
  }
    if (message == "off")
    {
Program.AddVirtualModules("HomeAutomation.Dashboard", "light", "homegenie/generic/light", 0, 0); // change widget states
    Program.Notify("X10 Auto Bright", "Arduino" + "<br>" + "Com6" + " " + "Set off"); // write to bubble
  }
};

Thanks
Ian



There are no comments for this topic. Do you want to be the first?