Smallest time frame Cron [SOLVED]

9 years 3 weeks ago - 9 years 3 weeks ago #995 by HarryDutch
For an automation job on the EasyIoT server Cron is used. Suppose you have a door in your house that is normally closed and you want to be alerted immediately when the door is opened (by a magnetic sensor for example). You could make an automation job that sends a certain value to one of your nodes (with a light or buzzer) but because the smallest time frame for cron is 1 minute you could miss that signal if the door is open and closed within that 1 minute. Is there any other way to solve this? I could try to use node to node communication but I prefer that these events are handled by the controller itself.

EDIT: Found it.

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

9 years 3 weeks ago #996 by cdj
Share it ! :lol:

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

9 years 3 weeks ago #998 by HarryDutch
It's here:http://iot-playground.com/2-uncategorised/32-easyiot-server-automation-part-iii

Found the solution in EventHelper. As soon as the door is opened a message will be send to the node with a buzzer so I will be alerted inmediatly. Still struggeling to get it all right. Nothing to show you right now. The good news however is that it is all there in the EasyIoT server.
The following user(s) said Thank You: ArneiO

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

9 years 3 weeks ago #1000 by EasyIoT
Here is my configuration for SMS leak alarm. You do not need cron - it's to slow, use event helper. Code triggers only when event occurs.
/*
  This code is running one time when program is enabled
*/
public void Setup()
{		
  	EventHelper.ModuleChangedHandler((o, m, p) =>
    {    
  		// bathroom alarm
      	if (m.Domain == Domains.MYSENSORS && m.Address == "N8S0" && p.Property == "Sensor.Leak" && p.Value == "1")
        	SmsHelper.SendSms("+386XXXX","Water leak in bathroom");
      
        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.249 seconds

Forum latest

  • No posts to display.