Skip to main content

Constants

The constants listed below are available in every rule.

RULE_ID#

RULE_ID='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

Unique string (UUID) identifier of current rule. It can be used for prefixing shared storage keys or for logging purposes.

Example#

storage.shared.write(RULE_ID..'-key', '1')

TIMEZONE#

Offset in seconds from UTC. Timezone of a site where rule is running. For example, for UTC-02:00 the value will be -2*60*60 = -7200.

-- check if current time between 02:00 and 03:00 in current timezone
local result = time.is_now_between('02:00', '03:00', TIMEZONE)
enapter.log('Current time is between 02:00 and 03:00: ' .. tostring(result))
Hardware diversity is welcome. Integrate any device into a unified energy network.
© 2022 Enapter
Developer toolkit
DocumentationReference
Community
GithubTindie