I’m a newbee in programming rules and have a little problem. I have a litte rule wich switches garden ligts at a specific time on and at astro event (sunset) off. But now the time comes, when sunset state changes bevor time to switch on is arrived.
How can i handle this in my rule?
rule "Gartenlicht-Ein-Morgen"
when
Time cron " 0 0 7 ? * MON-FRI *"
then
sendCommand(r0, ON)
end
rule "Gartenlicht-Aus-Morgen"
when
Item Sunrise_Event received update ON
then
sendCommand(r0, OFF)
end
i still use my rule from OH1.x in OH2, because the rule created with OH2 rule interpreter doesn’t work. My rule works quit well, but I don’t know how to solve the problem of sunrise bevor 7 o’clock.
First decide what you would like to happen. Guessing that if 0700 is after sunrise, don’t do anything?
If your Sunrise_Event Item really is a short-lived event, rather than a steady “daytime” indicator … you probably want to create a daytime Item. Then in your cron rule (and any other lighting rules) you can test to see if is dark (i.e.not daylight) before action.
Various helpful bits here