Shelly: from MQTT to shelly binding, refresh takes too long in sitemap

Hello,
i am using openhab 2.5.3-1, and i just installed the shelly binding v2.5.3.

Until now i used mqtt to control a light with a shelly1 device (which worked fine for a year now).

My new thing file:

Thing shelly:shelly1:32C605 "Shelly 1 SeF Office 02" @ "Δεύτερος όροφος" [deviceIp="192.168.1.208", userId="", password=""]

My item file:

Switch Office02Light "Φώς" <light> (SeF_Office) ["Switchable"] { channel="shelly:shelly1:32C605:relay#output" }

Everything is working well from sitemap.

The problem is when i press the physical switch (in the wall), the light turns on immediately but the switch in the openhab sitemap takes around 20-25 seconds to refresh in the new light state.

Where do you thing is the problem?

You should enable CoIoT events in your thing config.

Thing shelly:shelly1:32C605 "Shelly 1 SeF Office 02" @ "Δεύτερος όροφος" [deviceIp="192.168.1.208", userId="", password="", eventsCoIoT=true]

I did the change but unfortunately after some testing exactly the same behavior exists.

ok i got it working.

i factory reset the shelly1, after that i updated the firmware to 1.6.2, and i filled only the wifi information and left all the other settings unattached.
After that everything is working as expected.

Thank you Hans

Hi there,

I’m pushing this up as I seem to have the same problem.

I have two Plug S and a Shelly 1. For all of them, the refresh in the sitemap takes up to 1 minute via the binding. Through MQTT, it refreshes immediately (which I only set up for testing).

I also have three Shelly 2.5 - they do work fine with the binding and refresh after 1 or 2 seconds.

The suggested solution (adding eventsCoIoT=true to the thing) doesn’t work for me. Also, a factory reset didn’t help.

I’m on openHAB 2.5.8 (running on a Raspberry), the Shellys have the latest FW 1.8.3.

Thing file:
Thing shelly:shellyplugs:XXXXXX "Shelly Plug S TV-Station" @ "Wohnzimmer" [deviceIp="192.168.2.159", eventsCoIoT=true]

Item file:
Number:Power Shelly_Plug_S_Drucker_Verbrauch "Akt. Leistung" <energy> (Rrd4j) {channel="shelly:shellyplugs:XXXXXX:meter#currentWatts"}

I don’t know how to fix this. Any ideas?

Thank you,
Matthias

Are you prepared to do some investigating?
Let’s identify the problem first.
Your example is about wattage power readings - I wouldn’t really expect instantaneous responses on that, this stuff is usually averaged over time by the device. You might just be looking at different reporting strategies at the Shelly end.

How well do the on/off indications work?
Autoupdate might mask poor responses to openHAB commands, so I would set autoupdate="false" for your switch Item for testing.
Then command it on/off from UI and see the overall response timing in your events.log

Thanks for your quick response. Sure, I’m ready :wink:. The watt item was just one example. Let me describe it a bit more detailed.

  • Shelly 2.5: I use them as rollershutters. In the sitemap, I have the controls as well as the current watts. Everything updates instantly.
  • Shelly 1: I have this one connected to the garage door motor. A reed contact is connected to SW so I can see whether the garage door is open. The SW state updates very slowly via the binding, just like the current watts in the Plug S. Also here, through MQTT the SW state updates instantly.

Furthermore, I have to say that it did work fine in the past until a few weeks ago. I just realized the issue too late to know what had changed in the meantime.

However, I will try your suggestions later today.

I just tested the on/off indication. It is the same: I turned the Plug S (TV) on and off via the Shelly Web UI. Every time it took between 20 and 40 seconds (I timed it).

The On/Off state as well the wattage state update at the (almost) same time. Both 20-40 seconds after I pressed the button.

2020-09-09 12:51:03.106 [vent.ItemStateChangedEvent] - Shelly_Plug_S_TV_Power changed from ON to OFF
2020-09-09 12:51:03.166 [vent.ItemStateChangedEvent] - Shelly_Plug_S_TV_Verbrauch changed from 12.6 W to 0.0 W

Please send your command from openHAB UI so that you can show a log with an actual 20 second delay between cause and effect, which in turn leads to the possibility of more in-depth investigation.

And another one :slight_smile:
Please follow the Shelly Binding thread. There have been massive changes in the CoIoT protocol introduced with firmware 1.8.0. These changes have been implemented in Shelly Binding version 2.5.9 !!! not available in 2.5.8 !!! Your binding version falls back to polling with fw 1.8.3, thats the reason for the delay.

Please switch to the latest DEV Build of the Shelly Binding or to the latest 2.5.9 SNAPSHOT version.

Via Binding:
2020-09-09 13:35:21.237 [ome.event.ItemCommandEvent] - Item 'Shelly_Plug_S_TV_Power' received command ON
2020-09-09 13:35:21.281 [vent.ItemStateChangedEvent] - Shelly_Plug_S_TV_Power changed from OFF to ON
2020-09-09 13:36:10.227 [vent.ItemStateChangedEvent] - Shelly_Plug_S_TV_Verbrauch changed from 0.0 W to 12.6 W

-> about 50 seconds

Via MQTT:
2020-09-09 13:37:36.264 [ome.event.ItemCommandEvent] - Item 'Wohnzimmer_TV' received command ON
2020-09-09 13:37:36.315 [vent.ItemStateChangedEvent] - Wohnzimmer_TV changed from OFF to ON
2020-09-09 13:37:40.498 [vent.ItemStateChangedEvent] - Wohnzimmer_TV_Watts changed from 0.00 to 13.84

-> about 4 seconds

Edit: sorry for the bad code formatting but I don’t know how to make it appear in one line.

Please see my Post. With fw 1.8.x, your binding falls back to polling mode instead of receiving CoIoT events pushed out from the device.
You need a newer binding version for the firmware your devices run.

Hi Hans-Jörg,

Thank you!

Stupid question: How do I update to the snapshot version? :see_no_evil:

Please check the links posted here

I followed the instructions from the “Installation” link:


New installation

  • Stop OH
  • copy californium-core-2.0.0.jar to OH’s addons folder
  • copy element-connector-2.0.0.jar to OH’s addons folder
  • Start OH, wait until fully initialized(!)
  • copy org.openhab.binding.shelly-2.5.8-SNAPSHOT.jar to OH’s addons folder

If everything was install correct a “bundle:list” output show be similar to this:

246 │ Installed │  80 │ 2.0.0                  │ Californium (Cf) Core
247 │ Installed │  80 │ 2.0.0                  │ Californium (Cf) Element Connector
248 │ Installed │  80 │ 2.5.8.202008212158     │ openHAB Add-ons :: Bundles :: Shelly Binding

I put all three jar files in the addons folder but I don’t see any of them under “bundle:list”. Sorry, but I’ve never installed or used a DEV or SNAPSHOT binding :roll_eyes:

You have not copied the 2.5.9 DEV build into the addons folder, but an older 2.5.8 version …

I copied the file “org.openhab.binding.shelly-2.5.9-SNAPSHOT.jar” into the addons folder.

The instructions are still based on 2.5.8

OK then, your screenshot shows 2.5.8

I think I wasn’t clear enough. Sorry!

What I posted (regarding 2.5.8) was part of the instructions from here: https://github.com/markus7017/myfiles/blob/master/shelly/READMEbeta.md

It says “If everything was install correct a “bundle:list” output show be similar to this”. But I don’t see any of these bundles in my installation after following these steps.

My addons folder looks like this:

The “normal” binding found in PaperUI is supposed to be uninstalled, right?

Correct