Hi!
I need little help!
I wrote a C # program to manage eight relays.
I created the switches with the following code:
Program.AddVirtualModules ("HomeAutomation.SettingSwitch", "Switch", "homegenie / generic / switch", 1, 8);
The relays status every 5 seconds retrieves, and attempts to set the virtual switch status of the returned value ("status level").
I can look at the states with the following code:
var SettingSwitchModules = Modules.InDomain("HomeAutomation.SettingSwitch");
for (int i = 0; i < 8; i++)
{
var module = SettingSwitchModules.WithAddress((8-i).ToString()).Get();
if ((module.Parameter("Status.Level").DecimalValue).ToString() != relayarray[i].ToString())
{
if ((module.Parameter("Status.Level").DecimalValue).ToString() =="1")
{
Program .Notify("Switch","You need to turn OFF the relay "+(8-i).ToString()");
}
}
}
How do I the state of the virtual switches (status level) change?