I need to implement a DateTime variable that records the previous time when a motion detector was activated. When OH is started this variable must be initialized to some value. I tried the following code at the top of the .rules file…
var DateTime Front_Bedroom_Motion_Detector_Last_Triggered = now
… but this fails with the following error message; => so how can I initialize such a DateTime var without a failure? (note: using OH 2.5 latest release)
2019-12-27 14:51:29.223 [WARN ] [me.internal.engine.RuleContextHelper] - Variable 'Front_Bedroom_Motion_Detector_Last_Triggered' on rule file '24g.rules' cannot be initialized with value 'now': The name 'now' cannot be resolved to an item or type; line 44, column 61, length 3