[Fixed] Mios binding 1.8 not working in openHAB2

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.

Here are the debug logs at startup:

21:58:21.156 [DEBUG] [org.openhab.binding.mios            ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.mios.MiosBindingProvider}={component.name=org.openhab.binding.mios.genericbindingprovider, component.id=37, service.id=247, service.bundleid=152, service.scope=bundle} - org.openhab.binding.mios
21:58:21.168 [DEBUG] [org.openhab.binding.mios            ] - BundleEvent STARTING - org.openhab.binding.mios
21:58:21.175 [DEBUG] [.binding.mios.internal.MiosActivator] - MiOS binding has been started
21:58:21.181 [DEBUG] [org.openhab.binding.mios            ] - BundleEvent STARTED - org.openhab.binding.mios
21:58:21.259 [DEBUG] [ios.internal.MiosBindingProviderImpl] - setItemRegistry: called
21:58:21.265 [DEBUG] [ios.internal.MiosBindingProviderImpl] - unsetItemRegistry: called
21:58:21.344 [DEBUG] [ios.internal.MiosBindingProviderImpl] - setItemRegistry: called
21:58:21.389 [DEBUG] [org.openhab.binding.mios            ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService, org.openhab.binding.mios.MiosActionProvider}={event.topics=openhab/*, service.pid=org.openhab.mios, component.name=org.openhab.binding.mios.activebinding, component.id=36, service.id=251, service.bundleid=152, service.scope=bundle} - org.openhab.binding.mios
21:58:21.428 [DEBUG] [ab.binding.mios.internal.MiosBinding] - allBindingsChanged: start provider 'org.openhab.binding.mios.internal.MiosBindingProviderImpl@4a2abe'
21:58:21.431 [DEBUG] [ab.binding.mios.internal.MiosBinding] - MiosBinding activate()
21:58:21.433 [DEBUG] [ab.binding.mios.internal.MiosBinding] - MiosBinding deactivate()
21:58:21.446 [DEBUG] [ab.binding.mios.internal.MiosBinding] - allBindingsChanged: start provider 'org.openhab.binding.mios.internal.MiosBindingProviderImpl@4a2abe'
21:58:21.448 [DEBUG] [ab.binding.mios.internal.MiosBinding] - MiosBinding activate()
21:58:21.458 [DEBUG] [ab.binding.mios.internal.MiosBinding] - updated: Created Unit 'house'
21:58:21.460 [DEBUG] [ab.binding.mios.internal.MiosBinding] - registerAllWatches: start
21:58:21.461 [DEBUG] [ab.binding.mios.internal.MiosBinding] - registerAllWatches: provider 'class org.openhab.binding.mios.internal.MiosBindingProviderImpl'
21:58:21.463 [DEBUG] [ab.binding.mios.internal.MiosBinding] - MiosBinding deactivate()

21:58:23.277 [DEBUG] [ab.binding.mios.internal.MiosBinding] - allBindingsChanged: start provider 'org.openhab.binding.mios.internal.MiosBindingProviderImpl@4a2abe'
21:58:23.279 [DEBUG] [ab.binding.mios.internal.MiosBinding] - MiosBinding activate()

21:58:27.656 [DEBUG] [os.internal.config.MiosBindingConfig] - Successfully loaded UPnP Service Aliases from 'org/openhab/binding/mios/internal/config/ServiceAliases.properties', entries '133'
21:58:27.663 [DEBUG] [os.internal.config.MiosBindingConfig] - Successfully loaded Device Parameter defaults from 'org/openhab/binding/mios/internal/config/DeviceDefaults.properties', entries '23'
21:58:27.679 [DEBUG] [ios.internal.MiosBindingProviderImpl] - processBindingConfiguration: Adding Item 'VeraLastReloadTime' Binding 'unit:house,device:13/service/urn:upnp-ap15e-com:serviceId:LSI1/LastReloadTime', from 'maisonOH2.items'
21:58:27.682 [DEBUG] [ab.binding.mios.internal.MiosBinding] - bindingChanged: start provider 'org.openhab.binding.mios.internal.MiosBindingProviderImpl@4a2abe', itemName 'VeraLastReloadTime'
21:58:27.685 [DEBUG] [ab.binding.mios.internal.MiosBinding] - registerWatch: start miosProvider 'org.openhab.binding.mios.internal.MiosBindingProviderImpl@4a2abe', itemName 'VeraLastReloadTime'

No errors in the logs.

My mios.cfg is like that


My item is defined like that:

DateTime VeraLastReloadTime "Dernier Reload Vera [%1$tA %1$td %1$tR]" <calendar> (GVera) {mios="unit:house,device:13/service/urn:upnp-ap15e-com:serviceId:LSI1/LastReloadTime"}


I’ll reset my OH2 env in the next few days and take a look.

Note that there are general compatility problems in OH2. When resolved, maybe the Mios binding will work.

What "general compatibility issue to you refer to? As mentioned here, I rather suspect that some fix is required in the binding.

I am referring to the refresh service not started for several bindings + the other problems that were fixed very recently.

We can see in my logs that the binding is activated then deactivated and finally activated. Don’t kniw if it is normal and/or a clue.

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:

I’ve been the Vera/MiOS part of my Items file, via Eclipse, for the last 15 minutes and it seems to be behaving correctly.

NOTE: Remember to copy over the transforms/mios*.map files, or things won’t work correctly either :wink:

@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!

@guessed Great news. Did you test the action binding too ?

Not yet, that’s tricker.

A simple rule like this works perfectly under OH1.8, with no imports:

rule "Test sendMiosAction"
    Time cron "0/10 * * * * ?"
    sendMiosAction(GuestBedroom2LightsId, "HaDevice1/ToggleState")

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.

I just tested the last OH2 snapshot #102 with the last Mios binding snapshot 1.9 downloaded here: https://openhab.ci.cloudbees.com/job/openHAB1-Addons/ws/bundles/binding/org.openhab.binding.mios/target/org.openhab.binding.mios-1.9.0-SNAPSHOT.jar

When I start OH2, I get this error:

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]

I’m running it from Eclipse without the error, but I’ll add that to the TODO list for the build deployments.

The Binding uses that, and resolves correctly under OH1, but it’ll take a while for me to resolve why it’s not resolving under OH2

@guessed, forget my last message, I think I just forgot to install first the compatibility layer bundle.
Will try again.

Bingo; it seems to work now. Great, great. Will start more tests.

1 Like

I found 1 issue when I try to play with any dimming light:

22:37:04.123 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'LampeEntreeDim' received command 81
22:37:04.130 [ERROR] [ding.mios.internal.MiosUnitConnector] - callDevice: The parameter is in the wrong format.  BindingConfig 'unit:house,device:430/service/urn:upnp-org:serviceId:Dimming1/LoadLevelStatus,command:MAP(miosDimmerCommand.map)', UPnP Action '81'

Except that, I found nothing else wrong.

But I only played with the UI, no rule yet enabled. That is the next step.

PS: the same controls are working well in 1.8.

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 mios Action/Binding as well as the map transform:

package = standard
binding = mios
ui =  basic,paper
persistence = rrd4j,mapdb
action = mios
transformation = map
tts = 
misc = 

and I have the usual miosDimmerCommand.map manually installed into OH2’ transform directory:


PS: Where did the slider UI go? Under 1.8, there’s a clean Slider, but under OH 2 we’ve got the older style ^ v buttons.

I used HABdroid to test the dimming lights.

MAP transformation service is installed in my OH2 too.
And my file miosDimmerCommand.map (identical to yours) is present in my conf/transform directory.

Under 1.8 this is heavily broken, see

Waiting for an 1.8.1 to fix that - and it should also be ported to ESH by @sebastian, he cancelled a first try.

I created another topic thinking in a first time that my problem was something else but in fact my problem seems to be sendMiosAction.

@guessed: I don’t have same error as you.

@guessed: I opened issue 3926 for the binding.
An issue has to be opened for the MiOS action.