Shelly Binding

thank you @markus7017. But, maybe a basic question, if I know how to install manually a binding, how do I switch from a binding installed from the web interface to a manual one ? Should I uninstall the “web” binding then install the DEV one ? Or is there another way ?

For the record, I’ve deleted my request on GitHub, sorry about that.

Yes that’s exactly the way to do it. Remove the binding via the UI first and then deploy the new one in the addon folder.

1 Like

Again me I’m sorry.
I’ve removed the “official” binding, stopped OH, downloaded 4.1.0-DEV, restarted OH.
From the bundle list, I get this:
272 │ Resolved │ 80 │ 4.1.0.202308122203 │ openHAB Add-ons :: Bundles :: Shelly Binding Gen1+2

I go back to Openhab, in my inbox I see my Gateway, I had it as thing, then I go back to the list of things, and I have the exact same problem as before: the thing is offline with a CONFIGURATION_ERROR “IP/MAC Address of the Shelly device is missing.” In thing properties however, deviceIp is set to the correct address.

What am I missing ?

ups, sorry, you are right, the BLU gateway is not supported yet; as I said to move forward with the PRs (current one is almost done) before adding new stuff

It has been a while since the last time someone said it, so, thank you Markus for your work!
Having some 30shellies i highly dependend on. Do you have a “Buy me a coffee” or something like that?

1 Like

I have “I appreciate your work” and it’s free of charge :+1: I highly appreciate feedback, if you want to contribute be active here helping to support the community​:hugs: or help testing or enhancing the documentation. Or just hints how to improve documentation or add a feature that make it easier for others or implementing use cases.:melting_face:

Ling time ago I invited to contribute use case descriptions (like I did for Shelly rollers using favorites). Some combination of Shelly function, rules or just a step-by-step implementation guide for more complex scenarios than “installed a Shelly”. This creates ideas for creative setups using Shellys for others. So I you have something like an irrigation controller, weather dependent, alarm system or something else just create a draft in MD format or plain text and I’ll include this as part of the dist (as part of the doc folder). So @MajorTwip if you save “I heavily depend on my Shellys and the binding”:thinking:, this smells like a use case others are interested :partying_face:
And of course anyone else is invited too​:innocent::upside_down_face:

One the current PR (critical fixed preventing IH to run into out-of-memory) the next one (enhanced security and improved discovery) I’ll start working on new features. Thanks @Lolodomo and and the team doing the reviews.:+1:

3 Likes

@markus7017 Absolutely no problem! Just back to square one, it’s anyway an opportunity to fiddle with shelly scripting.
Two questions:

  • How can I track the PR that will add the gateway support ? Here or in GitHub ?
  • Taking about Github, do I reopen my closed enhancement issue. Or is it useless ?

If someone is interested, I have created a widget, popup and rules to manage shellies

  • overview on battery state, signal strength, temperature incl. color coding for thresholds on these parameters
  • popup for error and alarm messages, which are stored as a json string in a seperate item to avoid that alarms are overwritten by a new alarm

Will take some time to clean up the code and do translation, that‘s why I am suggesting this first.

1 Like

Solved the operational side by switching to MQTT - all functions work well (but manually). Added bonus is it works with 2.5 too :slight_smile: When the Shelly binding gets the fix might revert.

Worked well for one week.
But it seems that coap feature gets lost by clean-cache?!

I had t install it again.
Is there any way to keep it?

Yes, that‘s part of the clean cache to remove not required components.
Best way is to use a batch/sh file which cleans the cache and reinstalls the components


/usr/bin/ssh -p 8101 openhab@localhost feature:install openhab-transport-coap

Im using this file in the /bin/ share

#!/bin/bash
echo '###########################################'
echo '######   openHAB CACHE/TMP loeschen   #####'
echo '###########################################'
date "+%A  %d/%m/%Y  %H:%M:%S"
echo '###########################################'
# openHAB Service stoppen
echo 'Stoppe openhab-Service'
sudo systemctl stop openhab.service
# CACHE und TMP löschen
echo 'CACHE und TMP loeschen'
sudo yes | openhab-cli clean-cache
# openHAB Service starten
echo 'Starte openhab-Service'
sudo systemctl start openhab.service

How do I have do handle your command? Do I have to use „sudo“ as well?

Add the command after starting openhab.service
I don‘t think you need sudo.

Yes, my question was not related to the position in the script but as it is a command of the karaf console I am not sure how this command must look like in a shell script.

1 Like

I added my first Shelly BLU button to openHAB (3.4.5 + DEV Binding 3.4.5.202308121445). Following the docs from the binding everything went fine after some trial and error.

[INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'shelly_button.things'
[WARN ] [core.thing.internal.ThingManagerImpl] - The model of shelly:shellyblubutton:BLUETOOTH_MACADDRESS is inconsistent [thing.getHandler().getThing() != thing]

==> /var/log/openhab/events.log <==
[INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'shelly:shellyblubutton:BLUETOOTH_MACADDRESS' changed from UNINITIALIZED (HANDLER_CONFIGURATION_PENDING): {deviceAddress=The parameter is required.} to INITIALIZING

Didn’t find a text file example, so here is one:

Thing shelly:shellyblubutton:BLUETOOTH_MACADDRESS "Shelly BLU button Red" @ "Zolder" [deviceAddress="BLUETOOTH_MACADDRESS"]

Gives a warning about an inconsistent model though? But is working fine:

shelly:shellyblubutton:BLUETOOTH_MACADDRESS:status#button triggered SHORT_PRESSED

Things seems to be silent, but we are working in the background.

Short update on PRs

  • PR#15798 fixes a critical resource leak for Gen2 devices, which happened when thing initialization of device discovery resulted in an exception, In this case the WebSocket was not closed and/or the thread got blocked. In combination with a firmware bug of Shelly Wall Display 1.2.4 (current production release!!!) this caused rapidly growing number of threats and opened WebSockets leading into an out-of-memory. Various people help to isolate the problem and testing the fix (see https://community.openhab.org/t/oh4-runs-out-of-memory), kudos to all of them. In addition an IPv6 mDNS discovery caused also an exception if IPv6 is enabled in the OH network config. Same result: Every incoming mDNS request raising open sockets and threads. The PR is also considered to be merged into 4.0.
  • PR#15898 This PR implements Auth for Gen2 starting with firmware 1.0 (implementation reworked to implement RFC-based digest auth). In Addition basic auth for Gen1 was changed to avoid exposing credentials when not requested by the device. And device discovery was improved to avoid duplicate things in the Inbox when using .things definitions.
  • PR#15922 is in the making, will include small fixes and another round of hardening on the resource topic. Having firmware 1.2.4 on the Wall Display makes it easy to reproduce so I spend some time to do further optimizations. @Lolodomo is doing a great job on reviewing all that stuff.

We need 2 more PRs to get the list up to the DEV level before I continue implementing new features

  • Automatic upgrades for the channel definitions. 4.0 brings in stricter checking of channel units and value updates, which shows some inconsistencies in the binding. I changed various channels to use system defined ones (incl. unit definitions) and also implemented a mechanism, which auto-upgrades existing thing/channel definitions when starting the new binding.
  • Support for Shelly Plus Dimmer 10V has been added
  • and finally I’m working on the proxy device mode (one Shelly uses another one as a hub), but this is work in progress

Said that:

  • The first 2 PRs are critical to all users, you should upgrade the binding as soon as a new OH release becomes available
  • Firmware 1.2.4 for Shelly Wall Display ist buggy, don’t use it. The problem occurs even you didn’t included the Wall Display as a thing, because it continuously sends mDNS announcement, which are picked up by the binding and processing those causes the out-of-memory. Stay on 1.2.3 or move to 1.2.5-rc6 beta (or 1.2.5 final when it becomes available)
  • Please be patient a few more days. I’m working with @Lolodomo to bring all PRs into the code base for the next OH release and postpone implementation of new features or integrating new devices until then.

The best thing you could contribute is testing. I’ll update the DEV build to include the changes from the review process and let you know.

6 Likes

Thanks a lot for your effort and also to @Lolodomo!

Hello Markus,
thank you for your efforts.

If you have time, could you please also check the following error.
Yesterday I installed a shellyplus1 with the plus-addon. According to the documentation 5 temperature sensors are supported.

This also works in the Shelly app, but in Openhab I can add a maximum of 3 temperature sensors.
Yes, I have read that I could integrate sensors 3 and 4 via MQQT, but I don’t think that’s a clean solution.

Maybe you can fix this error please.
Thank you!

I updated the DEV build for 4.1-SNAPSHOT. Due to changed package dependencies this will no longer work on 4.0.

This version includes the latest functions and changes from PR review. It would be great to get some feedback = testing to make sure having a solid basis moving forward.

WD users fyi: I’m still investigating the Wall Display with @igi Even with firmware 1.2.5 we see tons of mDNS advertisements, which are processed by the binding without NPEs or resource leaks (which is great), but also creates a lot of useless traffic. Who else has a WD with 1.2.5 and wants to share observations (run Wireshark and check frequency of mDNS traffic)?

which version of the binding are you using? DEV build?