Solved
/* Light Level control TV */
int ThresholdHIGH = 720; // HIGH Threshold
int ThresholdLOW = 520; // LOW Threshold
public void Setup()
{
EventHelper.ModuleChangedHandler((o, m, p) =>
{ // filter Event Change Sensor.LightLevel
if (m.Domain == Domains.MYSENSORS && m.Address == "N23S1" && p.Property == "Sensor.LightLevel")
{
ModuleParameter LL = ModuleHelper.GetProperty(Domains.MYSENSORS, "N23S1", "Sensor.LightLevel");
Console.WriteLine("Light Level: " + LL.DecimalValue);
// filter to execute only when digital switch = ON
ModuleParameter SC = ModuleHelper.GetProperty(Domains.VIRTUAL, "N3S0", "Sensor.DigitalValue");
Console.WriteLine("Scene control: " + SC.DecimalValue);
if (LL.DecimalValue > ThresholdHIGH && SC.DecimalValue == 1) {
Console.WriteLine("Light Level HIGH: " + LL.DecimalValue);
DriverHelper.ProcessCommad(Domains.MYSENSORS, "N23S0", "ControlDown", "");
} else if (LL.DecimalValue <= ThresholdHIGH && LL.DecimalValue >= ThresholdLOW && SC.DecimalValue == 1) {
Console.WriteLine("Light Level NORMAL: " + LL.DecimalValue);
DriverHelper.ProcessCommad(Domains.MYSENSORS, "N23S0", "ControlStop", "");
} else if (LL.DecimalValue < ThresholdLOW && SCD.DecimalValue == 1) {
Console.WriteLine("Light Level LOW: " + LL.DecimalValue);
DriverHelper.ProcessCommad(Domains.MYSENSORS, "N23S0", "ControlUp", "");
}
} return true;
});
}