# Shelly Binding

**URL:** <https://community.openhab.org/t/shelly-binding/56862>\
**Category:** Bindings\
**Tags:** binding, shelly\
**Created:** [November 16, 2018, 7:51am UTC](https://community.openhab.org/t/shelly-binding/56862 "2018-11-16T07:51:02Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![alexxio](https://community.openhab.org/user_avatar/community.openhab.org/alexxio/32/37692_2.png) [@alexxio](https://community.openhab.org/u/alexxio)\
**Post date:** [July 15, 2019, 7:27pm UTC](https://community.openhab.org/t/shelly-binding/56862/57 "2019-07-15T19:27:10Z")

</div>

I have several shelly 2.5 in rollershutter mode, a couple of HT sensor and some shelly Plug S.  
I would like to help testing because I’d really loved to have a binding for shellies but I don’t have a test environment…is it safe to install it in my prod. env.? (openhab 2.4 installed from repository on a rasberry 3b+) or could it break openhab?  
Is there something I could do to be helpful?

---

<div class="post-metadata">

**Author:** ![markus7017](https://community.openhab.org/user_avatar/community.openhab.org/markus7017/32/39859_2.png) [@markus7017](https://community.openhab.org/u/markus7017)\
**Post date:** [July 15, 2019, 7:36pm UTC](https://community.openhab.org/t/shelly-binding/56862/58 "2019-07-15T19:36:05Z")

</div>

@MHerbst I fixed the thing type handling for bulb - two types for color and white

@alexxio that should not be a problem even you have the mqtt items running (same with me, works in parallel).

- open OH console and run “feature:install openhab-transport-coap”
- copy the jar into the addons folder.
- run the thing discovery in PaperUI - maybe multiple times until all things get discovered

---

<div class="post-metadata">

**Author:** ![markus7017](https://community.openhab.org/user_avatar/community.openhab.org/markus7017/32/39859_2.png) [@markus7017](https://community.openhab.org/u/markus7017)\
**Post date:** [July 15, 2019, 7:42pm UTC](https://community.openhab.org/t/shelly-binding/56862/59 "2019-07-15T19:42:13Z")

</div>

@MHerbst totalWatts and maxPower was added for Plug S

you need to delete and re-add the things

---

<div class="post-metadata">

**Author:** ![markus7017](https://community.openhab.org/user_avatar/community.openhab.org/markus7017/32/39859_2.png) [@markus7017](https://community.openhab.org/u/markus7017)\
**Post date:** [July 15, 2019, 8:11pm UTC](https://community.openhab.org/t/shelly-binding/56862/60 "2019-07-15T20:11:32Z")

</div>

Please note: Currently the binding polls every 15s the devices. I’m working on a more intelligent event driven approach, but still have an initialization problem to catch the events. I’m not sure how the HT and Smoke react, I suppose that the http call fails when they are in sleep mode, but this is also interesting to see.

---

<div class="post-metadata">

**Author:** ![hmerk](https://community.openhab.org/user_avatar/community.openhab.org/hmerk/32/56432_2.png) [@hmerk](https://community.openhab.org/u/hmerk)\
**Post date:** [July 15, 2019, 8:25pm UTC](https://community.openhab.org/t/shelly-binding/56862/61 "2019-07-15T20:25:26Z")

</div>

Polling HT and Smoke will definitely fail, as they go to deep sleep after a certain time. There is no keep alive option, cause this would drain the batteries.

---

<div class="post-metadata">

**Author:** ![alexxio](https://community.openhab.org/user_avatar/community.openhab.org/alexxio/32/37692_2.png) [@alexxio](https://community.openhab.org/u/alexxio)\
**Post date:** [July 15, 2019, 9:22pm UTC](https://community.openhab.org/t/shelly-binding/56862/62 "2019-07-15T21:22:44Z")

</div>

> [@markus7017](#):
>
> @alexxio that should not be a problem even you have the mqtt items running (same with me, works in parallel).

It seems like CoAP and MQTT actions are mutually exclusive on the shelly configuration (at least on the shelly 2.5 that I’m trying) so I cannot keep both enabled…how do you keep both running?  
As soon as I check MQTT the CoAP action gets unchecked on the device.

If it is so…this will slow down my test as I have to choose one device to pull out from my production system…and change sitemaps rules etc…

Another thing…I cannot see the binding neither in the PAPER UI → Configuration → Bindings or in the Binding list in the autodiscovery page modal window..is it normal? Openhab apparentely started without any error after the installation.

Thanks

---

<div class="post-metadata">

**Author:** ![markus7017](https://community.openhab.org/user_avatar/community.openhab.org/markus7017/32/39859_2.png) [@markus7017](https://community.openhab.org/u/markus7017)\
**Post date:** [July 15, 2019, 9:29pm UTC](https://community.openhab.org/t/shelly-binding/56862/63 "2019-07-15T21:29:41Z")

</div>

don’t change the config of the Shelly. The plan was/is to use CoAP and it works in parallel to mqtt - there is a visualization issue in the UI.

For the moment the binding doesn’t make use of Coap.

> [@alexxio](#):
>
> Another thing…I cannot see the binding neither in the PAPER UI → Configuration → Bindings

I do, are you sure that you copied the jar into the addons folder. Open the OH console and run bundles:list, get the ID and try “bundle:start ”. The bundle has to become active. If not enable TRACE log and send me a PM.

---

<div class="post-metadata">

**Author:** ![markus7017](https://community.openhab.org/user_avatar/community.openhab.org/markus7017/32/39859_2.png) [@markus7017](https://community.openhab.org/u/markus7017)\
**Post date:** [July 15, 2019, 9:47pm UTC](https://community.openhab.org/t/shelly-binding/56862/64 "2019-07-15T21:47:52Z")

</div>

after powering up my Shelly1 I have to report that it’s not running. I fixed a bug related to device discovery, but processing the relay status to update the channels doesn’t work yet. I keep you posted

---

<div class="post-metadata">

**Author:** ![markus7017](https://community.openhab.org/user_avatar/community.openhab.org/markus7017/32/39859_2.png) [@markus7017](https://community.openhab.org/u/markus7017)\
**Post date:** [July 16, 2019, 7:11pm UTC](https://community.openhab.org/t/shelly-binding/56862/65 "2019-07-16T19:11:46Z")

</div>

ok, here is alpha3  
[https://github.com/markus7017/org.openhab.binding.shelly/blob/alpha3/target/org.openhab.binding.shelly-2.4.0-SNAPSHOT.jar](https://github.com/markus7017/org.openhab.binding.shelly/blob/alpha3/target/org.openhab.binding.shelly-2.4.0-SNAPSHOT.jar)

- fix for the “Not found” in Paper UI when adding the Shelly2-roller (duplicate channel)
- support for Shelly1 - it’s not “a half Shelly2”, it’s specific
- avoid exception on thing discovery

again you need to remove and re-add all things and clean out the JSON DB

 ![12](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/3/2/32e29b651de8f3c8b7333f59403ca6cb68ed3113.png)

Shelly 1, 2, 2.5 look good for me  
feedback on other devices welcome

@alexxio informed me that had to to install feature esh.tp-coap in addition

```csv
feature:install esh.tp-coap
```

---

<div class="post-metadata">

**Author:** ![alexxio](https://community.openhab.org/user_avatar/community.openhab.org/alexxio/32/37692_2.png) [@alexxio](https://community.openhab.org/u/alexxio)\
**Post date:** [July 16, 2019, 8:35pm UTC](https://community.openhab.org/t/shelly-binding/56862/66 "2019-07-16T20:35:38Z")

</div>

Autodiscover for Plug S and HT sensor not working yet (I manually turned on the HT sensor and ran the autodiscover).

> 2019-07-16 22:14:48.479 [ERROR] [discovery.ShellyDiscoveryParticipant] - Device discovery failed for device shellyplug-s-7af169, IP 192.168.10.33: null

> 2019-07-16 22:33:06.336 [ERROR] [discovery.ShellyDiscoveryParticipant] - Device discovery failed for device shellyht-58f736, IP 192.168.10.35: null

Tomorrow I will try to add them manually.

---

<div class="post-metadata">

**Author:** ![markus7017](https://community.openhab.org/user_avatar/community.openhab.org/markus7017/32/39859_2.png) [@markus7017](https://community.openhab.org/u/markus7017)\
**Post date:** [July 16, 2019, 8:37pm UTC](https://community.openhab.org/t/shelly-binding/56862/67 "2019-07-16T20:37:53Z")

</div>

I’m just trying to catch the exception with @igi, he has the same problem with the Plug S. I checked in a build, which does a line-by-line debug so I could see, which line leads into the exception.

Please use the jar I checked in some minutes ago. This also corrects the thing type for the 1PM.

---

<div class="post-metadata">

**Author:** ![markus7017](https://community.openhab.org/user_avatar/community.openhab.org/markus7017/32/39859_2.png) [@markus7017](https://community.openhab.org/u/markus7017)\
**Post date:** [July 16, 2019, 9:41pm UTC](https://community.openhab.org/t/shelly-binding/56862/68 "2019-07-16T21:41:12Z")

</div>

I applied a fix for the devices, which don’t have a mode: HT, Smoke, Plug, PlugS  
@igi reported successful discovery for the Plug S

@MHerbst Could you please re-test the Bulb with alpha3  
[https://github.com/markus7017/org.openhab.binding.shelly/blob/alpha3/target/org.openhab.binding.shelly-2.4.0-SNAPSHOT.jar](https://github.com/markus7017/org.openhab.binding.shelly/blob/alpha3/target/org.openhab.binding.shelly-2.4.0-SNAPSHOT.jar)

I added a new Thing config option to alpha 4, which allows to set the update interval. The default is 15sec (has to be a multiple of 3). That is an interims solution for the HT and Smoke, so they get only polled every x seconds, e.g. 14400=every 4 hours to avoid battery drainage. I need to work on the fix for the event callback, which provides a general interval, but event driven updates.

---

<div class="post-metadata">

**Author:** ![markus7017](https://community.openhab.org/user_avatar/community.openhab.org/markus7017/32/39859_2.png) [@markus7017](https://community.openhab.org/u/markus7017)\
**Post date:** [July 17, 2019, 6:20am UTC](https://community.openhab.org/t/shelly-binding/56862/69 "2019-07-17T06:20:34Z")

</div>

did you gave the binding a try? more feedback welcome🤪

---

<div class="post-metadata">

**Author:** ![alexxio](https://community.openhab.org/user_avatar/community.openhab.org/alexxio/32/37692_2.png) [@alexxio](https://community.openhab.org/u/alexxio)\
**Post date:** [July 17, 2019, 1:51pm UTC](https://community.openhab.org/t/shelly-binding/56862/70 "2019-07-17T13:51:13Z")

</div>

With alpha 3 my bulb gets discovered.

I did not have the time to add and configure all the things yet.

---

<div class="post-metadata">

**Author:** ![MHerbst](https://community.openhab.org/user_avatar/community.openhab.org/mherbst/32/90834_2.png) [@MHerbst](https://community.openhab.org/u/MHerbst)\
**Post date:** [July 17, 2019, 6:17pm UTC](https://community.openhab.org/t/shelly-binding/56862/72 "2019-07-17T18:17:21Z")

</div>

Here are my test results:

- Bulb: white bulb and my Plug S are now detected automatically
- Bulb: changing the brightness of the bulb in Paper UI has no effect
- Bulb: effect can not be changed. it shows only “-” in Paper UI
- Bulb: Color Bulb can be added manually. Changing the values e.g. for the colors has no effect
- Plug S: display of watts and power shows nAn (BTW: after adding an item for the bulb brightness it showed also “NaN” but the widget in Paper UI could be changed to a different value. There seems to be a general problem with numeric values.

I can send you trace outputs if you need them.

I am not sure whether it is good and intuitive to use two different things for the Bulb, but I don’t have a better idea yet either.

---

<div class="post-metadata">

**Author:** ![markus7017](https://community.openhab.org/user_avatar/community.openhab.org/markus7017/32/39859_2.png) [@markus7017](https://community.openhab.org/u/markus7017)\
**Post date:** [July 17, 2019, 7:25pm UTC](https://community.openhab.org/t/shelly-binding/56862/73 "2019-07-17T19:25:53Z")

</div>

yes , please send the trace log by PM

---

<div class="post-metadata">

**Author:** ![markus7017](https://community.openhab.org/user_avatar/community.openhab.org/markus7017/32/39859_2.png) [@markus7017](https://community.openhab.org/u/markus7017)\
**Post date:** [July 19, 2019, 5:42am UTC](https://community.openhab.org/t/shelly-binding/56862/74 "2019-07-19T05:42:59Z")

</div>

Please find alpha4 in the repo:  
[https://github.com/markus7017/org.openhab.binding.shelly/blob/alpha4/target/org.openhab.binding.shelly-2.4.0-SNAPSHOT.jar](https://github.com/markus7017/org.openhab.binding.shelly/blob/alpha4/target/org.openhab.binding.shelly-2.4.0-SNAPSHOT.jar)

@igi helped me a lot with testing , so we could make significant progress - thanks Igi!!!

- fix: thing type id for shelly2-plug-s fixed, so now you get the full set of Meter channels
- fix: Meter channels for Plug S get filled, thing definition corrected
- fix: Avoid exception on invalid number format ($power)
- fix: Avoid exception on event callback
- new: seperate thing types for Shelly2 and Shelly2.5 - the 2.1 has 1 meter, the 2.5 has 2
- new: added a 2nd Meter to the Shelly 2.5 relay channels so both meters are accessible
- new: meter data is accumulated when in roller mode (mapping 2 to 1 meter)
- new: timestamp channel added to meters
- new: output firmware version to the log (and thing properties)
- new: check for FW \> 1.5 (that’s the minimum version, I don’t want to provide backward compatibility to older releases)
- change: Thing gets online after the status was successfully updated for the first time, not at initialization time
- change: COAP usage disabled until I understand how to initialize for observing non-standard options

Shelly2/2.5 things:  
Given the diffrent set of meaningful channels and the difference in the number of meters (Shelly2: 1, Shelly2.5: 2) this results in 4 different thing types:  
shelly2-relay: 2 relay, 1 meter  
shelly2-roller: 1 roller, 1 meter  
shelly25-relay: 2 relay, 2 meter  
shelly25-roller: 1 roller, 1 meter (kumuliert aus beiden Meter, timestamp = newest measurement)

Known issues:

- Shelly Plug S: Status updates on LED control channel
- Shelly RGBW2 is not yet finally implemented
- Progress on the Shelly Bulb is made, but still work in progress
- The polling frequencyneeds to be optimized by utilizing the event callback when sensor data has changed
- The event trigger channel is not yet implemented - this will trigger a notification to an OH rule each time an event is received
- http authentication is currently not implemented, this means you have to disable http auth for the build-in web server
- The binding starts one update thread per device, this needs to be consolidated making the device handling more efficient

Some channels might be missing, some need some fixes. If you see something post on the forum or send me a PM inlc. TRACE log for bugs.

Feedback is highly appreciated.Does someone hast a Shelly Smoke to test?

---

<div class="post-metadata">

**Author:** ![markus7017](https://community.openhab.org/user_avatar/community.openhab.org/markus7017/32/39859_2.png) [@markus7017](https://community.openhab.org/u/markus7017)\
**Post date:** [July 20, 2019, 4:53pm UTC](https://community.openhab.org/t/shelly-binding/56862/75 "2019-07-20T16:53:12Z")

</div>

ok, I did more testing and found several issues with the HT. I had to add various if() to validate API results data. There are various fields, which don‘t get filled, e.g. numMeters with the Shelly 1 even it has a meter. Some if those inconsistencies resulted in exceptions on discovery and thing initialization. That‘s also the reason why devices might don‘t show up on the discovery.

Channels for Shelly Plug-S and HT have bern fixed, all data gets updated.

Let me do some more testing with  
Shelly 1, Shelly 2-relay, Shelly 2.5-roller  
Plug-S, Shelly HT

I’ll provide beta 1 soon (maybe later today or tomorrow).

Does anyone know if the HT/Smoke could be waken up with Wake-on-LAN, otherwise thing initialization will fail when in sleep mode

---

<div class="post-metadata">

**Author:** ![hmerk](https://community.openhab.org/user_avatar/community.openhab.org/hmerk/32/56432_2.png) [@hmerk](https://community.openhab.org/u/hmerk)\
**Post date:** [July 20, 2019, 6:10pm UTC](https://community.openhab.org/t/shelly-binding/56862/76 "2019-07-20T18:10:30Z")

</div>

Only know for HT, no remote wake up possible.

---

<div class="post-metadata">

**Author:** ![markus7017](https://community.openhab.org/user_avatar/community.openhab.org/markus7017/32/39859_2.png) [@markus7017](https://community.openhab.org/u/markus7017)\
**Post date:** [July 20, 2019, 6:12pm UTC](https://community.openhab.org/t/shelly-binding/56862/77 "2019-07-20T18:12:57Z")

</div>

hmm, not the best  
maybe I could raise a feature request at Shelly, but…  
I already added an if(Sensor) to prevent to go OFFLINE when the poll fails, but that doesn‘t solve the situation while initializing the thing.

[Previous page](https://community.openhab.org/t/shelly-binding/56862.md?page=1)

[Next page](https://community.openhab.org/t/shelly-binding/56862.md?page=3)
