Shelly Binding

thanks for the Flood infos, I’ll work on this tomorrow

Hi Markus,
the Binding works perfect for my Shelly1 but I have some trouble with the ShellyHT. It works for a while, then suddenly for a longer time it is unreachable (Status in PaperUI is „Initializing“) and also suddenly it appears again.
Here is the log with both scenarios:

2019-08-23 22:37:57.217 [DEBUG] [elly.internal.api.ShellyEventServlet] - CallbackServlet: HTTP/1.1 Request from XXXXXXXXX:56390/shelly/event/shellyht-d0ed0a/sensordata?{hum=[61],temp=[23.25]}

    2019-08-23 22:37:57.220 [DEBUG] [helly.internal.handler.ShellyHandler] - Event received for device shellyht-d0ed0a: class=sensordata, index=, parameters={hum=[61],temp=[23.25]}

    2019-08-23 22:37:57.223 [DEBUG] [helly.internal.handler.ShellyHandler] - Trigger sensordata event, channel sensors#event, payload={"device":"shellyht-d0ed0a", "class":"sensordata", "index":"","parameters":[{"hum":"61"}, {"temp":"23.25"}]}

    2019-08-23 22:37:57.225 [DEBUG] [helly.internal.handler.ShellyHandler] - Request a refresh of the settings for device shellyht-d0ed0a

    2019-08-23 22:37:59.875 [DEBUG] [helly.internal.handler.ShellyHandler] - Shelly status info for shellyht-d0ed0a: {"wifi_sta":{"connected":true,"ssid“:“XXXXX“,“ip“:“XXXXXXXXX“,“rssi":-63},"cloud":{"enabled":false,"connected":false},"mqtt":{"connected":false},"time":"22:38","serial":1,"has_update":false,"mac“:“XXXXXXXXX“,“is_valid":true,"tmp":{"value":23.25,"units":"C","tC":23.25,"tF":73.85, "is_valid":true},"hum":{"value":61.5, "is_valid":true},"bat":{"value":96,"voltage":2.92},"act_reasons":["sensor"],"connect_retries":0,"update":{"status":"unknown","has_update":false,"new_version":"","old_version":"20190821-095211/v1.5.2@4148d2b7"},"ram_total":50584,"ram_free":40476,"fs_size":233681,"fs_free":163401,"uptime":4}

    2019-08-23 22:37:59.877 [DEBUG] [helly.internal.handler.ShellyHandler] - shellyht-d0ed0a: Updating sensor

    2019-08-23 22:38:00.021 [DEBUG] [helly.internal.handler.ShellyHandler] - 0 more updates requested

    2019-08-23 22:39:42.255 [DEBUG] [helly.internal.handler.ShellyHandler] - Shelly status info for shellyht-d0ed0a: {"wifi_sta":{"connected":true,"ssid“:“XXXXXX,“ip“:“XXXXXXXX“,“rssi":-62},"cloud":{"enabled":false,"connected":false},"mqtt":{"connected":false},"time":"22:39","serial":1,"has_update":false,"mac“:“XXXXXXXX“,“is_valid":true,"tmp":{"value":23.25,"units":"C","tC":23.25,"tF":73.85, "is_valid":true},"hum":{"value":61.5, "is_valid":true},"bat":{"value":96,"voltage":2.92},"act_reasons":["sensor"],"connect_retries":0,"update":{"status":"idle","has_update":false,"new_version":"20190821-095211/v1.5.2@4148d2b7","old_version":"20190821-095211/v1.5.2@4148d2b7"},"ram_total":50584,"ram_free":40632,"fs_size":233681,"fs_free":163401,"uptime":107}

    2019-08-23 22:39:42.258 [DEBUG] [helly.internal.handler.ShellyHandler] - shellyht-d0ed0a: Updating sensor

    2019-08-23 22:54:47.611 [INFO ] [helly.internal.handler.ShellyHandler] - Thing Shelly HT not reachable, update canceled!

    2019-08-24 13:36:45.519 [INFO ] [helly.internal.handler.ShellyHandler] - Thing Shelly HT not reachable, update canceled!

    2019-08-24 13:38:30.365 [DEBUG] [elly.internal.api.ShellyEventServlet] - CallbackServlet: HTTP/1.1 Request from XXXXXXXX:21907/shelly/event/shellyht-d0ed0a/sensordata?{hum=[80],temp=[24.25]}

    2019-08-24 13:38:30.369 [DEBUG] [helly.internal.handler.ShellyHandler] - Event received for device shellyht-d0ed0a: class=sensordata, index=, parameters={hum=[80],temp=[24.25]}

    2019-08-24 13:38:30.374 [DEBUG] [helly.internal.handler.ShellyHandler] - Trigger sensordata event, channel sensors#event, payload={"device":"shellyht-d0ed0a", "class":"sensordata", "index":"","parameters":[{"hum":"80"}, {"temp":"24.25"}]}

    2019-08-24 13:38:30.379 [DEBUG] [helly.internal.handler.ShellyHandler] - Request a refresh of the settings for device shellyht-d0ed0a

    2019-08-24 13:38:30.877 [DEBUG] [helly.internal.handler.ShellyHandler] - Shelly status info for shellyht-d0ed0a: {"wifi_sta":{"connected":true,"ssid“:“XXXXX“,“ip“:“XXXXXXXX“,“rssi":-67},"cloud":{"enabled":false,"connected":false},"mqtt":{"connected":false},"time":"","serial":1,"has_update":false,"mac“:“XXXXXXXXXX“,“is_valid":true,"tmp":{"value":24.25,"units":"C","tC":24.25,"tF":75.65, "is_valid":true},"hum":{"value":80.5, "is_valid":true},"bat":{"value":92,"voltage":2.89},"act_reasons":["sensor"],"connect_retries":0,"update":{"status":"unknown","has_update":false,"new_version":"","old_version":"20190821-095211/v1.5.2@4148d2b7"},"ram_total":50584,"ram_free":40616,"fs_size":233681,"fs_free":163401,"uptime":2}

    2019-08-24 13:38:30.881 [DEBUG] [helly.internal.handler.ShellyHandler] - shellyht-d0ed0a: Updating sensor

    2019-08-24 13:38:30.985 [DEBUG] [helly.internal.handler.ShellyHandler] - 0 more updates requested

I get this error when I want to install??

[ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-binding-shelly'

Can somebody help me?

That behaviour of Shelly HT is absolutely normal and will happen to the Flood as well. Both devices are battery operated, so they are in deep sleep mode most of the time and not reachable. That’s why i said polling rhem is a bad idea. With the latest firmwareupdate the HT supports actions and Markus is working on rhe CoAP implementation, so stay tuned for the next versions😉

even if the temperature or humidity changes significantly?

Depends on your treshold settings.
Just try to open the device webserver when you see the error os occuring in the log.

I know - increase/decrease was above the thresholds

Did you set treshold below 1 degree? If not, don‘t see anything wrong.

I saw that there is a firmware 1.52, maybe they fixed something (1.51 was already a fix for the event handling)

You could find a new buld in the snapshot branch
https://github.com/markus7017/org.openhab.binding.shelly/blob/snapshot/target/org.openhab.binding.shelly-2.4.0-SNAPSHOT.jar

2.4.2-SNAPSHOT release notes

  • Support for Shelly Flood
  • Support for Shelly EM (primarily)
  • Create special device (shelly-protected) when device is password protected
  • channel name meter.totalWatts changed to meter.totalKWH (returns kw/h, not Watts)

HT got a new firmware: 1.52
Shelly 2.5 even newer: 1.53

Please verify Shelly Flood and provide a TRACE log

@Hunor_Madaras @WeRo
Please verify the updated snapshot release, I removed one dependency - may fix install on 2.4
I also fixed schedule handling for Sensors (e.g. HT). This could explain “hanging updates”

Tried to install Flood. Adding it manually PaperUI reports a „Error 500 - internal server error“.
I had to define the Thing ID by myself. After this step I could fill in the IP adress. In log everything looks fine but PaperUI doesn’t show any channels and reports the Error 500 after every refresh.

2019-08-25 15:29:07.570 [DEBUG] [helly.internal.handler.ShellyHandler] - shellyflood-6946e0: Updating sensor
2019-08-25 15:29:16.963 [DEBUG] [elly.internal.api.ShellyEventServlet] - CallbackServlet: HTTP/1.1 Request from xxxxxxxx:45523/shelly/event/shellyflood-6946e0/sensordata?{temp=[29.12],flood=[0],batV=[2.89]}
2019-08-25 15:29:16.965 [DEBUG] [helly.internal.handler.ShellyHandler] - Event received for device shellyflood-6946e0: class=sensordata, index=, parameters={temp=[29.12],flood=[0],batV=[2.89]}
2019-08-25 15:29:16.967 [DEBUG] [helly.internal.handler.ShellyHandler] - Trigger sensordata event, channel sensors#event, payload={"device":"shellyflood-6946e0", "class":"sensordata", "index":"","parameters":[{"temp":"29.12"}, {"flood":"0"}, {"batV":"2.89"}]}
2019-08-25 15:29:16.972 [DEBUG] [helly.internal.handler.ShellyHandler] - Request a refresh of the settings for device shellyflood-6946e0
2019-08-25 15:29:16.976 [vent.ChannelTriggeredEvent] - shelly:shellyflood:6946E0:sensors#event triggered {"device":"shellyflood-6946e0", "class":"sensordata", "index":"","parameters":[{"temp":"29.12"}, {"flood":"0"}, {"batV":"2.89"}]}
2019-08-25 15:29:18.295 [INFO ] [helly.internal.handler.ShellyHandler] - Thing config for device shellyflood-6946e0 updated.
2019-08-25 15:29:19.657 [DEBUG] [helly.internal.handler.ShellyHandler] - Refresh settings for device shellyflood-6946e0

HT is still in status Initalizing

You shouldn’t add it manually. The discovery has to bring it up.
Make sure you enabled TRACE Log: “log:set TRACE org.openhab.binding.shelly”
go to PaperUI:Inbox run the scan, maybe multiple times
check the log, maybe there is an Exception or logical constraint

Nevertheless, I see that the things gets initialized, url gets set and a callback to OH is processed.

That’s strange. Please send the log as PM, maybe I could see something.

Is that a fresh OH install?

It‘s OH 2.4.0-1
I tried discovery multiple times but it doesn’t work.
But I found this in the log:

2019-08-25 16:24:20.426 [WARN ] [re.thing.internal.ThingFactoryHelper] - Could not create channels for channel group 'sensors' for thing type 'shelly:shellyflood:6946E0', because channel group type 'shelly:floodSensor' could not be found.

Maybe it helps.

good catch, thx

Please find an updated version here:
https://github.com/markus7017/org.openhab.binding.shelly/blob/snapshot/target/org.openhab.binding.shelly-2.4.0-SNAPSHOT.jar

This version fixes the xml definition for the Flood, but also the HT sensor.

Just for validation: I ran a build also in a 2.5 build environment.
Please verify if the latest 2.4 can be installed. If not please also check the 2.5 build.
Please provide result for both version (make sure only one of them sits i the addons folder)

Yes I test both version 2.4 snd 2.5 and I still get this error…after I added to the addons folder I added to the /var/lib/openhab2/etc/org.openhab.addons.cfg binding = shelly… that is correct? and still

[ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-binding-shelly' I dont know what is wrong…

ii openhab2 2.5.0~M1-1 all openhab2
ii openhab2-addons 2.5.0~M1-1 all openhab2-addons
rc openhab2-offline 2.0.0~b5 all openHAB Offline Distribution

This is my openhab version.

When You add a Binding to addons Folder, there is no need to add it into addons.cfg, this will lead to your posted error, as karaf cannot find the Binding in any repository.

ok. thannks. I just added the snapshot to the addons folder… and how will be installed?