Time driver
Time and date related functions
Many actions in Domotcl will be time related. The time driver provides
functions and events for both wall-clock time and sun-based time. The
driver has to be configured with the local lattitude, longitude and
country to make full use of all its capabilities.
Arguments
- lattitude
- A floating point value between -90 and 90.
Default: 52.23.
- longitude
- A floating point value between -180 and 180.
Default: 5.18.
- country
- Possible values: default, custom.
A clock event fires once a day based on wall-clock time.
Arguments
- time
- The time of day that the device will fire an expire event.
HH:MM[:SS].
- random
- Random offset in minutes.
Properties
- expire
- The next scheduled time for the device.
Format: DDD HH:MM:SS.
Events
- expire
- Fires at the scheduled time. No event will fire when the expire property
is changed through one of the commands listed below.
Commands
- enable
-
Enable the device. The expire event will not fire if the device is
disabled.
- disable
-
Disable the device, preventing the expire event from firing.
- set time
-
Apply a one-time change to the time the expire event will fire.
- add time
-
Add the specified time to the current scheduled time that the expire
event will fire.
- subtract time
-
Subtract the specified time from the current scheduled time that the
expire event will fire.
Functions
- fired
-
Returns a boolean value indicating if the event has fired today.
A solar event fires once a day based on the sun rising or setting.
Arguments
- base
- Possible values: sunrise, sunset, dark.
- offset
- {+|-}[H:]MM[:SS].
- random
- Random offset in minutes.
Properties
- expire
- The next scheduled time for the device.
Format: DDD HH:MM:SS.
Events
- expire
- Fires at the scheduled time. No event will fire when the expire property
is changed through one of the commands listed below.
Commands
- enable
-
Enable the device. The expire event will not fire if the device is
disabled.
- disable
-
Disable the device, preventing the expire event from firing.
- set time
-
Apply a one-time change to the time the expire event will fire.
- add time
-
Add the specified time to the current scheduled time that the expire
event will fire.
- subtract time
-
Subtract the specified time from the current scheduled time that the
expire event will fire.
Functions
- fired
-
Returns a boolean value indicating if the event has fired today.
A time point is similar to a variable, except that it stores a point in time
rather than a number.
Properties
- time
- The current value of the device.
Events
- time
- Fires whenever the time property value changes.
Commands
- set
-
Set the device to the current time
- add seconds
-
Move the time point forward in time by the specified number of seconds.
Functions
- hours
-
Returns the hour of the day (0-23) of the time point.
- minutes
-
Returns the minute of the hour (0-59) of the time point.
- day
-
Returns the day of the month of the time point.
- month
-
Returns the month of the year (1-12) of the time point.
- year
-
Returns the four-digit calendar year of the time point.
- week
-
Returns the ISO8601 week of the year (1-53) of the time point.
- dow
-
Returns the day of the week (1=Monday, 7=sunday) of the time point.
- older age
-
Returns a boolean indicating if the time point refers to a time that
lies further in the past than the specified age.
- holiday
-
If the time point is on a holiday, this function returns the name of
the holiday, or the empty string otherwise.
The time device type provides some general time related functions.
Properties
- sunrise
- The time of the next sunrise.
Default: 12:00:00.
- sunset
- The time of the next sunset.
Default: 12:00:00.
Events
- sunrise
- Fires at sunrise.
- sunset
- Fires at sunset.
Functions
- now
-
The current time of day as HH:MM:SS.
- today
-
The current date as YYYY-MM-DD.
- sunrise
-
The sunrise time of today as HH:MM:SS.
- sunset
-
The sunset time of today as HH:MM:SS.
- is time
-
Returns a boolean indicating if the current time is equal to the
specified time, expressed as HH:MM:SS.
- before time
-
Returns a boolean indicating if the current time is earlier than the
specified time.
- after time
-
Returns a boolean indicating if the current time is later than the
specified time.
- current part
-
Returns the specified part of the current time. Possible values are:
millisecond, second, minute, hour, dow, day, month, year, and value.
- special special
-
Returns a boolean indicating if the current time falls within the
period specified by
special
. Supported period specifications are:
weekday (mon-fri), weekend (sat or sun), winter (Jan-Mar), spring
(Apr-Jun), summer (Jul-Sep), fall (Oct-Dec), am (00:00-11:59), pm
(12:00-23:59), day (06:00-17:59), night (18:00-05:59), light
(sunrise-sunset), and dark (sunset-sunrise).
|