Automation Light Level for Roller Shutter - Solved

9 years 6 months ago #1382 by osalval
Add code for someone need Light Level control for a Roller Shutter using 2 relays.

/*
Light Level control TV
*/
int ThresholdHIGH = 520; // HIGH Threshold
int ThresholdLOW = 420; // LOW Threshold

public void Setup()
{
EventHelper.ModuleChangedHandler((o, m, p) =>
{
if (m.Domain == Domains.MYSENSORS && m.Address == "N23S1" && p.Property == "Sensor.LightLevel")
{
Console.WriteLine(m.Address + " in program id " + Program.ProgramId.ToString() + " property " + p.Property + " value " + p.Value);
ModuleParameter LL = ModuleHelper.GetProperty(Domains.MYSENSORS, "N23S1", "Sensor.LightLevel");
Console.WriteLine("Light Level: " + LL.DecimalValue);
if (LL.DecimalValue > ThresholdHIGH) {
Console.WriteLine("Light Level HIGH: " + LL.DecimalValue);
DriverHelper.ProcessCommad(Domains.MYSENSORS, "N23S0", "ControlDown", "");

} else if (LL.DecimalValue <= ThresholdHIGH && LL.DecimalValue >= ThresholdLOW) {
Console.WriteLine("Light Level NORMAL: " + LL.DecimalValue);
DriverHelper.ProcessCommad(Domains.MYSENSORS, "N23S0", "ControlStop", "");

} else if (LL.DecimalValue < ThresholdLOW) {
Console.WriteLine("Light Level LOW: " + LL.DecimalValue);
DriverHelper.ProcessCommad(Domains.MYSENSORS, "N23S0", "ControlUp", "");

}
}
return true;
});
}
:lol: Thank you EasyIot and Dario.
It is neccesary to use your new EasyIoT.zip: iot-playground.com/forum/bug-reports/197...-enable-disable#1331 . to be able to stop and start Automation program.

Please Log in or Create an account to join the conversation.

Time to create page: 0.219 seconds

Forum latest

  • No posts to display.