pahansen
(Paul Hansen)
May 30, 2017, 11:50pm
3
Perhaps this might be somewhere to start?
Please see Design Pattern: What is a Design Pattern and How Do I Use Them for how to read and use DPs.
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 generically coded rules where…
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.
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.…