Hi Guys.
i have picked up a issue with my cron Rule .it seems not to trigger.
My Rule :
rule "Morning Lights Weekdays"
when
Time cron "0 0 5 ? * MON,TUE,WED,THU,FRI * "
then
if ( Season.state == "Autumn" && Kitchen_Light_Stoep == "OFF" ) {
Kitchen_Light_Stoep.sendCommand(ON) }
if ( Season.state == "Winter" && Kitchen_Light_Stoep == "OFF" ) {
Kitchen_Light_Stoep.sendCommand(ON) }
if ( Season.state == "Spring" && Kitchen_Light_Stoep == "OFF" ) {
Kitchen_Light_Stoep.sendCommand(ON) }
end
if i upload i get this in the log.
==> /var/log/openhab2/openhab.log <==
2020-05-28 08:18:16.431 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'Outlight.rules', using it anyway:
The use of wildcard imports is deprecated.
2020-05-28 08:18:16.432 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Outlight.rules'
org.joda.time is available without import, so remove the import and add a log entry at the beginning of the rule to be sure that the rule is actually triggering. I bet your rule was triggering, but you were not checking the state of Kitchen_Light_Stoep, so the conditions were never met. You were also comparing it to âOFFâ, which is a string and SwitchItems will never have a state that is a string. What you were looking for was just OFF. Youâre rule can also be cleaned up a bit.
rule "Morning Lights Weekdays"
when
Time cron "0 0 5 ? * MON,TUE,WED,THU,FRI *"
then
logInfo("Test", "Kitchen_Light_Stoep: {}, Season: {}", Kitchen_Light_Stoep.state, Season.state)
if (Kitchen_Light_Stoep.state == OFF && (Season.state == "AUTUMN" || Season.state == "WINTER" || Season.state == "SPRING")) {
Kitchen_Light_Stoep.sendCommand(ON)
}
end
But if i go in to the events log. i donât get the lights coming on.
it seems like the trigger works and the logging. but no action from the lights. the evening rule works just fine.
I spotted some issues in the rule I posted. Iâm surprised it would have even passed the validation check. It is now updated and hopefully works better for you! If you also add the âSystem startedâ trigger, you can test it now.