Automation sequencing

6 years 4 months ago #1285 by ArneiO
Automation sequencing was created by ArneiO
How do I send a sequence of instructions to several nodes? Like for instance a "Night" button that sets all ESP controlled lights to night mode (most lamps OFF, some dimmed).
The following user(s) said Thank You: sharonlei

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

6 years 4 months ago #1291 by EasyIoT
Replied by EasyIoT on topic Automation sequencing

ArneiO wrote: How do I send a sequence of instructions to several nodes? Like for instance a "Night" button that sets all ESP controlled lights to night mode (most lamps OFF, some dimmed).


It can be done in automation. In Virtual driver add Digital DO node and name it "Night". Then add in automation script in Setup EventHelper and check if button is pressed. If pressed then send commands to switch off your devices.
The following user(s) said Thank You: osalval

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

6 years 4 months ago #1300 by ArneiO
Replied by ArneiO on topic Automation sequencing
I am trying... but am not able to set up the automation correctly.
I have modified the relay automation code here: iot-playground.com/2-uncategorised/40-es...y-switch-arduino-ide
But after many hours' of trying... I just can't make it happen! :woohoo:

I have five dimmer nodes that I want to set to a default day or night setting depending on the state of a "Day / Night" switch.

Would you be so kind as to give me a hint in the right direction?
The following user(s) said Thank You: osalval

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

6 years 4 months ago #1305 by EasyIoT
Replied by EasyIoT on topic Automation sequencing

ArneiO wrote: I am trying... but am not able to set up the automation correctly.
I have modified the relay automation code here: iot-playground.com/2-uncategorised/40-es...y-switch-arduino-ide
But after many hours' of trying... I just can't make it happen! :woohoo:

I have five dimmer nodes that I want to set to a default day or night setting depending on the state of a "Day / Night" switch.

Would you be so kind as to give me a hint in the right direction?


I see this is common problem. I will prepare tutorial.
The following user(s) said Thank You: ArneiO

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

6 years 4 months ago #1307 by ArneiO
Replied by ArneiO on topic Automation sequencing

EasyIoT wrote: I see this is common problem. I will prepare tutorial.

Yes, that would be great!

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

6 years 4 months ago #1337 by ArneiO
Replied by ArneiO on topic Automation sequencing
@EasyIoT
Thank you for your new article "EasyIoT server automation - scene control"!

However, I think there are some issues here:
1) This line sends the server into an eternal loop:
DriverHelper.ProcessCommad(Domains.VIRTUAL, "N14S0", "ControlOff", "");

2) What is the purpose of this 3 second pause?
System.Threading.Thread.Sleep(3000);

3) It seems like a pause is needed between each DriverHelper.ProcessCommad() to wait until execution of the previous command is finished.
Ihave an RGB LED stripe where each color is controlled by a dimmer node with 1 second dimming time. In order to switch them all off, I had to introduce a slightly longer pause between each command line.

This automation code switches all three (RGB) channels ON or OFF:
/*  
 This code is running one time when program is enabled  
*/  
public void Setup()  
{  
  EventHelper.ModuleChangedHandler((o, m, p) =>  
  {   
    // filter digital switch - change module address  
    if (m.Domain == Domains.VIRTUAL && m.Address == "N13S0" && p.Property == "Sensor.DigitalValue"){  
      // filter when switch on event   
      if (p.Value == "0")  
      {  
        //Commands to execute in sequence, with inbetween pause while the code is executed
        DriverHelper.ProcessCommad(Domains.VIRTUAL, "N10S0", "ControlOff", "");  //Switch off RED (dimmed down over 1000 ms)
        System.Threading.Thread.Sleep(1200); // 1200 ms pause
        DriverHelper.ProcessCommad(Domains.VIRTUAL, "N11S0", "ControlOff", "");  //Switch off GREEN (dimmed down over 1000 ms)
        System.Threading.Thread.Sleep(1200); // 1200 ms pause
        DriverHelper.ProcessCommad(Domains.VIRTUAL, "N12S0", "ControlOff", "");  //Switch off BLUE (dimmed down over 1000 ms)        
      }  
      else
      {  
        //Commands to execute in sequence, with inbetween pause while the code is executed
        DriverHelper.ProcessCommad(Domains.VIRTUAL, "N10S0", "ControlOn", "");  //Switch on RED (dimmed down over 1000 ms)
        System.Threading.Thread.Sleep(1200); // 1200 ms pause
        DriverHelper.ProcessCommad(Domains.VIRTUAL, "N11S0", "ControlOn", "");  //Switch on GREEN (dimmed down over 1000 ms)
        System.Threading.Thread.Sleep(1200); // 1200 ms pause
        DriverHelper.ProcessCommad(Domains.VIRTUAL, "N12S0", "ControlOn", "");  //Switch on BLUE (dimmed down over 1000 ms)
      }   
    }  
    return true;   
  });   
}  

 
/*  
  This code is running periodicaly when program is enabled.    
  Cron job detirmine running period.   
*/  
public void Run()  
{  
}  

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

Time to create page: 0.275 seconds