Shelly Binding

just linking this post here if some of the shelly cracks here have a good solution for channel-based triggers

Hey Markus,
are you still using this rule?
How do you get the name of the triggering channel?
AFAIK there is only receivedEvent available as implicit variable

My I ask where is Shelly Manager. I am total beginner. :confused:

/shelly/manager behind your openhab URL

1 Like

There is documentation :wink:

1 Like

Try updated DEV build - I made a change, but won’t expect that this changes anything
What is the output in events.log. If I read the DEBUG log correctly the binding receives the event and updates the channel, I can’t see if the item is updated (that’s handled by the framework)


Latest DEV builds: 2.5.13 - 3.1.0 - README - Installation - Avdanced Users - Shelly Manager - Bugs/Features - Firmware Index - Firmware Archive - API Doc
Note: The DEV build is always newer than the version in the official Distro or the Milestone builds (SNAPSHOTs); OH Distro 2.5 will not receive updates anymore, so you have to switch to DEV build when running OH 2.5, see installation notes.

Hi,

I am having a strange issue with one of my Shelly RGBW2. The ON-OFF state is flipping for the device. I checked and on the device UI the state is not flipping; also on MQTT I cannot see any messages that the state would flip. Ofc when the state flips to ON IRL it is off. I recently changed from Home Assistant where I’ve never seen such issue. This is happening for the second time in the past 4 weeks. OH Restart is not solving the issue.

events log:

2021-04-08 10:45:00.206 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from ON to OFF
2021-04-08 10:45:11.718 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from OFF to ON
2021-04-08 10:45:13.376 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from ON to OFF
2021-04-08 10:45:14.813 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from OFF to ON
2021-04-08 10:45:15.234 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from ON to OFF
2021-04-08 10:45:26.718 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from OFF to ON
2021-04-08 10:45:28.355 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from ON to OFF
2021-04-08 10:45:29.814 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from OFF to ON
2021-04-08 10:45:30.240 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from ON to OFF
2021-04-08 10:45:41.727 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from OFF to ON
2021-04-08 10:45:43.401 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from ON to OFF
2021-04-08 10:45:44.895 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from OFF to ON
2021-04-08 10:45:45.259 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from ON to OFF
2021-04-08 10:45:56.732 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from OFF to ON
2021-04-08 10:45:58.376 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from ON to OFF
2021-04-08 10:46:00.088 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from OFF to ON
2021-04-08 10:46:00.207 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from ON to OFF
2021-04-08 10:46:11.737 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from OFF to ON
2021-04-08 10:46:13.376 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from ON to OFF
2021-04-08 10:46:15.095 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from OFF to ON
2021-04-08 10:46:15.232 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from ON to OFF
2021-04-08 10:46:26.867 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from OFF to ON
2021-04-08 10:46:28.353 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from ON to OFF
2021-04-08 10:46:30.250 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from OFF to ON
2021-04-08 10:46:32.950 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from ON to OFF
2021-04-08 10:46:41.870 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RGBWLedStripLivingRoom_Power' changed from OFF to ON

openhab log Shelly - TRACE

2021-04-08 10:45:04.989 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellyrgbw2-6f856c: CoIoT Message from /192.168.2.2:5683 (MID=58978): {"G":[[0,9103,0],[0,1101,0],[0,5105,0],[0,5106,0],[0,5107,0],[0,5108,30],[0,5102,0],[0,4101,0.00],[0,4103,0],[0,6102,0],[0,2101,0],[0,2102,""],[0,2103,0],[0,9101,"color"]]}
2021-04-08 10:45:04.990 [DEBUG] [lly.internal.util.ShellyChannelCache] - shellyrgbw2-6f856c: Channel device#heartBeat updated with 2021-04-08T10:45:04.000+0200 (type class org.openhab.core.library.types.DateTimeType).
2021-04-08 10:45:04.990 [TRACE] [y.internal.handler.ShellyBaseHandler] - shellyrgbw2-6f856c: Watchdog restarted (expires in 70 sec)
2021-04-08 10:45:04.990 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellyrgbw2-6f856c: Serial 256 was already processed, ignore update
2021-04-08 10:45:19.989 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellyrgbw2-6f856c: CoIoT Message from /192.168.2.2:5683 (MID=58979): {"G":[[0,9103,0],[0,1101,0],[0,5105,0],[0,5106,0],[0,5107,0],[0,5108,30],[0,5102,0],[0,4101,0.00],[0,4103,0],[0,6102,0],[0,2101,0],[0,2102,""],[0,2103,0],[0,9101,"color"]]}
2021-04-08 10:45:19.989 [DEBUG] [lly.internal.util.ShellyChannelCache] - shellyrgbw2-6f856c: Channel device#heartBeat updated with 2021-04-08T10:45:19.000+0200 (type class org.openhab.core.library.types.DateTimeType).
2021-04-08 10:45:19.989 [TRACE] [y.internal.handler.ShellyBaseHandler] - shellyrgbw2-6f856c: Watchdog restarted (expires in 70 sec)
2021-04-08 10:45:19.989 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellyrgbw2-6f856c: Serial 256 was already processed, ignore update
2021-04-08 10:45:35.008 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellyrgbw2-6f856c: CoIoT Message from /192.168.2.2:5683 (MID=58980): {"G":[[0,9103,0],[0,1101,0],[0,5105,0],[0,5106,0],[0,5107,0],[0,5108,30],[0,5102,0],[0,4101,0.00],[0,4103,0],[0,6102,0],[0,2101,0],[0,2102,""],[0,2103,0],[0,9101,"color"]]}
2021-04-08 10:45:35.008 [DEBUG] [lly.internal.util.ShellyChannelCache] - shellyrgbw2-6f856c: Channel device#heartBeat updated with 2021-04-08T10:45:35.000+0200 (type class org.openhab.core.library.types.DateTimeType).
2021-04-08 10:45:35.008 [TRACE] [y.internal.handler.ShellyBaseHandler] - shellyrgbw2-6f856c: Watchdog restarted (expires in 70 sec)
2021-04-08 10:45:35.008 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellyrgbw2-6f856c: Serial 256 was already processed, ignore update

Right now I am on OH 3.1.0M3, but earlier this happend on 3.1.0M1 as well. The logs here are filtered to this single device I have the problem with.

Hey Markus,
this is again about receiving a trigger from shelly1 (shelly:shelly1::relay#button) when button is in detached mode. this is currently not working. on shelly ix3 this is working fine. I am on OH3.1 M3, no dev build, shelly-FW v1.10.1-gf276b51

  1. shelly status before button press:
{"wifi_sta":{"connected":true,"ssid":"myWLAN2","ip":"192.168.178.78","rssi":-65},"cloud":{"enabled":false,"connected":false},"mqtt":{"connected":false},"time":"20:34","unixtime":1617906873,"serial":46,"has_update":false,"mac":"84CCA8A87EC1","cfg_changed_cnt":2,"actions_stats":{"skipped":0},"relays":[{"ison":false,"has_timer":false,"timer_started":0,"timer_duration":0,"timer_remaining":0,"source":"timer"}],"meters":[{"power":0.00,"is_valid":true}],"inputs":[{"input":0,"event":"","event_cnt":11}],"ext_sensors":{},"ext_temperature":{},"ext_humidity":{},"update":{"status":"idle","has_update":false,"new_version":"20210323-104500/v1.10.1-gf276b51","old_version":"20210323-104500/v1.10.1-gf276b51","beta_version":"20210405-091013/v1.10.2-rc5-gc86c23a"},"ram_total":50224,"ram_free":36072,"fs_size":233681,"fs_free":149094,"uptime":12640}
  1. shelly status after button press:
{"wifi_sta":{"connected":true,"ssid":"myWLAN2","ip":"192.168.178.78","rssi":-67},"cloud":{"enabled":false,"connected":false},"mqtt":{"connected":false},"time":"20:35","unixtime":1617906921,"serial":49,"has_update":false,"mac":"84CCA8A87EC1","cfg_changed_cnt":2,"actions_stats":{"skipped":0},"relays":[{"ison":false,"has_timer":false,"timer_started":0,"timer_duration":0,"timer_remaining":0,"source":"timer"}],"meters":[{"power":0.00,"is_valid":true}],"inputs":[{"input":0,"event":"","event_cnt":12}],"ext_sensors":{},"ext_temperature":{},"ext_humidity":{},"update":{"status":"idle","has_update":false,"new_version":"20210323-104500/v1.10.1-gf276b51","old_version":"20210323-104500/v1.10.1-gf276b51","beta_version":"20210405-091013/v1.10.2-rc5-gc86c23a"},"ram_total":50224,"ram_free":36952,"fs_size":233681,"fs_free":146835,"uptime":12688}

from the event count you can see that button press is registered: {“input”:0,“event”:"",“event_cnt”:12}

Trace log before and after button press.
button press was between 20:34:29.196 and 20:35:30.464

2021-04-08 20:34:29.049 [TRACE] [y.internal.handler.ShellyBaseHandler] - shelly1-84cca8a87ec1: Updating status (refreshSettings=false)
2021-04-08 20:34:29.050 [TRACE] [ng.shelly.internal.api.ShellyHttpApi] - shelly1-84cca8a87ec1: HTTP GET for http://192.168.178.78/status
2021-04-08 20:34:29.121 [TRACE] [ng.shelly.internal.api.ShellyHttpApi] - shelly1-84cca8a87ec1: HTTP Response 200: {"wifi_sta":{"connected":true,"ssid":"myWLAN2","ip":"192.168.178.78","rssi":-66},"cloud":{"enabled":false,"connected":false},"mqtt":{"connected":false},"time":"20:34","unixtime":1617906869,"serial":45,"has_update":false,"mac":"84CCA8A87EC1","cfg_changed_cnt":1,"actions_stats":{"skipped":0},"relays":[{"ison":false,"has_timer":false,"timer_started":0,"timer_duration":0,"timer_remaining":0,"source":"timer"}],"meters":[{"power":0.00,"is_valid":true}],"inputs":[{"input":0,"event":"","event_cnt":11}],"ext_sensors":{},"ext_temperature":{},"ext_humidity":{},"update":{"status":"idle","has_update":false,"new_version":"20210323-104500/v1.10.1-gf276b51","old_version":"20210323-104500/v1.10.1-gf276b51","beta_version":"20210405-091013/v1.10.2-rc5-gc86c23a"},"ram_total":50224,"ram_free":37168,"fs_size":233681,"fs_free":149847,"uptime":12636}
2021-04-08 20:34:29.124 [DEBUG] [lly.internal.util.ShellyChannelCache] - shelly1-84cca8a87ec1: Channel device#heartBeat updated with 2021-04-08T20:34:29.000+0200 (type class org.openhab.core.library.types.DateTimeType).
2021-04-08 20:34:29.126 [TRACE] [y.internal.handler.ShellyBaseHandler] - shelly1-84cca8a87ec1: Watchdog restarted (expires in 70 sec)
2021-04-08 20:34:29.127 [TRACE] [.internal.handler.ShellyRelayHandler] - shelly1-84cca8a87ec1: Updating 1 relay(s)
2021-04-08 20:34:29.129 [TRACE] [ng.shelly.internal.api.ShellyHttpApi] - shelly1-84cca8a87ec1: HTTP GET for http://192.168.178.78/status/relay/0
2021-04-08 20:34:29.196 [TRACE] [ng.shelly.internal.api.ShellyHttpApi] - shelly1-84cca8a87ec1: HTTP Response 200: {"wifi_sta":{"connected":true,"ssid":"myWLAN2","ip":"192.168.178.78","rssi":-66},"cloud":{"enabled":false,"connected":false},"mqtt":{"connected":false},"time":"20:34","unixtime":1617906869,"serial":45,"has_update":false,"mac":"84CCA8A87EC1","cfg_changed_cnt":1,"actions_stats":{"skipped":0},"relays":[{"ison":false,"has_timer":false,"timer_started":0,"timer_duration":0,"timer_remaining":0,"source":"timer"}],"meters":[{"power":0.00,"is_valid":true}],"inputs":[{"input":0,"event":"","event_cnt":11}],"ext_sensors":{},"ext_temperature":{},"ext_humidity":{},"update":{"status":"idle","has_update":false,"new_version":"20210323-104500/v1.10.1-gf276b51","old_version":"20210323-104500/v1.10.1-gf276b51","beta_version":"20210405-091013/v1.10.2-rc5-gc86c23a"},"ram_total":50224,"ram_free":38576,"fs_size":233681,"fs_free":149847,"uptime":12636}
2021-04-08 20:34:29.199 [DEBUG] [lly.internal.util.ShellyChannelCache] - shelly1-84cca8a87ec1: Channel device#uptime updated with 12636 s (type class org.openhab.core.library.types.QuantityType).
2021-04-08 20:34:29.201 [TRACE] [y.internal.handler.ShellyBaseHandler] - shelly1-84cca8a87ec1: Watchdog restarted (expires in 70 sec)
2021-04-08 20:35:29.206 [TRACE] [y.internal.handler.ShellyBaseHandler] - shelly1-84cca8a87ec1: Updating status (refreshSettings=false)
2021-04-08 20:35:29.208 [TRACE] [ng.shelly.internal.api.ShellyHttpApi] - shelly1-84cca8a87ec1: HTTP GET for http://192.168.178.78/status
2021-04-08 20:35:30.464 [TRACE] [ng.shelly.internal.api.ShellyHttpApi] - shelly1-84cca8a87ec1: HTTP Response 200: {"wifi_sta":{"connected":true,"ssid":"myWLAN2","ip":"192.168.178.78","rssi":-67},"cloud":{"enabled":false,"connected":false},"mqtt":{"connected":false},"time":"20:35","unixtime":1617906930,"serial":49,"has_update":false,"mac":"84CCA8A87EC1","cfg_changed_cnt":2,"actions_stats":{"skipped":0},"relays":[{"ison":false,"has_timer":false,"timer_started":0,"timer_duration":0,"timer_remaining":0,"source":"timer"}],"meters":[{"power":0.00,"is_valid":true}],"inputs":[{"input":0,"event":"","event_cnt":12}],"ext_sensors":{},"ext_temperature":{},"ext_humidity":{},"update":{"status":"idle","has_update":false,"new_version":"20210323-104500/v1.10.1-gf276b51","old_version":"20210323-104500/v1.10.1-gf276b51","beta_version":"20210405-091013/v1.10.2-rc5-gc86c23a"},"ram_total":50224,"ram_free":37108,"fs_size":233681,"fs_free":146333,"uptime":12697}
2021-04-08 20:35:30.467 [DEBUG] [lly.internal.util.ShellyChannelCache] - shelly1-84cca8a87ec1: Channel device#heartBeat updated with 2021-04-08T20:35:30.000+0200 (type class org.openhab.core.library.types.DateTimeType).
2021-04-08 20:35:30.468 [TRACE] [y.internal.handler.ShellyBaseHandler] - shelly1-84cca8a87ec1: Watchdog restarted (expires in 70 sec)
2021-04-08 20:35:30.470 [TRACE] [.internal.handler.ShellyRelayHandler] - shelly1-84cca8a87ec1: Updating 1 relay(s)
2021-04-08 20:35:30.473 [TRACE] [ng.shelly.internal.api.ShellyHttpApi] - shelly1-84cca8a87ec1: HTTP GET for http://192.168.178.78/status/relay/0
2021-04-08 20:35:32.070 [TRACE] [ng.shelly.internal.api.ShellyHttpApi] - shelly1-84cca8a87ec1: HTTP Response 200: {"wifi_sta":{"connected":true,"ssid":"myWLAN2","ip":"192.168.178.78","rssi":-67},"cloud":{"enabled":false,"connected":false},"mqtt":{"connected":false},"time":"20:35","unixtime":1617906931,"serial":49,"has_update":false,"mac":"84CCA8A87EC1","cfg_changed_cnt":2,"actions_stats":{"skipped":0},"relays":[{"ison":false,"has_timer":false,"timer_started":0,"timer_duration":0,"timer_remaining":0,"source":"timer"}],"meters":[{"power":0.00,"is_valid":true}],"inputs":[{"input":0,"event":"","event_cnt":12}],"ext_sensors":{},"ext_temperature":{},"ext_humidity":{},"update":{"status":"idle","has_update":false,"new_version":"20210323-104500/v1.10.1-gf276b51","old_version":"20210323-104500/v1.10.1-gf276b51","beta_version":"20210405-091013/v1.10.2-rc5-gc86c23a"},"ram_total":50224,"ram_free":37284,"fs_size":233681,"fs_free":146082,"uptime":12698}
2021-04-08 20:35:32.072 [DEBUG] [lly.internal.util.ShellyChannelCache] - shelly1-84cca8a87ec1: Channel device#uptime updated with 12697 s (type class org.openhab.core.library.types.QuantityType).
2021-04-08 20:35:32.074 [DEBUG] [lly.internal.util.ShellyChannelCache] - shelly1-84cca8a87ec1: Channel relay#eventCount updated with 12 (type class org.openhab.core.library.types.DecimalType).
2021-04-08 20:35:32.077 [DEBUG] [lly.internal.util.ShellyChannelCache] - shelly1-84cca8a87ec1: Channel device#heartBeat updated with 2021-04-08T20:35:32.000+0200 (type class org.openhab.core.library.types.DateTimeType).
2021-04-08 20:35:32.078 [TRACE] [y.internal.handler.ShellyBaseHandler] - shelly1-84cca8a87ec1: Watchdog restarted (expires in 70 sec)

@DileRGorE @Oliver2
please try the DEV build, as you know I made a change that button events are not filtered in detached mode. I’m not sure which code base was merged into 3.1M3


Latest DEV builds: 2.5.13 - 3.1.0 - README - Installation - Avdanced Users - Shelly Manager - Bugs/Features - Firmware Index - Firmware Archive - API Doc
Note: The DEV build is always newer than the version in the official Distro or the Milestone builds (SNAPSHOTs); OH Distro 2.5 will not receive updates anymore, so you have to switch to DEV build when running OH 2.5, see installation notes.

I am not using detached mode. Anyway I will try the dev build and will get back to you. Thanks!

fyi: PR#10276 has been merged. This includes Shelly Manager. I would expect that this will be part of 3.1M4 (and the DEv build anyways😉)

Shelly Manager is already part of M3 :wink:
Merge was before release


@Polo or @Tomibeck I started working on this. It’s included in the DEV build, waiting on feedback.

I am interested to help developing this add on. For me it’s working with one sensor, but with two it gives same readings.
70 year old beginner, slow learner. Don’t blame me :slightly_smiling_face:

Hi,

I’ve a problem with the shelly binding, so I created a new topic in den binding-section, but after reading this thread, I thing it should be better placed in this thread.

[OH3.1M3] [shelly] CoIoT Unicast behind reverse proxy

I would like to configure CoIoT Unicast, but I get the following message “CoIoT peer in device settings does not point this to this host, disabling CoIoT”, because I run openHAB in docker container behind a reverse proxy.

Is there any way to solve this problem?

Thomas

why do you use a reverse proxy?

I’ve setup my 3EM a couple of months ago with the shelly binding. I configured the thing with an updateInterval of 300. This always worked fine, but since a couple of days my items are modified on every change. So this meens, these items are changing non-stop. I already restarted openHAB and updated the firemware of my 3EM (Current version: 20210323-110413/v1.10.1-gf276b51). What else can be wrong? This binding is running on OH 2.5.12.

what does that mean?

try DEV build


Latest DEV builds: 2.5.13 - 3.1.0 - README - Installation - Avdanced Users - Shelly Manager - Bugs/Features - Firmware Index - Firmware Archive - API Doc
Note: The DEV build is always newer than the version in the official Distro or the Milestone builds (SNAPSHOTs); OH Distro 2.5 will not receive updates anymore, so you have to switch to DEV build when running OH 2.5, see installation notes.

I updated the DEV build and keep the warning, but removed disabling CoIoT by default. Maybe there are good reasons for a setup like that (like your’s). You need to update to the latest DEV build.


Latest DEV builds: 2.5.13 - 3.1.0 - README - Installation - Avdanced Users - Shelly Manager - Bugs/Features - Firmware Index - Firmware Archive - API Doc
Note: The DEV build is always newer than the version in the official Distro or the Milestone builds (SNAPSHOTs); OH Distro 2.5 will not receive updates anymore, so you have to switch to DEV build when running OH 2.5, see installation notes.

I installed 2.5.13, but I get the same issue: the updateInterval doesn’t do anything
I even reinstalled openhab completely, so the thing is completely new.

I will test the 3.0 version in my test 3.x setup later today.

Hi Markus,

thanks for the fast reply.

why do you use a reverse proxy?

I have several docker container running on my synology and I found the warnings from the browsers annoying, when going to the pages with http.
Also I found the different ports from the different services annoying.
So I decided to start a container with traefik reverse proxy, so I could reach all services with https (traefik manages the certificates) and on the same port.
The only thing is, that this construct only works with dns-names and not with ip-adresses, when connecting over traefik.

I updated the DEV build and keep the warning, but removed disabling CoIoT by default. Maybe there are good reasons for a setup like that (like your’s). You need to update to the latest DEV build.

Thanks a lot.
I will give it a try at the weekend.

Thomas