Rules simply don't work / react to anything

Hey there,
I’m new to openhab and raspberry’s in general. Currently I have a working openhab-instance with items, groups and a nice sitemap. Currently I’m struggling with the simplest rules at all.

Have a look at this item:

Switch Light_EG_Wohnzimmer_UBoot "Licht UBoot" (EG_Wohnzimmer, Lights) {knx="1/2/49"}

It works when i change it’s state in openhab via phone, etc.
I tried to create a rule like this:

rule “Test”
when
    Time cron "0 0/1 * 1/1 * ? *"
    then
        sendCommand(Light_EG_Wohnzimmer_UBoot, ON)
end

I’m using the following assemblies in home.rules

import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.joda.time.*

Why does nothing happen to my light?
Where can I check the log?

I hope you can help me. Thanks in advance

Not sure this will help or not. Could you change the line in the rule to:

 Light_EG_Wohnzimmer_UBoot.sendCommand(ON)

Did you align the then with when in your rules file?

I don’t think it will make a difference, but you could make your cron job a bit more simple, try this if you want to fire the command every minute:

Time cron "0 * * * * ?"

Here more info on how to program cron jobs: http://www.quartz-scheduler.org/documentation/quartz-2.1.x/tutorials/crontrigger

Hey there, no I didn’t have “when” and “then” aligned. Does this seriously matter?

Frankly I’m not sure but I experienced that the rules file can be quite picky… Did you test it?

I think MikeH hint will be the cause…
Try it…

The action “sendCommand” is not always working properly. So give the method like MikeH hinted a chance…

Together with Maurits28 cron optimization everything would be fine…

Andreas

Hey there,
it did work, thank you guys!

In fact I had to switch to MikeH’s method in addition to Maurits28’s cron optimization!

At least I know that it should work, so now i can try more sophisticated things.

Thanks

Have fun writing more sophisticated rules!

If you use something like:

logInfo (“MyTestRule”, “MyValue ={}”, MyValue)

in your rules, the log will print a line with that info, if it doesn’t show you know the rule didn’t come to this line.