Hey everyone, I’m trying to set up a rule where my smart devices activate only between the evening and the next morning. I’ve got the morning rule working perfectly, but when I tried to reverse it for the evening to morning timeframe, it just doesn’t work. Here’s what I’ve done so far:
rule ButtonTimeOfNight
when Item myitem received command
then
val LocalTime evening = new LocalTime(20, 0) // 8 PM
val LocalTime morning = new LocalTime(7, 0) // 7 AM
if (now.toLocalTime().isAfter(evening) && now.toLocalTime().isBefore(morning)) {
sendCommand(anotheritem, “ON”)
}
end
I’ve checked the syntax multiple times, but it still doesn’t trigger. I wonder if there’s something I’m missing with the time comparison. Maybe the rule engine isn’t handling overnight timeframes correctly? Has anyone else tackled this before? I’d love to hear your thoughts or any workarounds you might have. Thanks in advance for your help!