now
now
returns the current time as a unix time - the number of seconds elapsed since January 1st 1970.
Context | Type |
---|---|
Input | ignored |
Output | a number collection with a single value |
Examples
Set the status of sensors to 'faulty' if they haven't been updated in the last minute:
every 30 seconds
when
object(type="sensor", $lastUpdate < now().minus(minutes=1))
then
set("status","faulty")
Notes
If you use now()
as part of a when
clause, you will most likely need to also set an every
clause in order to cause the when
to be reevaluated periodically.