Crontab + Automation public void Run(): Don't work

9 years 4 months ago #2029 by osalval
Hellow,
It's a very simply rule to execute every day at fixed time:

45 06 * * Mon-Fri

public void Run()
{
DriverHelper.ProcessCommad(Domains.MYSENSORS, "N21S0", "ControlUp", "");
System.Threading.Thread.Sleep(25000);
DriverHelper.ProcessCommad(Domains.MYSENSORS, "N21S0", "ControlStop", "");
}
I am checking and some times works, normally after a Raspberry reboot, and radomly sometimes.

Checking log doesn't appear nothing so I suppose commands are not sent.

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

9 years 4 months ago #2042 by medyk8ns
Do you have MySensors debug enabled and when it works logs are present for your module(N21S0)?
Maybe you have some NRF connection issues?

You can always start EasyIoT server in console(sudo mono EasyIoT.exe) and add
Console.WriteLine( System.DateTime.Now.ToString() +  " Shutter program Run executed");
in your Run method(or send an email using EmailHelper).
So you can be sure for 100% if it's CRON or connection issue.
The following user(s) said Thank You: osalval

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

9 years 4 months ago #2061 by osalval
No i have not debug enabled, i don't know what implies in uSD life.

I thought i might have a RF problem, but log are writen in Raspberry so in this case commands should appear in log even if it can not reach the node and I have no problem using EasyIoT, commands are executed with no lacks. This is no 100% sure but we have not signal radio level indicator.

Commands: Sensor.Down, Sensor.Stop and Sensor.Up are the last incorporated in EsyIot so it can be a bug?. I don't know because when i use it in web ui works well. What the difference of using in Automation? CRON?.

This commands have only one direction: from controller to Node, there is no a feedback, so it must be sent with no matter of success.

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

9 years 4 months ago #2065 by medyk8ns
So if CRON itself is working fine then maybe it is something with DriverHelper, maybe try using ModuleHelper(like ModuleHelper.SetProperty(Domains.ESP8266, "N3S0", "Sensor.Humidity", "52.2"))? And maybe add EventHelper.SetEvent?
There shouldn't be any difference but it is worth trying. Hard to say without source code.
Html is using Ha.Data.ServiceCall('Control/Module/' + module1.Domain + '/' + module1.Address + '/ControlUp/', null, "POST", null);
which is calling ajax var url = '/Api/EasyIoT/' + 'Control/Module/' + module1.Domain + '/' + module1.Address + '/ControlUp/'
So another way is to call api directly from automation.
The following user(s) said Thank You: osalval

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

9 years 4 months ago #2072 by osalval
Thank you, I investigate it.

In the meantime, today i found this:
CRON: 15 07 * * Sun,Sat
public void Run()
{
DriverHelper.ProcessCommad(Domains.MYSENSORS, "N21S0", "ControlUp", "");
System.Threading.Thread.Sleep(25000);
DriverHelper.ProcessCommad(Domains.MYSENSORS, "N21S0", "ControlStop", "");
}

log:
2015-08-16T07:15:00.8775290+02:00 INFO MySensors N21S0 Sensor.Down 1 -
.
.
2015-08-16T07:16:01.0197230+02:00 INFO MySensors N21S0 Sensor.Stop 1 -

That's the opposite it must done, it should be Sensor.Up

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

9 years 4 months ago #2073 by osalval
I'm not a coder.

Another test I'm configuring to test next days is to use ControlLevel, instead of: ControlUp, ControlDown and ControlStop, like:

public void Run()
{
DriverHelper.ProcessCommad(Domains.MYSENSORS, "N21S0", "ControlLevel", "50");
}

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

Time to create page: 0.290 seconds

Forum latest

  • No posts to display.