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
MikeH
(MikeH)
December 19, 2016, 3:17pm
2
Not sure this will help or not. Could you change the line in the rule to:
Light_EG_Wohnzimmer_UBoot.sendCommand(ON)
Maurits28
(Maurits)
December 19, 2016, 3:32pm
3
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?
Maurits28
(Maurits)
December 19, 2016, 6:13pm
5
Frankly I’m not sure but I experienced that the rules file can be quite picky… Did you test it?
imhofa
(Andreas Imhof)
December 20, 2016, 6:39am
6
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
opus
(Jürgen Baginski)
December 22, 2016, 12:13pm
8
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.