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-installOHRT before regenerating the rule.
This rule template will attempt to install openHAB rules tools for you. See openHAB Rules Tools Announcements for details and openHAB Rules Tools [4.1.0.0;5.9.9.9] for the Block Library.
This rule checks to see if npm is available via a local to the user nvm installation. If it’s not the template installs nvm, then uses nvm to install node locally to the user. This local to the user instance is then used to install openhab_rules_tools.
Install the template, instantiate a rule from the template, and manually run it while watching openhab.log.
Do not use this if you are running openHABian. openHAB Rules Tools can be installed from openhabian-config.
Watch openhab.log for errors. If there are errors, this template may not work for you and you will have to do a manual install.
This script does work for Docker users. Make sure to set the path parameter is set to /openhab/conf.
Language: JS Scripting
Dependencies:
- Requires
wgetto be installed and in the path for the user openHAB is running under. - Only tested on Linux and Docker. I cannot say if it works on other platforms. It almost certainly won’t work on Windows.
Changelog
Version 1.0
- migrated to new YAML file format for OH 5.2
- use wrapper
Version 0.2
- executeCommandLine now returns stderr more reliably. Test for “not found” in the output to see if npm isn’t installed.
Version 0.1
- initial release
