Hi everybody
I’m trying to build a rule that contains a ZoneX that is currently opened and a ZoneY that as been opened/closed (updated) less than 2 minutes. Is it possible to do that with persistence?
Thanks
Jose
Hi everybody
I’m trying to build a rule that contains a ZoneX that is currently opened and a ZoneY that as been opened/closed (updated) less than 2 minutes. Is it possible to do that with persistence?
Thanks
Jose
You can’t create a rule trigger like that. But you can check whether an Item was updated within the last 2 minutes using:
ZoneY.lastUpdated.after(new java.util.Date(now.minusMinutes(2).millis))
This will return true if ZoneY was updated two minutes or less ago, false if updated more than 2 minutes ago.
Thanks for your help and i will try it this evening and let you know.
Jose
Hi
It gives me an error:
The name ‘.lastUpdated’ cannot be resolved to an item or type.
Zone4.lastUpdated.after(new java.util.Date(now.minusMinutes(2).millis))
Thanks for your help!
Jose
Hi
Changed to Zone5.lastUpdate.after(new java.util.Date(now.minusMinutes(2).millis)) and it seems to work. Will do follow up after
Thanks
Hi
I tied it and it works
Thanks again!
josé
I am getting this error message in SmartHome Designer:
The method after(Date) is undefined for the type AbstractInstant
when using lastUpdate like this:
if(!Presence_Num.lastUpdate.after(new java.util.Date(now.minusMinutes(30).millis))) {
What could be wrong?
EDIT:
Never mind:
I am using now:
if(!Presence_Num.updatedSince(now.minusMinutes(60),"jdbc")) {