TommySharp
(Tommy Sharp)
April 13, 2017, 11:28am
#1
Currently I have a few sensors and I have individual rules for each to populate a separate LastUpdated item for each item.
What I’m looking for is a way to just put all my sensors into a special “LastUpdated” group and then get notified by some sort of alert when one of those items has not been updated after x hours.
Can anyone comment if this is possible?
No one got any bright ideas on this?
pahansen
(Paul Hansen)
May 30, 2017, 11:50pm
#3
Perhaps this might be somewhere to start?
Problem Statement
Often one will have a number of separate Items which are all related to each other in some way. For example, one might have a Contact on a door and a DateTime to represent when the last time the door was opened. This is easy enough to keep track of if there are only one or two such Items, but if one has a lot of similar Items or is using a lot of genetically coded rules where one cannot hard code the names of the associated Items inside the rule mapping between the Items become…
You’d have to extend the rule to compare the filtered lastUpdate items with a current DateTime item (NTP?) Maybe something from here would help with that part of the rule.
watou:
One small point: A DateTime item in openHAB is not at all the same thing as a DateTime object from org.joda.time. They unfortunately share the same name, but they aren't actually related. A DateTime item in openHAB usually has a state of class DateTimeType. When you have a DateTimeType, you can reference its java.util.Calendar member using .calendar in a rule. Then you can access this calendar's properties, such as .timeInMillis. Then you can use that returned long to create or modify org…
rlkoshak
(Rich Koshak)
May 31, 2017, 2:17am
#4
In addition to @pahansen ’s links, I’ll include:
As many of you are aware, there is a thread written by me and others with a bunch of generic Rules DSL Design Patterns. In keeping with the new thrust to populate the Tutorials & Example category, plus that thread is really long, I will make all future Design Patterns their own thread.
Problem Statement
Many sensors report status to openHAB periodically (e.g. temperature sensor) or unpredictably (e.g. motion sensors) and a subset of these sensors do not have a built in way for openHAB to quer…
Pay particular attention to the Expire Binding version near the bottom of the first post.