Automation sequencing

6 years 5 months ago #1338 by ArneiO
Replied by ArneiO on topic Automation sequencing
I made an other switch named "Night mode", setting the LEDs to a very low level when activated.
This is the automation code for the three dimmer nodes:
public void Setup()  
{  
  EventHelper.ModuleChangedHandler((o, m, p) =>  
  {   
    // filter digital switch - change module address  
    if (m.Domain == Domains.VIRTUAL && m.Address == "N14S0" && p.Property == "Sensor.DigitalValue"){  
      // filter when switch on event   
      if (p.Value == "1")  
      {  
        //Commands to execute in sequence, with inbetween pause while the code is executed
        DriverHelper.ProcessCommad(Domains.VIRTUAL, "N10S0", "ControlLevel", "2");  //RED dimmed down to night level
        System.Threading.Thread.Sleep(1200); // 1200 ms pause
        DriverHelper.ProcessCommad(Domains.VIRTUAL, "N11S0", "ControlLevel", "0");  //GREEN dimmed down to night level
        System.Threading.Thread.Sleep(1200); // 1200 ms pause
        DriverHelper.ProcessCommad(Domains.VIRTUAL, "N12S0", "ControlLevel", "2");  //BLUE dimmed down to night level
      }  
      else
      {  
        //Commands can be inserted here too (if switch "OFF" is activated)
      }   
    }  
    return true;   
  });   
}  
The following user(s) said Thank You: sharonlei

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

Time to create page: 0.220 seconds

Forum latest

  • No posts to display.