[SOLVED] Rule doesn't seem to be triggering

Hi all,

I’ve created a new rule to bring up/down my HD Blinds based on time of day of a previous rule.

However, it just doesnt seem to be triggering.

Please see rule below:

// All Blinds Up/Down
rule “Blinds Up/Down”
when
Item vTimeOfDay changed
then
val blindLog = “Blinds”
if (vTimeOfDay == “MORNING”) {
Kitchen_Blind.sendCommand(0)
Conservatory_Left.sendCommand(0)
Conservatory_Door.sendCommand(0)
Conservatory_Right.sendCommand(0)
logInfo(blindLog, blindLog + " going up")
} else if (vTimeOfDay == “SUNSET”) {
Kitchen_Blind.sendCommand(100)
Conservatory_Left.sendCommand(100)
Conservatory_Door.sendCommand(100)
Conservatory_Right.sendCommand(100)
logInfo(blindLog, blindLog + " going down")
}
end

Any ideas on what could potentially be wrong with the above? Any help would be greatly appreciated :slight_smile:

Many thanks,

vTimeOfDay is an item, so you should use vTimeOfDay.state == "".

Furthermore, use logInfo directly after the then, to check if the rule gets triggered at all.

1 Like

Thanks for the quick response.

I’ve made the below change:

// All Blinds Up/Down
rule “Blinds Up/Down”
when
Item vTimeOfDay changed
then
val blindLog = “Blinds”
logInfo(blindLog, “Blinds Auto Trigger”)

if (vTimeOfDay.state == “MORNING”) {
Kitchen_Blind.sendCommand(0)
Conservatory_Left.sendCommand(0)
Conservatory_Door.sendCommand(0)
Conservatory_Right.sendCommand(0)
logInfo(blindLog, blindLog + " going up")
} else if (vTimeOfDay.state == “SUNSET”) {
Kitchen_Blind.sendCommand(100)
Conservatory_Left.sendCommand(100)
Conservatory_Door.sendCommand(100)
Conservatory_Right.sendCommand(100)
logInfo(blindLog, blindLog + " going down")
}
end

However, still doesnt seem to work. In my logsv I can see vTimeOfDay change:

2019-04-21 21:05:52.339 [ome.event.ItemCommandEvent] - Item ‘vTimeOfDay’ received command SUNSET

What could i be doing wrong?

Thanks,

No errors in openhab.log concerning this rules file?

Absolutley nothing :frowning: no idea what I’m doing wrong here!

If it helps, I’m using the below DP to trigger my rule:

Let’s go back to basic. Remove the comment before rule, and remove the val definition and make the arguments of logInfo literal strings, and remove everything else.

1 Like

@RolfV Just figured out why this wasnt triggering. It was looking for a ‘received command’ rather than ‘changed’ in the trigger.

Thank you so much for your help!

Ah it didn’t change when it became “Sunset”… :slight_smile:

1 Like

Thank you!