- OpenHAB 3
- The JRuby Scripting Language Addon
- This scripting library
Configure the openHAB JRuby Automation to install the
openhab-scripting Ruby gem and automatically insert the
require statement at the beginning of your scripts (optional).
- Go to
Settings -> Add-ons -> Automationand install the jrubyscripting automation addon following the openHAB instructions
- Go to
Settings -> Other Services -> JRuby Scripting:
- Ruby Gems:
- Require Scripts:
openhab(openHAB 3.3+: recommended if you are using GUI scripting)
- Ruby Gems:
Configure JRuby OpenHAB services
Create a file called
<OPENHAB_CONF>/services/with the following content:
org.openhab.automation.jrubyscripting:gems=openhab-scripting=~>4.0 # optional: uncomment the following line if you prefer not having to # insert require 'openhab' at the top of your scripts. # org.openhab.automation.jrubyscripting:require=openhab
This configuration with the openhab-scripting gem specified with pessimistic versioning will install any version of openhab-scripting greater than or equal to 4.0 but less than 5.0. On system restart if any (non-breaking) new versions of the library are available they will automatically be installed.
<OPENHAB_CONF>/services/addons.cfgand ensure that
jrubyscriptingis included in an uncommented
automation=list of automations to install.
Depending on the versioning selected in the
jruby.cfg or the gems list in the user interface, file upgrading will either be automatic after a OpenHAB restart or manual. For manual upgrades select the version of the gem exactly, for example:
Will install and stay at version 4.0.0, to upgrade to version 4.0.1, change the configuration:
To automatically upgrade, it is recommended to use pessimistic versioning:
org.openhab.automation.jrubyscripting:gems=openhab-scripting=~>4.0 This will install at least version 4.0 and on every restart will automatically install any version that is less than 5.0. This ensures that fixes and new features are available without introducing any breaking changes.