delid4ve / openhab-3.x-sonoff

Openhab Binding for Sonoff Devices
26 stars 11 forks source link

Installation fails on openhab 3.2 #16

Closed giamma closed 2 years ago

giamma commented 2 years ago

Hi,

I tried to install this binding in openhab 3.2, but the installation fails. I dropped the bundle in the addons folder, but when I try to start it from the openhab console the bundle fails to start as it requires javax.measure 1.0 which is not included in openhab.

I added to the addons folder the javax.measure 1.0 bundle but again this binding fails to start due to a uses-conflict. Apparently open-hab 3.2 uses javax.measure 2.x and when this bundle gets started it will fail as it will find in its dependency chain both versions of javax.measure:

Error starting bundle 238: Could not resolve module: org.openhab.binding.sonoff [238]
  Bundle was not resolved because of a uses constraint violation.
  org.apache.felix.resolver.reason.ReasonException: Uses constraint violation. Unable to resolve resource org.openhab.binding.sonoff [osgi.identity; type="osgi.bundle"; version:Version="3.1.0.202104261602"; osgi.identity="org.openhab.binding.sonoff"] because it is exposed to package 'javax.measure' from resources javax.measure.unit-api [osgi.identity; osgi.identity="javax.measure.unit-api"; type="osgi.bundle"; version:Version="1.0.0.v20170818-1538"] and javax.measure.unit-api [osgi.identity; type="osgi.bundle"; version:Version="2.1.3"; osgi.identity="javax.measure.unit-api"] via two dependency chains.

Chain 1:
  org.openhab.binding.sonoff [osgi.identity; type="osgi.bundle"; version:Version="3.1.0.202104261602"; osgi.identity="org.openhab.binding.sonoff"]
    import: (&(osgi.wiring.package=javax.measure)(&(version>=1.0.0)(!(version>=2.0.0))))
     |
    export: osgi.wiring.package: javax.measure
  javax.measure.unit-api [osgi.identity; osgi.identity="javax.measure.unit-api"; type="osgi.bundle"; version:Version="1.0.0.v20170818-1538"]

Chain 2:
  org.openhab.binding.sonoff [osgi.identity; type="osgi.bundle"; version:Version="3.1.0.202104261602"; osgi.identity="org.openhab.binding.sonoff"]
    import: (osgi.wiring.package=org.openhab.core.config.discovery)
     |
    export: osgi.wiring.package=org.openhab.core.config.discovery; uses:=org.openhab.core.i18n
  org.openhab.core.config.discovery [osgi.identity; type="osgi.bundle"; version:Version="3.2.0"; osgi.identity="org.openhab.core.config.discovery"]
    import: (&(osgi.wiring.package=org.openhab.core.i18n)(&(version>=3.2.0)(!(version>=4.0.0))))
     |
    export: osgi.wiring.package=org.openhab.core.i18n; uses:=javax.measure
  org.openhab.core [osgi.identity; type="osgi.bundle"; version:Version="3.2.0"; osgi.identity="org.openhab.core"]
    import: (&(osgi.wiring.package=javax.measure)(&(version>=2.1.0)(!(version>=3.0.0))))
     |
    export: osgi.wiring.package: javax.measure
  javax.measure.unit-api [osgi.identity; type="osgi.bundle"; version:Version="2.1.3"; osgi.identity="javax.measure.unit-api"]
delid4ve commented 2 years ago

Are you using the r10 version from my sonoff compiled repo or one from here (this is not up to date)

giamma commented 2 years ago

Hello,

thanks for the quick reply. I am using the following binary from the compiled repo:

org.openhab.binding.sonoff-3.1.0-SNAPSHOT_2.5r1.jar

giamma commented 2 years ago

Sorry my mistake I went straight into the 3.x archive, did not notice there was a recent build in the root of the compiled repo. I am going to try that one.

giamma commented 2 years ago

The bundle now properly resolves and starts but when I try to create the account Openhab tells me there is no binding installed 241 │ Active │ 80 │ 3.2.0.202110181423 │ openHAB Add-ons :: Bundles :: sonoff Binding

immagine
giamma commented 2 years ago

After a couple of restarts problem is disappeared.