[SOLVED]Rule not running on schedule

  • Platform information:
    • Hardware: 1GB RAM, 1 CPU virtualized esxi 6.5
    • OS: Ubuntu 18.04.2 LTS
    • Java Runtime Environment:(Zulu (build 1.8.0_202-b05)
    • openHAB version: 2.4.0


I have a rule (below) that I cannot seem to get to run on a schedule. I’ve been playing around with this rule for a couple days now and can’t seem to figure out what I’m missing. I added logInfo to the rule and tailed the openhab.log, but I don’t see the event. I see the rule refresh in the openhab.log, but I never see anything run and the switch never turns on.

Your help is much appreciated!


Switch   TESTOFFICE            "TESTOFFICE"                   <light>                 (gLight)                 {channel="wemo:socket:Socket-1_0-255755J0111G3F:state"}


rule "turn TestOffice on"
    Time cron "0 53 15 * * ?" // Run at 3:53 PM
    sendCommand(TESTOFFICE, ON)
    logInfo("mooooo","Rule TESTOFFICE triggered")

Do you have any other rules which run around the same time or which have long seeps in them?
If you put another trigger on it like a dummy switch, does it fire?
Any other cron rules working?

In the log file, anything around “interrupted exception”? I have these which eventually stops cron.garden.pool.rules working altogether

You should use the method TESTOFFICE.sendCommand(ON). The function/action sendCommand(Itemname, command) only accepts strings and although the interpreter will try to make strings of it, something might be going wrong in your case.

Also, as a general remark, I would suggest to put a logInfo before and after the actual command in this case, so all in all:

rule "turn TestOffice on"
    Time cron "0 53 15 * * ?" // Run at 3:53 PM
    logInfo("mooooo","Rule TESTOFFICE triggered")
    logInfo("mooooo","Rule TESTOFFICE command sent")

Thank you for your reply.

I never had any rules, this was my first rule (was going to program some lights to turn on/off on a schedule). However, I never was able to get the time cron to work. So no other rules conflicting. I created a rule (to make sure the engine was working) that turned on a light when another light would change status. This worked without issue.

I have tried a few other items other than my test switch, but I can make it something non-existent and report back my findings.

I ran a cat | grep cron on my openhab.log file and it didn’t return anything. I have no other cron rules working, but I confirmed my time (date command) is correct and the correct timezone.

In response to RolfV, I originally had TESTOFFICE.sendCommand(ON) as my rule but some some other examples. I took your suggestions and made the appropriate changes. However the results are the same, unfortunately.

rule "turn TestOffice on"
    Time cron "0 02 19 * * ?" // Run at 7:02 PM
    logInfo("mooooo","Rule TESTOFFICE triggered")
    // sendCommand(TESTOFFICE, ON)

This is what I see in openhab.log:

2019-02-17 23:58:40.249 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'test_rules.rules'
2019-02-18 00:01:18.918 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'test_rules.rules'

According to your log, it’s around midnight now. So 7:02 PM will take another 19 hours. So nothing will happen in the meantime…
(Hint: your time settings might be wrong :slight_smile:)

I see what you’re talking about, the log timestamps are different. You may have spotted something ridiculously obvious.

Here is output on my OS:

moo@openhab2:~$ date
Sun Feb 17 19:04:15 EST 2019

Does openhab handle it’s time differently?

I have no idea about time and OpenHAB on linux (windows here), but maybe this gives you some hints:

Winner winner chicken dinner!

My rule kicked off when I adjusted the time of the cron to match the time in the logs. Now I just need to figure out why Openhab2 has different time from the OS.

2019-02-18 00:15:27.273 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'test_rules.rules'
2019-02-18 00:16:00.032 [INFO ] [clipse.smarthome.model.script.mooooo] - Rule TESTOFFICE triggered

I was already on that article you posted, RoflV, and have made the suggested changes. Restarted the openhab2 service and I believe this may be resolved.

tail of openhab.log after service restart

2019-02-18 00:17:18.093 [INFO ] [.dashboard.internal.DashboardService] - Stopped Dashboard
2019-02-18 00:17:19.808 [INFO ] [b.core.service.AbstractActiveService] - Ecobee Refresh Service has been shut down
2019-02-17 19:19:21.275 [INFO ] [.internal.GenericScriptEngineFactory] - Activated scripting support for ECMAScript
2019-02-17 19:19:23.081 [INFO ] [ebuilder.internal.HomeBuilderServlet] - Started Home Builder at /homebuilder

Sheesh, I should have posted this the day I was having the issue. The amount of time I could have saved!

Thank you both.