Shelly Binding

@markus7017

any idea about the Websocket Disconnects with Pro devices?

Thx a lot

Hi
Having some issues with BLU devices. I am on 4.3.2 and able to connect a BLU motion sensor. It is online. The gateway is on a Plus 2PM.
I do not get any status updates in OpenHAB when the motion detector fires. So it never detects motion.
When looking at the log of the gateway (script on Plus 2PM) I see an event like this:

shelly_notification:208 Event from script:1: {"component":"script:1","id":1,"event":"oh-blu.data","data":{"encryption":false,"BTHome_version":2,"pid":50,"Battery":100,"Illuminance":635,"Motion":1,"addr":"3c:2e:f5:bb:bd:0e","rssi":-67},"ts":1736880362.71}

So in principle I would guess that the motion sensor sends the event to the gateway.

What I did:

  • I removed the BLU device several times and added new.
  • I also have a BLU button with same behaviour. Seeing it on the gateway script, not in OH.
  • Updated the BLU device firmware to the latest version
  • Tested it on OH 4.2.2
  • pressing the button shows up in the events.log - the triggering of motion not.
    (shelly:shellyblumotion:3c2ef5bbbd0e:relay#button triggered SHORT_PRESSED)

For me it looks like that the devices communicate via BT, the events do not get forwarded to OH. Or I did a configuration error.

Do I need to read the content somehow via JSON or should it be mapped directly to the channels of the thing?

Thanks for any idea

BR
SJ

I remember from installing my BLU devices, sometimes not all channels popped up. Removing and reading the thing (if needed several times) brought the solution back then. But that’s a workaround, of course, with no garantuee for success


Thanks Erik.
The channels are there and mapped to items. They just do not receive a new value when the device detects/sends it.

Try logging the binding and see what pops up
? If you share it here, maybe someone sees something


That is a good point. Enabled the log with level trace:

This is the relevant section:

2025-01-15 15:09:06.135 [TRACE] [helly.internal.api2.Shelly2RpcSocket] - shellyplus2pm-b8d61a8b8634 Shutter_AZ: Inbound Rpc message: {"src":"shellyplus2pm-b8d61a8b8634","dst":"openhab-192.168.178.31","method":"NotifyEvent","params":{"ts":1736950146.08,"events":[{"component":"script:1","id":1,"event":"oh-blu.data","data":{"encryption":false,"BTHome_version":2,"pid":103,"Battery":100,"Illuminance":600,"Motion":1,"addr":"3c:2e:f5:bb:bd:0e","rssi":-67},"ts":1736950146.08}]}}
2025-01-15 15:09:06.135 [TRACE] [ng.shelly.internal.api2.ShellyBluApi] - shellyblumotion-3c2ef5bbbd0e: ShellyEvent received: {"src":"shellyplus2pm-b8d61a8b8634","params":{"ts":1.73695014608E9,"events":[{"id":1,"ts":1.73695014608E9,"component":"script:1","event":"oh-blu.data","data":{"addr":"3c:2e:f5:bb:bd:0e","encryption":false,"BTHome_version":2,"pid":103,"Battery":100,"Illuminance":600,"Motion":1,"rssi":-67}}]}}
2025-01-15 15:09:06.136 [TRACE] [y.internal.handler.ShellyBaseHandler] - shellyblumotion-3c2ef5bbbd0e: Watchdog restarted (expires in 43260 sec)
2025-01-15 15:09:06.136 [DEBUG] [ng.shelly.internal.api2.ShellyBluApi] - shellyblumotion-3c2ef5bbbd0e: BluEvent received: {"src":"shellyplus2pm-b8d61a8b8634","params":{"ts":1.73695014608E9,"events":[{"id":1,"ts":1.73695014608E9,"component":"script:1","event":"oh-blu.data","data":{"addr":"3c:2e:f5:bb:bd:0e","encryption":false,"BTHome_version":2,"pid":103,"Battery":100,"Illuminance":600,"Motion":1,"rssi":-67}}]}}
2025-01-15 15:09:06.136 [DEBUG] [ng.shelly.internal.api2.ShellyBluApi] - shellyblumotion-3c2ef5bbbd0e: BLU event oh-blu.data received from address 3c:2e:f5:bb:bd:0e, pid=103
2025-01-15 15:09:06.136 [DEBUG] [y.internal.handler.ShellyBaseHandler] - shellyblumotion-3c2ef5bbbd0e: Channel sensors#motion updated with ON (type class org.openhab.core.library.types.OnOffType).

to be honest, this looks correct. “Channel updated with ON”
I once again removed the thing and created it from scratch. No luck. I then rebooted. The channel got updated once. Then again it is stuck in the “ON” position. I am getting the correct message that it should go off.
So basically I guess there is a bug somewhere in the binding.

On the plus side: I have 20+ shelly devices (non BT) and all works flawless. Thank you so much for this binding! If the BT can be fixed at some point, I am able to replace a few legacy sensors.

BR
SJ

Just one more thing I tried:
Installed a brand new based system on openhabian (4.3.2) with just the shelly binding. Things get discovered, BT does not update the channels of the item. Running out of ideas.

I noticed that shelly binding automatically added the following entry in a gen3 shelly’s websocket section:

ws://192.168.178.61:8080/shelly/wsevent

Where the IP-address belongs to my openhab server.
However these entries are not being aded to gen2 devices. I wonder if it makes sense to add it manually. I think that the websocket entry gets added for battery devices and is not related to gen2 or 3. Does anybody has some insights into the binding?

Just FYI, most Shelly BLU devices are also directly Bluetooth compatible, being recognised and decoded by OpenMQTTGateway and Theengs Gateway, now with auto-discovery working with openHAB 4.3+

2 Likes

Same for me. I have a Shelly Blue D/W. All channels are recognised correctly but get no updates. Everything stays on NULL.
OpenHAB 4.3.2 with official binding from store.

How did you configure them? I‘ve got 5 of those in my apartment running absolutely fine. All use Shelly 2 PM Plus devices ad BLU gateway. This is at openHAB 4.3.2 with official Binding.

You are right, the binding is better than I thought :slight_smile:
How do you try to switch off? There is the brightness channel and you need to set it to 0

The item does not accept the value 0. I can use >=1 and then the Shelly switches on. Only switching off with a value of 0 is not accepted by the Shelly. A switch item on the brightness channel does not work either.
I am currently using the following commands to switch on and off:
sendHttpGetRequest("http://192.168.178.90/rpc/RGBW.Set?id=0&on=true")
sendHttpGetRequest("http://192.168.178.90/rpc/RGBW.Set?id=0&on=false")

Following Channels finds the binding:

Color                       ShellyPlusRGBWTVAmbiente19216817890ColorHsb                 "Farbe"                               {channel="shelly:shellyplusrgbwpm:30c922570f6c:color#hsb"}
String                      ShellyPlusRGBWTVAmbiente19216817890ColorFull                "Volltonfarbe"                        {channel="shelly:shellyplusrgbwpm:30c922570f6c:color#full"}
Dimmer                      ShellyPlusRGBWTVAmbiente19216817890ColorRed                 "Rot"                                 {channel="shelly:shellyplusrgbwpm:30c922570f6c:color#red"}
Dimmer                      ShellyPlusRGBWTVAmbiente19216817890ColorGreen               "GrĂŒn"                                {channel="shelly:shellyplusrgbwpm:30c922570f6c:color#green"}
Dimmer                      ShellyPlusRGBWTVAmbiente19216817890ColorBlue                "Blau"                                {channel="shelly:shellyplusrgbwpm:30c922570f6c:color#blue"}
Dimmer                      ShellyPlusRGBWTVAmbiente19216817890ColorWhite               "Weiß"                                {channel="shelly:shellyplusrgbwpm:30c922570f6c:color#white"}
Number                      ShellyPlusRGBWTVAmbiente19216817890DeviceWifiSignal         "SignalstÀrke"                        {channel="shelly:shellyplusrgbwpm:30c922570f6c:device#wifiSignal"}
Number                      ShellyPlusRGBWTVAmbiente19216817890DeviceUptime             "Laufzeit"                            {channel="shelly:shellyplusrgbwpm:30c922570f6c:device#uptime"}
DateTime                    ShellyPlusRGBWTVAmbiente19216817890DeviceHeartBeat          "Letzte AktivitÀt"                    {channel="shelly:shellyplusrgbwpm:30c922570f6c:device#heartBeat"}
Switch                      ShellyPlusRGBWTVAmbiente19216817890DeviceUpdateAvailable    "Firmwareaktualisierung verfĂŒgbar"    {channel="shelly:shellyplusrgbwpm:30c922570f6c:device#updateAvailable"}
Number:Time                 ShellyPlusRGBWTVAmbiente19216817890ControlAutoOn            "Auto An Timer"                       {channel="shelly:shellyplusrgbwpm:30c922570f6c:control#autoOn"}
Number:Time                 ShellyPlusRGBWTVAmbiente19216817890ControlAutoOff           "Auto Aus Timer"                      {channel="shelly:shellyplusrgbwpm:30c922570f6c:control#autoOff"}
Dimmer                      ShellyPlusRGBWTVAmbiente19216817890WhiteBrightness          "Helligkeit"                          {channel="shelly:shellyplusrgbwpm:30c922570f6c:white#brightness"}
Switch                      ShellyPlusRGBWTVAmbiente19216817890ControlInput             "Eingang/Taste"                       {channel="shelly:shellyplusrgbwpm:30c922570f6c:control#input"}

hmm, strange
You should be able to move the brightness slider to the 0 position, which then turns off the light. Did you checked events.log?

The log looks fine, “Channel updated with ON” means that the binding processed the event and performed the channel update. Therefore the WS handling must also work.

Did you checked events.log?

I’m planning to spend to time on bug fixing the next days. I know they are various pending and new devices need to be integrated.

Please make sure that you issues are created here

This creates a list, which I could follow.

You should also be committed to do the testing in time. It’s always hard to manage several PRs in parallel. Keeping them small, makes it easier for the reviewers, but having multiple open ones makes it hard for me. Best way to support is testing and providing feedback quickly.

2 Likes

I just installed two Shelly Blu motion. The first I updated to the newst firmware. That one shows the channel but does not get any updates. Item stays on “NULL”. The second one I did not update and it shows all the channel and updates them. Not sure if I should update the second one to see if it keeps working or not.

my problem seem not to be related to the Firmware but it seems as soon I connect a second blu motion to my Pro 3EM the updates for the first one will not be received by OH.
It changes the status in the shelly app but the item in OH is not updated.

Hello together,

I received my Shelly 2PM Gen 3 today. It looks like this is not supported, can I provide something so that it is integrated into the DEV?

Done: [shelly] Older signals from BLU devices are being read · Issue #18143 · openhab/openhab-addons · GitHub :slight_smile:

I wanted to provide a PR myself, but I couldn’t find out where the change should have been implemented :sweat_smile: But I’m happy to help with testing!

  • Please check if it’s reproducible
  • Compare openhab.log output in DEBUG mode, maybe we see differences
  • For now you should not upgrade the working one, because you can’t downgrade

Which firmware versions are in use? Are both BLU devices connected to the same Shelly?

At the moment I have problems to setup a fresh Dev environment, which blocks any debugging.