Shelly Binding

Hi @markus7017 , thanks for the new Californium and Element jar files. For me the new jars do not seem to be enough, I am on Openhab 3.3 and now there are addional dependency problems

org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.shelly [334]
  Unresolved requirement: Import-Package: org.eclipse.californium.core; version="[2.7.0,3.0.0)"
    -> Export-Package: org.eclipse.californium.core; bundle-symbolic-name="org.eclipse.californium.core"; bundle-version="2.7.3"; version="2.7.3"; uses:="org.eclipse.californium.core.coap,org.eclipse.californium.core.network,org.eclipse.californium.core.network.config,org.eclipse.californium.core.observe,org.eclipse.californium.core.server,org.eclipse.californium.core.server.resources,org.eclipse.californium.elements,org.eclipse.californium.elements.exception,org.slf4j"
       org.eclipse.californium.core [333]
         Unresolved requirement: Import-Package: org.eclipse.californium.elements.exception; version="[2.7.0,3.0.0)"
           -> Export-Package: org.eclipse.californium.elements.exception; bundle-symbolic-name="org.eclipse.californium.element-connector"; bundle-version="2.7.3"; version="2.7.3"
              org.eclipse.californium.element-connector [332]
                Unresolved requirement: Import-Package: net.i2p.crypto.eddsa; version="[0.3.0,1.0.0)"
         Unresolved requirement: Import-Package: org.eclipse.californium.elements; version="[2.7.0,3.0.0)"
           -> Export-Package: org.eclipse.californium.elements; bundle-symbolic-name="org.eclipse.californium.element-connector"; bundle-version="2.7.3"; version="2.7.3"; uses:="org.slf4j"
  Unresolved requirement: Import-Package: org.eclipse.californium.core.coap; version="[2.7.0,3.0.0)"
    -> Export-Package: org.eclipse.californium.core.coap; bundle-symbolic-name="org.eclipse.californium.core"; bundle-version="2.7.3"; version="2.7.3"; uses:="org.eclipse.californium.core,org.eclipse.californium.core.network,org.eclipse.californium.core.network.stack,org.eclipse.californium.core.server.resources,org.eclipse.californium.elements,org.eclipse.californium.elements.util,org.slf4j"

Anyone else getting these problems?

Regards,
Daniel

remove the 2 jars from the addons folder and try
‘feature:install openhab-transport-coap’ on the OH console

Thanks for your quick reply. That installs the dependencies back to Version 2.0.0 and the old error returns.

2022-10-02 12:11:05.765 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.shelly-3.4.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.shelly [344]
  Unresolved requirement: Import-Package: org.eclipse.californium.core; version="[2.7.0,3.0.0)"

issue ’ feature:list | grep coap’ on the console

that’s what I see on a OH 3.3 installtion

openhab-core-io-transport-coap                    │ 3.3.0            │          │ Uninstalled │ distro-3.3.0             │
openhab-transport-coap                            │ 3.3.0            │          │ Uninstalled │ distro-3.3.0             │ CoAP Transport
openhab.tp-coap                                   │ 3.3.0            │          │ Uninstalled │ distro-3.3.0             │ Californium CoAP library

I found the definition for openhab.tp-coap, as you can see it requires a good bunch of files

	<feature name="openhab.tp-coap" description="Californium CoAP library" version="${project.version}">
		<capability>openhab.tp;feature=coap;version=2.7.3</capability>
		<bundle>mvn:org.eclipse.californium/californium-osgi/2.7.3</bundle>
		<bundle>mvn:org.eclipse.californium/californium-core/2.7.3</bundle>
		<bundle>mvn:org.eclipse.californium/element-connector/2.7.3</bundle>
		<bundle>mvn:org.eclipse.californium/scandium/2.7.3</bundle>
		<bundle>mvn:org.eclipse.orbit.bundles/net.i2p.crypto.eddsa/0.3.0.v20220506-1020</bundle>
	</feature>

try

feature:install openhab-core-io-transport-coap
feature:install openhab.tp-coap
feature:install openhab-transport-coap 

I also created a .kar, which usually brings necessary dependencies
org.openhab.binding.shelly-3.4.0-SNAPSHOT.kar
remove the .jar before installing

Thanks again for your effort. All 3 mentioned features are already installed in my openhab 3.3 but it does not work, still the dependency problem with californium 2.0.0. Is the definition for openhab.tp-coap you posted from Version 3.3.0? Strange that it installs californium 2.0.0 then…

Then i tried your kar file, it also causes errors in my openhab 3.3

2022-10-02 15:19:08.826 [WARN ] [internal.service.FeaturesServiceImpl] - Can't load features repository mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/3.4.0-SNAPSHOT/xml/features
java.lang.RuntimeException: Error resolving artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:3.4.0-SNAPSHOT: [Could not find artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:3.4.0-SNAPSHOT in openhab (https://openhab.jfrog.io/openhab/libs-release/)] : mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/3.4.0-SNAPSHOT/xml/features
        at org.apache.karaf.features.internal.service.RepositoryImpl.load(RepositoryImpl.java:121) ~[bundleFile:?]
        at org.apache.karaf.features.internal.service.RepositoryImpl.<init>(RepositoryImpl.java:51) ~[bundleFile:?]
        at org.apache.karaf.features.internal.service.RepositoryCacheImpl.create(RepositoryCacheImpl.java:51) ~[bundleFile:?]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.getFeatureCache(FeaturesServiceImpl.java:611) [bundleFile:?]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.ensureCacheLoaded(FeaturesServiceImpl.java:582) [bundleFile:?]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.getRepository(FeaturesServiceImpl.java:530) [bundleFile:?]
        at org.apache.karaf.kar.internal.KarServiceImpl.findMissingDependency(KarServiceImpl.java:165) [bundleFile:?]
        at org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:116) [bundleFile:?]
        at org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:95) [bundleFile:?]
        at org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:87) [bundleFile:?]
        at org.apache.karaf.deployer.kar.KarArtifactInstaller.install(KarArtifactInstaller.java:50) [bundleFile:?]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:950) [bundleFile:3.7.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:884) [bundleFile:3.7.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:489) [bundleFile:3.7.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.7.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.7.4]
Caused by: java.io.IOException: Error resolving artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:3.4.0-SNAPSHOT: [Could not find artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:3.4.0-SNAPSHOT in openhab (https://openhab.jfrog.io/openhab/libs-release/)]
        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.configureIOException(AetherBasedResolver.java:803) ~[?:?]
        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:774) ~[?:?]
        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:657) ~[?:?]
        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:598) ~[?:?]
        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:565) ~[?:?]
        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:555) ~[?:?]
        at org.ops4j.pax.url.mvn.internal.Connection.getInputStream(Connection.java:123) ~[?:?]
        at java.net.URL.openStream(URL.java:1165) ~[?:?]
        at org.apache.karaf.features.internal.service.RepositoryImpl.load(RepositoryImpl.java:114) ~[bundleFile:?]
        ... 15 more

The binding was “active” due to “bundle:list” but had a strange version and name and did not work:

348 │ Active │  80 │ 0                      │ wrap_file__var_lib_openhab_tmp_kar_org.openhab.binding.shelly-3.4.0-SNAPSHOT_org_lastnpe_eea_eea-all_2.2.1_eea-all-2.2.1.jar

Regards,
Daniel

I expect that OH 3.3 comes with Californium 2.0, whereas 3.4 milestone build has switched to 2.7

I added the jar build to the Community Market Place, The binding does not yet show up, you need to enable the market place and previews (both options in Settings:Community Marketplace)

  • remove the files from the addons folder
  • Go to Settings:Bindings and search for “Shelly Beta with Plus/Pro support”
  • install the binding

Hi Markus,

thanks again, I see the binding in the marketplace but when I install it nothing happens. No binding/bundle ist listed in karaf console, nothing in the logfiles. A little crazy, would at least expect some logfile entries about the install or a failure…

try again, I changed the url

as always: If something has changed it might require adjustments. When installing the binding from the UI the loader automatically resolves dependencies like we have with Coap/Californium, but if you copy the jar to the addons folder you need to do the prep yourself. Obviously the included Coap version has changed + the bundle now requires more files then 2.0.

thanks for helping

Hi Markus,

nothing to thank for, I have to thank for your work and kind support!

I tried again to install but get an error in the UI when trying to install:

grafik

Sadly nothing in the logfiles to further indicate what went wrong.

:crazy_face:

I think something is wrong with definition of openhab-transport-coap in 3.4M2. It installed version 2.0.0, whereas the build environment references 2.7.3. I setup a test environment and need to investigate.

Does somebody else has 3.4 M2+ with the binding running?

I found this PR

and this one

That could cause the situation that 3.3/3.4M2 needs Californium 2.0, whereas new builds require 2.7.3

for now try the previous build: https://github.com/markus7017/myfiles/blob/a12594a9967f98f5c4fac54f668fd406664f5b16/shelly/org.openhab.binding.shelly-3.4.0-SNAPSHOT.jar?raw=true

1 Like

Hi Markus,

thanks for the link to the older jar, this one works like a charm for my shelly 1 plus. Thanks a lot and hopefully the binding with gen2 support will come with 3.4 :slight_smile:

Thanks for your work, great support and kind regards,
Daniel

With the previous build you linked to i can see all channels for dimmer2.
So now everything is working.

1 Like

Me too,
i was not seeing the channel Power2 of a Shelly 2.5 with the previous build is ok.

Hello @markus7017 ,

now I had the time to test again.

I just copied latest build from you into my add-on folder. Shelly2pm+ is now found and working (in Switch mode).
I didn’t use californium 2.7!

Thx, I’m very happy with this!! :slight_smile:

CU Frank

Status is as follows

  • OH 3.3…3.4M2 bringt Californium 2.0
  • 2 weeks ago they bumped the version to 2.7.3
  • a new build of the binding will be build with this dependency
  • 3.4M3 will bringt Californium 2.7.3
  • it doesn’t work if the dependency in the binding jar doesn’t match the OH platform
  • at the moment I’m looking for a way to build a new 3.3 version
2 Likes

I think I found a solution

  • 3.4.0-M2 build, which also serves 3.3.0
  • 3.4.0-M3 build, which runs on the current SNAPSHOT build of the Distro and M3+

Please help testing, I have on the 3.4-SNAPSHOT environment. When copying the jar to the addons folder make sure to delete the existing one (different name). Use bundle:list to see status, the new builds show up as “Shelly Binding for Gen1+2”.

Hi markus,

I did test your 3.4.0-M2 on my OH 3.3.0 regarding the shelly 1 plus device but I only get status Offline with error message: unexpected error: WebSocket connection closed abnormal. Older devices like shelly1 and shellyswitch25 are working fine.

In openhab.log I do not get an error message, I just found “Added new thing ‘shelly:shellyplus1:3c610572ed5c’ to inbox.” there.

Under Bundle:List I have the follwoing entry:

257 │ Active │ 80 │ 3.4.0.202210071549 │ openHAB Add-ons :: Bundles :: Sh

I fixed a JSON parsing problem and improved logging in this situation, please try again