Shelly Binding

Of course if logging consumes resources
It seems to be a problem with the IP address going into the device URL. Was the device auto-discovered, added manual or added by a .things file?

Enable TRACE log and we see the URL

In theory yes, but why are you not implementing this handling in a rule?

If I do the complete motion-handling in a rule, then the light has the dependency that openhab must run to be functional.
Right now, with the shelly-integrated auto-off-timer, it works even if openhab is down.

That´s how my complete smarthome is build. If OpenHAB is down, the basic functions are still possible manually, if OpenHAB is running additional functionality is possible. In this special case this means, I can trigger the light, even if there is no motion detected.

Or do you mean a role, that switches the button mode by using direct API-calls?

in fact you could change the button mode using curl commands and include them in a script being triggered in the OH rule or a cron job, or you use the http binding and attach those to an item, check API doc for details or just use chrome and fetch the URL from the dev console when using the Web UI

1 Like

Thank you, that was the push in the right direction.

http://<IPADDR>/settings/relay/0?btn_type=action

and

http://<IPADDR>/settings/relay/0?btn_type=detached

can be used to switch to the needed button-type (activation-mode and detached)

Hi Markus,
the device is added through scan (autodiscovery)

what I wanted to say is, that after a few minutes after restart, i.e. when all the startup is done the regular CPU usage is typically at 1-2% for my OH server. But not when this device is activated, then CPU usage stays at 150%.

Here is the logtrace:
trace log.txt (7.2 KB)
That block is being repeated forever…

fyi: If you are not already aware - one more reason to upgrade your OH

i try to use a shelly 2.5 for roller shutter and will read the trigger events … but i don’t see the events in openhab.

rule "Shelly Event"
when
    Channel "shelly:shelly25-roller:68fa41:roller#event" triggered
then
        logInfo("Shelly", "an event was detected")
//Do the tilting stuff
end

am i making a mistake? in my opinion it should fit like this
the control of the rollershutter works fine

Did you setup the URL manually? I would expect roller_open instead of ROLLER_OPEN
Enable DEBUG log, this shows incoming events

fyi: First version for TRV https://github.com/markus7017/myfiles/blob/master/shelly/org.openhab.binding.shelly-3.2.0-SNAPSHOT.jar?raw=true

  • Language resources updated (fixed/more consistent)
  • Shelly TRV support
  • Shelly Button 2 - same handling as Button-1, never saw this device

The TRV valve position is implemented as r/w channel. The device already provides the current status, but the API is lacking the option to set the position. This can be expected in the next fw release.

1 Like

thanks, that with roller_open solved my problem. now i receive the triggers

Is there a possibility to set the total & total_returned values on the Shelly device itself to something else? I had a power outage and my Shelly 3EM started counting from 0 again. Now my database is not so pretty :slight_smile:

I was able to play a bit with API and was able to change things like the name (POST http://192.168.0.35/settings?name=shellytest, tranfsformer type (POST http://192.168.0.35/settings/emeter/0?ctraf_type=120), but when I do eg POST http://192.168.0.35/emeter/0?total=20, the command is accepted, but nothing changes.
API Reference

Anybody has experience with this? Otherxise I will need to edit the values in my db, so everything matches again.

edit: if this is not possible in the Shelly device, I just found out that I can set a profile offset on the item, so I can correct it from here.

edit2: I received a message from Shelly that this is not possible

Today i’ve started to work a little bit more with CoIoT and set my openhab ip to all devices to reduce mcast in the network.

Now i have problems with 4 devices:
Plug S (PS01) - IP: 10.10.21.9
Plug S (PS04) - IP: 10.10.21.94

H&T (HT09) - IP: 10.10.21.24
H&T (HT03) - IP: 10.10.21.243

PS01 is getting its own channel data
and additionally the data from PS04

Same Issue on HT09, its getting its own data and the data of HT03

Here is an example of the log:

2021-12-15 21:22:38.513 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ht09_Temperatur' changed from 18.3 °C to 22.9 °C
2021-12-15 21:24:44.354 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ht09_Temperatur' changed from 22.9 °C to 18.3 °C
2021-12-15 21:32:47.761 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ht09_Temperatur' changed from 18.3 °C to 23.3 °C
2021-12-15 21:35:23.040 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ht09_Temperatur' changed from 23.3 °C to 18.1 °C
2021-12-15 21:38:01.188 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ht09_Temperatur' changed from 18.1 °C to 22 °C
2021-12-15 21:40:28.482 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ht09_Temperatur' changed from 22 °C to 18.1 °C
2021-12-15 21:43:15.591 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ht09_Temperatur' changed from 18.1 °C to 21.6 °C
2021-12-15 21:45:32.807 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ht09_Temperatur' changed from 21.6 °C to 18.1 °C
2021-12-15 21:48:29.129 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ht09_Temperatur' changed from 18.1 °C to 21.6 °C
2021-12-15 21:53:01.646 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ht09_Temperatur' changed from 21.6 °C to 17.9 °C
2021-12-15 21:53:43.855 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ht09_Temperatur' changed from 17.9 °C to 21.5 °C

The temperature around 18 °C is the value of HT03
The temperature around 22 °C is the value of HT09

2021-12-15 22:21:52.871 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ps01_Leistung' changed from 0 W to 0.83 W
2021-12-15 22:21:53.215 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ps01_Leistung' changed from 0.83 W to 0 W
2021-12-15 22:22:07.859 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ps01_Leistung' changed from 0 W to 0.85 W
2021-12-15 22:22:08.351 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ps01_Leistung' changed from 0.85 W to 0 W

Same here … PS01 has no power usage (nothing connected) and PS04 is using a littlebit more than 0.8W.

After changing the IP of HT09 to 10.10.21.100 the problem stopt for the H&Ts.

Before changing from mcast to ucast, there was no problem with this.

I’ve tested this issue with the stable version of the shelly binding and the 3.2.0.202112131842, the issue persist.

I also tested to swith the both Plug S back to mcast, but it didn’t solved the problem.

Maybe one solution will be to change all shelly devices to ip-addresses higher than 100 … but its no good solution :smiley:

I’m not sure of this is a bug or if i’m doing something wrong. Can any one help me please?

Hi all,

first of all merry xmas to you all here. Since a reboot of my PI this morning I all my shelly devices are “uncontrolable” and I get the following message I have never seen before:

shellyswitch25-68c63afb89e6: Unable to initialize CoAP access (network error)

I have already tried to disable CoIoT, but no effect. Does anybody know what this is and how to resolve?

Scuby

restart OH and/or host system

1 Like

Can someone help me?

Hi @markus7017

First I wish you a happy new year!

Why do I get this error

2022-01-01 11:25:13.289 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.shelly-3.3.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.shelly [304]
Unresolved requirement: Import-Package: org.eclipse.californium.core; version="[2.0.0,3.0.0)"
at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.300.jar:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:445) ~[org.eclipse.osgi-3.16.300.jar:?]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.7.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.7.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.7.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.7.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.7.2]

when I put org.openhab.binding.shelly-3.2.0-SNAPSHOT.jar in the addons folder of the openhab installation?

I want to do this to make a test of my pull request #11918

Many thanks for your help.

Happy new year to everyone!

Does the new .jar works with Plus devices?

Hello @rose78 ,

Have you also copied the additional JAR files to the addon folder (or alternatively installed Tradfi Binding)?
See “Installing DEV build” → myfiles/READMEbeta.md at master · markus7017/myfiles · GitHub

Hello @igi

When I also add the tradfri Binding, I get this two errors:

2022-01-01 12:10:14.303 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.tradfri-3.3.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.tradfri [313]
Unresolved requirement: Import-Package: org.eclipse.californium.core; version="[2.0.0,3.0.0)"
at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.300.jar:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:445) ~[org.eclipse.osgi-3.16.300.jar:?]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.7.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.7.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.7.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.7.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.7.2]

2022-01-01 12:10:14.307 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.shelly-3.3.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.shelly [314]
Unresolved requirement: Import-Package: org.eclipse.californium.core; version="[2.0.0,3.0.0)"
at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.300.jar:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:445) ~[org.eclipse.osgi-3.16.300.jar:?]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.7.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.7.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.7.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.7.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.7.2]

@rose78 Please just download the 3 JAR files:

californium-core-2.0.0.jar
element-connector-2.0.0.jar
org.openhab.binding.shelly-3.2.0-SNAPSHOT.jar

and copy them to the addon folder. Before that, make sure that the official Shelly Binding version has been uninstalled.
Also make sure that there is no other DEV version of Shelly Binding in the addon folder.