[INVESTIGATING] Problem with schedules in

I am using Platform Version and rules machine.

I have this simple rule:

When I first install it it I see two scheduled jobs in cron:

and when the time comes it works correctly.

But after the first time it executes, it never executes again and the only registered job in cron is next day's midnightHandler:

I tried recreating the app many times, but every time it only executes once.


Have you tried setting a time or event for turning off the lights at the end of the rule?

I could understand the need for the cron jobs you saw.... Can you confirm the time zone settings you have configured under the settings page? (No need to post them here, just make sure they are correct). The same for the sunset and sunrise values displayed.

One other thing to try would be turning on logging for the RM rule to see what it reports in the logs.

Are you saying that on the second and subsequent days, it doesn’t trigger?
Wasn’t quite sure if that was what you meant.

I found the same thing happing to me .. I used : [Simple Automation Rules]
I added a trigger to turn off lights at 1am it works every time now.

That is correct. It only triggers once and then never again.

My time zone settings are correct. All times in the logs look good. The "Display current values" in the app also look correct.

I do have logging enabled and I can see it turning the lights on the first day after the app is installed and then never get called again.

@WarlockWeary if I use a specific time it works fine.

It doesn't work only if I use "sunset" (and I assume "sunrise") because it has to add an extra midnightHandler cron job to figure out next days sunset time in order to properly add the allHandlerT cron job for the next day. It is this latter part that never happens.

That’s what I was going to say to you. :innocent:
Question for @bobbyD or other support is why not.

When you have a chance, can you enable the logging for the app?


Then post the a screenshot of the logs filtered for only your app? Looking at the logs will tell you what happens, or doesn't happen.

I have debug logging on already, but I have nothing useful to show as I re-created the app multiple times for testing.

In 48 hours I 'll post a successful run from today and a failed run from tomorrow, along with all registered cron jobs.

1 Like

While you are waiting, can you post a screenshot of the middle part of your Hub Details page as well as Location events with sunset/sunrise logs (see examples below)

1 Like

Update as of this morning. The app worked correctly (as expected) yesterday after being re-initialized:

But we can already see that it will not trigger tonight, by going to the gear icon of the app and looking at the currently registered cron jobs:

Thanks for the update. Do you mind posting the app settings from the gear icon?

Could this be related?

Both involve (I think) sunset and sunrise issues.

I do not believe that they are related.

This problem seems to be a cron issue. When the app is initialized two cron jobs are set as expected. But the next day the midnightHandler computes the new sunrise/sunset times, but it does not register the appropriate cron job.

In the other problem, the "Required Expression" is evaluated properly on the first day when a trigger occurs (both before sunset as FALSE and after sunset as TRUE; notice that there is no need for a special cron job). But it is not evaluated on subsequent days when a trigger occurs (it simply defaults to TRUE).

Just for completeness, indeed the app did not trigger tonight. The only log entries I have for this app are still from yesterday:

App settings:

And I had changed the app the day before yesterday to using "Days of the Week" in case it made a difference, so here is the current version of the app, demonstrated to work the first day and not on subsequent days:

Thanks for confirming the change. I was wondering why the trigger changed. Can you change it back, please? I was trying to replicate and my 2 schedules were created correctly after the app ran last night, so not sure (yet) why yours isn't running correctly. Next time please post a screenshot of the " Application State" section too.