Shelly Binding: Shelly Flood Sensor does not report via binding but via MQTT (latest firmware)

Hi there,

I am running OH 3.1 M5 in a docker environment on my NAS and have a number of Shelly power plugs that successfully run in my setup. I just bought 2 Shelly flood sensors and during the setup I was asked to install the latest firmware. Unfortunately I did not test with the firmware that was on the device at delivery hence I can only tell that the reporting through the shelly binding item definition does not work correctly but everything works fine via MQTT.

The firmware level I m using is: 20210909-144708/v1.11.4-DNSfix-ge6b2f6d

When I turn on the device all three defined items flood, battery, lastUpdate (see definitions below) receive data

openhab> items list | grep ShFl
ShFl_EGsens (Type=SwitchItem, State=OFF, Label=Shelly Flood EG Sensor, Category=null)
ShFl_EGbatt (Type=NumberItem, State=93, Label=Shelly Flood EG Battery Level, Category=null)
ShFl_EGdate (Type=DateTimeItem, State=2021-10-01T09:43:21.000+0200, Label=Shelly Flood EG Last Update, Category=null)

and I also see that the channel:


gets triggered with “POWERON” and “BUTTON” and ALARM" when the device is awake!!!

But when the sensor goes to sleep and I force the flood alarm by putting water underneath the device it only reports the changes via MQTT but not via the binding.

I turned on the debug mode for the Shelly binding but at the moment of activating the flood alarm nothing is logged in context of this event. I only see in frequent intervalls the normal polling request that fail because the device is asleep.

2021-10-01 06:26:56.825 [DEBUG] [ng.shelly.internal.api.ShellyHttpApi] - shellyflood-XXXXXX: API Timeout, retry #3 (Device unreachable or API Timeout (GET http://111.222.333.444/cit/d))
2021-10-01 06:26:57.787 [DEBUG] [ng.shelly.internal.api.ShellyHttpApi] - shellyflood-XXXXXX: API Timeout, retry #6 (Device unreachable or API Timeout (GET http://111.222.333.444/shelly))

I have defined these three items:

Switch ShFl_EGsens "Shelly Flood EG Sensor" {channel="shelly:shellyflood:XXXXXX:sensors#flood"}
Number ShFl_EGbatt "Shelly Flood EG Battery Level" {channel="shelly:shellyflood:XXXXXX:battery#batteryLevel"}
DateTime ShFl_EGdate "Shelly Flood EG Last Update" {channel="shelly:shellyflood:XXXXXX:sensors#lastUpdate"}

Here is the thing definition:

Thing shelly:shellyflood:XXXXXX "ShellyFlood EG" [deviceIp="111.222.333.444", userId="XYZ", password="XYZ", lowBattery=15, eventsSwitch=true, eventsButton=true, eventsSensorReport=true, eventsCoIoT=true]

I kindly appreciate any hints, ideas and advice how to get the reporting via the binding working?
Of course I can fall back to MQTT but maybe this is a code issue that can also happen to other Shelly devices with the latest firmware.

Thank you for your attention!


Hi Markus, may I kindly ask you to take a look at my topic if you have some spare time?
Nobody from the community obviously had any idea or advice and I would like to know if the problem is solvable or if I should return the sensors to the retailer.

Thank you very much for any hint or advice :slight_smile:

I suppose the problem is related to your Docker setup. When the device is awake and the binding reads current status using HTTP/REST API. Once the devices turns into sleep mode you depend on the binding receiving the CoIoT updates. This protocol is UDP-based and you need to take care that the Docker settings are correct. Otherwise the host will receive the update, but not the OH/binding running inside the Docker container. I’m not familar with Docker so can’t help there. Ask the community for guidance.

Thank you for your response. It seems to be the multicast udp issue here … I am wondering why I have no problems with all the other shelly devices like the Plug S, Shelly 2.5, Shelly 1, Shelly 1PM.

Alterantively I could think of leveraging the http:// method and call a PHP Webscript to update an item via REST-API or does this also only work when the device is awake?

what I do not understand is that if I activate MQTT in the settings of the device and the reporting works while the device is awake shouldn’t I expect that the updates that are sent during sleep mode are also published via MQTT and not only via CoIoT (which I have actually not activated through the Shelly device web UI?

The binding is based on REST API for status polls and CoIoT for events/updates. The binding does NOT uses MQTT! The CoIoT messages need to pass your Docker container so the binding sees the corresponding Multicast-UDP traffic.