Shelly Binding

@markus7017 adding a +1 for the support of the Shelly1 Plus in Openhab. This would be awesome!
Many thanks,
Dan

Are you in a routed network? Try to go into the Shelly Web UI:Settings:COAP and set the IP address to the OH IP. I assume that device triggers the update, because the binding doesn‘t get the network packet. This could also happen when using docker

me too: +1 for Plus/Pro support
I already received the pre-final version of the devices incl TRV and 1/1PM/2/2PM Pro, but this real work, because the device api has changed

Stay tuned

I don’t have any COAP settings in the webui of the shelly button. I am running openhab in Docker, will move back to a Raspberry as soon as I migrated everything from 2.x

try a plain OH setup on the RPi

Can we support you? Is there anything we can do?

just a matter of time

I tried it on my old OH 2.x setup, no luck, but probably because of the old binding.

I noticed another thing, it reports SHBTN-2 instead of SHBTN-1

coapDeviceDescr:
{"blk":[{"I":1,"D":"sensor_0"},{"I":2,"D":"device"}],"sen":[{"I":9103,"T":"EVC","D":"cfgChanged","R":"U16","L":2},{"I":2102,"T":"EV","D":"inputEvent","R":["S/L/SS/SSS",""],"L":1},{"I":2103,"T":"EVC","D":"inputEventCnt","R":"U16","L":1},{"I":3115,"T":"S","D":"sensorError","R":"0/1","L":1},{"I":3112,"T":"S","D":"charger","R":["0/1","-1"],"L":2},{"I":3111,"T":"B","D":"battery","R":["0/100","-1"],"L":2},{"I":9102,"T":"EV","D":"wakeupEvent","R":["battery/button/periodic/poweron/sensor/ext_power","unknown"],"L":2}]}

Is there a channel available for the Button-Type Setting of a Shelly-Relay?

I have a light, that is triggered by a motion-sensor attached to SW1. Between 9 PM and 6 AM the motion-sensor should not trigger the light anymore. I thought the easiest way to do this would be to change button-mode to detached after 9 PM and set it back to ‘Activation Switch’ at 6 AM.

Is that possible?

Kindest regards,
Christian…

Hey Markus,
after adding a new Shelly RGBW2 I get the following error message. However, the thing is being created and is online.

2021-12-11 18:27:58.635 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.StackOverflowError: null
	at java.net.URI$Parser.scan(URI.java:3059) ~[?:?]
	at java.net.URI$Parser.scanIPv4Address(URI.java:3353) ~[?:?]
	at java.net.URI$Parser.parseIPv4Address(URI.java:3393) ~[?:?]
	at java.net.URI$Parser.parseServer(URI.java:3295) ~[?:?]
	at java.net.URI$Parser.parseAuthority(URI.java:3216) ~[?:?]
	at java.net.URI$Parser.parseHierarchical(URI.java:3158) ~[?:?]
	at java.net.URI$Parser.parse(URI.java:3114) ~[?:?]
	at java.net.URI.<init>(URI.java:600) ~[?:?]
	at java.net.URI.create(URI.java:881) ~[?:?]
	at org.eclipse.jetty.client.HttpClient.newRequest(HttpClient.java:453) ~[?:?]
	at org.openhab.binding.shelly.internal.api.ShellyHttpApi.innerRequest(ShellyHttpApi.java:579) ~[?:?]
	at org.openhab.binding.shelly.internal.api.ShellyHttpApi.request(ShellyHttpApi.java:551) ~[?:?]
	at org.openhab.binding.shelly.internal.api.ShellyHttpApi.callApi(ShellyHttpApi.java:541) ~[?:?]
	at org.openhab.binding.shelly.internal.api.ShellyHttpApi.getCoIoTDescription(ShellyHttpApi.java:255) ~[?:?]
	at org.openhab.binding.shelly.internal.coap.ShellyCoapHandler.discover(ShellyCoapHandler.java:550) ~[?:?]
	at org.openhab.binding.shelly.internal.coap.ShellyCoapHandler.handleDeviceDescription(ShellyCoapHandler.java:358) ~[?:?]
	at org.openhab.binding.shelly.internal.coap.ShellyCoapHandler.discover(ShellyCoapHandler.java:553) ~[?:?]
	at org.openhab.binding.shelly.internal.coap.ShellyCoapHandler.handleDeviceDescription(ShellyCoapHandler.java:358) ~[?:?]
	at org.openhab.binding.shelly.internal.coap.ShellyCoapHandler.discover(ShellyCoapHandler.java:553) ~[?:?]

the last line is being repeated over hundreds of pages.
In shelly manger not all the details are available.

deleting and readding does not solve the problem.
Furthermore, this device is triggered by a rule. As of today I also note, that my CPU usage is in average at 380%.
Binding version: 3.2M5

EDIT: there is definitely something wrong.
restarting OH: CPU usage goes up to 150% after a few minutes.
Disabling the newly created device: CPU usage stays the same
restarting OH and keeping thing disabled: CPU usage 2%

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

Next version will contain a shellybutton2 as copy of btn-1, then you can test

@hmerk

fyi: I’m working on integration

1 Like

Sounds very promising…

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