Problem with 'createTimerWithArgument' in OH2

I’ve been working on writing some rules and ran into the same problem that you all did as well. So I re-implmented the code for OH2 so I could use the function. :grinning:

issue: https://github.com/eclipse/smarthome/issues/2718
PR: https://github.com/eclipse/smarthome/pull/3234

If you are interested in testing it (I’ve had it working for about a day or so, change seemed pretty streight forward as it was already done on OH1.

http://www.ktechs.net/pvt_filz/org.eclipse.smarthome.model.script-0.9.0-SNAPSHOT.jar

----Directions to use the JAR - a bit cumbersome… -----
0. BACKUP!!! :slight_smile: - Use at your own risk!

  1. login to the openhab console

  2. find the running bundle of the ‘old’ “Eclipse SmartHome Script” bundle and stop it

openhab> bundle:list | grep -i script
131 | Active   |  80 | 0.9.0.201703201701    | Eclipse SmartHome Script Runtime
191 | Active   |  75 | 0.9.0.201703201701    | Eclipse SmartHome JavaScript Transformation Service
218 | Active   |  80 | 0.9.0.201704090215    | Eclipse SmartHome Script <-- Only this one!
openhab>
openhab> bundle:stop 218
openhab> bundle:uninstall 218
  1. Copy the JAR file to your addons directory
cd /your/install/path/addons
wget http://www.ktechs.net/pvt_filz/org.eclipse.smarthome.model.script-0.9.0-SNAPSHOT.jar .
  1. Check to see if OpenHAB2 picked it up
openhab> bundle:list | grep -i script
131 | Active    |  80 | 0.9.0.201703201701    | Eclipse SmartHome Script Runtime
191 | Active    |  75 | 0.9.0.201703201701    | Eclipse SmartHome JavaScript Transformation Service
220 | Installed |  80 | 0.9.0.201704111257    | Eclipse SmartHome Script <-- it did - note date!
openhab>
  1. stop the running “feature”…
openhab> feature:list | grep -i script
Name                                        | Version          | Required | State       | Repository              | Description
esh-automation-module-script                | 0.9.0.SNAPSHOT   |          | Uninstalled | distro-2.1.0-SNAPSHOT   |
esh-automation-module-script-defaultscope   | 0.9.0.SNAPSHOT   |          | Uninstalled | distro-2.1.0-SNAPSHOT   |
esh-model-script                            | 0.9.0.SNAPSHOT   |          | Resolved    | distro-2.1.0-SNAPSHOT   |
esh-model-script-runtime                    | 0.9.0.SNAPSHOT   |          | Started     | distro-2.1.0-SNAPSHOT   |
esh-transform-javascript                    | 0.9.0.SNAPSHOT   |          | Started     | addons-2.1.0-SNAPSHOT   | Javascript Transformation
openhab-transformation-javascript           | 2.1.0.SNAPSHOT   | x        | Started     | addons-2.1.0-SNAPSHOT   | Javascript Transformation
openhab> feature:uninstall esh-model-script
Error executing command: Feature named 'esh-model-script/0.0.0' is not installed
openhab> feature:stop esh-model-script
  1. Restart openHAB2, none of your rules will work until you do and it should be working. You might get an error as it starts up with the following:
17:01:34.719 [ERROR] [org.eclipse.smarthome.model.script  ] - FrameworkEvent ERROR - org.eclipse.smarthome.model.script
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.smarthome.model.script [221]
  Another singleton bundle selected: osgi.identity; osgi.identity="org.eclipse.smarthome.model.script"; type="osgi.bundle"; version:Version="0.9.0.201704111257"; singleton:="true"

I believe this is the framework looking for the correct version matching revision of the bundle but we’ve loaded the newer version. It’s been working OK for me.