Restart Expire [5.2.0.0;5.9.9.9]

WARNING: Users who have this template already installed for versions of OH 5.1 and before, after removing the old template and installing this new one, open your rule(s), click on the code tab, and change the ruleTemplate property to ohrt-restartExpire before regenerating the rule.

On openHAB restart updates/commands the restored state/current state of Items with expire metadata back to the Item to kick off the Expire timers again (Expire doesn’t get reset with restoreOnStartup).

If the expire has ignoreStateUpdates set to true a command will be sent. Otherwise an update will be sent.

This rule template has one property. When “Use Expire State” is checked, instead of using the Item’s current state to update the Item the state configured in the “expire” metadata is used, essentially initializing the Item to the expire state.

When ignoreStateUpdates is set to true, this property does nothing and the Item’s current state is commanded to the Item. This is a deliberate decision because this rule template shouldn’t cause things to happen during startup.

This rule tempalte requires the openhab_rules_tools library to be installed. See openHAB Rules Tools Announcements for details. You can install it from openhabian-config and there is a rule template which may work for you to install it. See the announcements for all the ways to install this library.

Language: GraalVM JS Scripting

Dependencies:

  • openhab-js 5.18.2 or later
  • openhab-rules-tools 2.1.0 or later

Changelog

Version 1.1

  • Migrated to YAML file formatttt for OH 5.2
  • use wrapper
  • standardize logger names

Version 1.0

  • Graduating to 1.0 status
  • added property to select whether to update the Item to it’s current state or to the configured expire state

Version 0.1

  • initial release

Sponsorship

If you want to send a tip my way or sponsor my work you can through Sponsor @rkoshak on GitHub or PayPal. It won’t change what I contribute to OH but it might keep me in coffee or let me buy hardware to test out new things.

Resources

https://raw.githubusercontent.com/rkoshak/openhab-rules-tools/refs/heads/main/marketplace-templates/ohrt-restartExpire.yaml