I’m trying to right a rules that checks a group of items (Zigbee devices read from Zigbee2MQTT) for their last seen time. If the haven’t been seen in X amount of time send a notification. So step 1 was to get it working with a single item (below). And once that works try to put it in a loop. This is what I have so far:
rule “Test Time update”
when
Item DummyButton received update
then
val String MyStringFromJoda = now.toString //current time as stringvar DateTime AA = MyStringFromJoda
var DateTime BB = mqtt_topic_10116ed7_MotionSensorUpLastSeen.state.toString
if(AA < BB){
logInfo(“Info”, “Less than works”)
}
end
This works but doesn’t allow for a buffer. So when I change it to:
if(AA.plusHours(5) < BB){
I get
An error occurred during the script execution: Could not invoke method: org.joda.time.DateTime.plusHours(int) on instance: 2020-11-16T15:00:26.440-05:00
So the big question is how do I compare the two time but adding some time to allow for buffer.