With the last snapshot (#89) and after installaing openHAB 1.x Compatibility Layer (through feature:install), the Mios bundle is now installed and active.
The problem is that it does not alter any item.
@lolodomo,
I pulled the latest source tonight, and run it via the new openhab 2/Eclipse setup. This latest pull included the fix applied by Kai (aka immediate="true") to get OSGi to treat the config differently.
I found one issue that might have caused grief, in that OH 2/OSGi is now calling updated() immediately after activate(), and it’s passing null as the properties parameter… This is all occurring before the various config files have been loaded, and seems to be a new/OH 2.0 behavior (but maybe I never noticed it before)
There’s a later call to update() that’s correctly passing in the parameter, so it sorts itself out eventually.
Anyhow, I submitted a PR to prevent that NPE from occurring:
@guessed Well done!
Feel free to also add it directly to the official distro by a PR similar to this one.
In such a PR, you an also directly add such map files (similar to the cfg file), so they get automatically installed when the user installs the Mios binding!
A simple rule like this works perfectly under OH1.8, with no imports:
rule "Test sendMiosAction"
when
Time cron "0/10 * * * * ?"
then
sendMiosAction(GuestBedroom2LightsId, "HaDevice1/ToggleState")
end
but emits an error like this under OH2:
2016-01-24 11:56:40.003 [DEBUG] [.m.r.r.i.engine.ExecuteRuleJob:58 ] - Executing scheduled rule 'Test sendMiosAction'
2016-01-24 11:56:40.006 [ERROR] [.m.r.r.i.engine.ExecuteRuleJob:62 ] - Error during the execution of rule Test sendMiosActionjava.lang.IllegalStateException: Cannot resolve proxy: java:/Objects/org.openhab.core.items.Item#org.openhab.core.items.Item
at org.eclipse.xtext.common.types.util.JavaReflectAccess.getRawType(JavaReflectAccess.java:108)
at org.eclipse.xtext.common.types.util.JavaReflectAccess.getRawType(JavaReflectAccess.java:150)
at org.eclipse.xtext.common.types.util.JavaReflectAccess.getParamTypes(JavaReflectAccess.java:144)
at org.eclipse.xtext.common.types.util.JavaReflectAccess.getMethod(JavaReflectAccess.java:76)
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1063)
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1059)
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1045)
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:990)
at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:112)
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:900)
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:863)
I haven’t worked out why, at least not yet. I submitted (and Kai approved) a PR this morning to make the MiOS Binding import directly into OH2:
This will make it easier to start for anyone wanting to test under OH2, and it also provides a default mios.cfg file. Once I’ve sourced the problem with the Action binding execution, I’ll submit a PR to get the mios*.map transforms automatically installed as well.
21:13:44.430 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/home/pi/openhab2/addons/org.openhab.binding.mios-1.9.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.mios [155]
Unresolved requirement: Import-Package: org.codehaus.jackson
at org.eclipse.osgi.container.Module.start(Module.java:434)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:393)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1245)[8:org.apache.felix.fileinstall:3.5.0]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1217)[8:org.apache.felix.fileinstall:3.5.0]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:509)[8:org.apache.felix.fileinstall:3.5.0]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:358)[8:org.apache.felix.fileinstall:3.5.0]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:310)[8:org.apache.felix.fileinstall:3.5.0]
What client are you using? When I do this with the Classic UI, using my imported sitemap’s ^ v buttons on the Dimmer UI component, they’re working correctly in my runtime (from the Eclipse IDE)
My addons.cfg has the lines to include miosAction/Binding as well as the maptransform:
MAP transformation service is installed in my OH2 too.
And my file miosDimmerCommand.map (identical to yours) is present in my conf/transform directory.