Shelly Binding

This has been discussed here: https://github.com/openhab/openhab-addons/issues/6608

a) The release implementation follows the standard OH paradigm
- brightess = 0 sets also device OFF
- brightness > 0 automatically turns on the device
b) The DEV build includes a new thing config option to disable the Auto-ON so you could set brightness without turning ON the device

Brightness and state could be controlled by linking 2 items(Switch for ON/OFF, Number for brightness-%) to the same brightness channel.

i have a lamp and a motion detector on a shelly 2.5. basically the control works, but i have a problem with the reaction time.
the motion detector is supposed to switch on the lamp immediately. but the lamp is only switched on up to 8s after the motion detector has been switched on.

am i the only one with this problem, or has anyone else noticed it?

shelly.things

Thing shelly:shelly25-relay:xxxxxx "EgHaustuer" [deviceIp="xxx.xxx.xxx.xxx", userId="", password=""]

items

Switch Eg_Haustuer_Bewegungsmelder "Haustuer Bewegungsmelder" <motion> {channel="shelly:shelly25-relay:xxxxxx:relay1#input"}
Switch Eg_Haustuer_Licht "Haustuere Licht" <switch> {channel="shelly:shelly25-relay:xxxxxx:relay1#output"}

rule

rule "Licht Haustuer ein"
when
	Item Eg_Haustuer_Bewegungsmelder changed to ON
then
	sendCommand(Eg_Haustuer_Licht, ON) 
end

logfile

2019-12-28 22:01:33.225 [vent.ChannelTriggeredEvent] - shelly:shelly25-relay:690a17:relay1#button triggered LONG_PRESSED
2019-12-28 22:01:37.941 [vent.ItemStateChangedEvent] - Eg_Haustuer_Bewegungsmelder changed from OFF to ON
2019-12-28 22:01:37.992 [ome.event.ItemCommandEvent] - Item 'Eg_Haustuer_Licht' received command ON
2019-12-28 22:01:38.003 [nt.ItemStatePredictedEvent] - Eg_Haustuer_Licht predicted to become ON
2019-12-28 22:01:38.032 [vent.ItemStateChangedEvent] - Eg_Haustuer_Licht changed from OFF to ON

openhab 2.5.0 stable on raspberry pi 3

try to

  • enable button events and
  • disable push events in the thing config
  • clear the push action url in the Shelly Web App (this is not yet automatically done by the binding)

Maybe the push event url overwrites the button event url = when the push urls are set the device doesn’t provide the regular button urls
Problem behind: Shelly does not provide up-to-date documentation, so the exact behavior is not specified

You could also try to enable CoIoT for the device. Send me a PM with the TRACE log and I check what we can do.

i have implemented the advice. currently it takes 1.5-5 seconds from switching the motion detector to switching the relay for the light. in my opinion this time is still much too high.

thing-file:

Thing shelly:shelly25-relay:xxxxxx "EgHaustuer" [deviceIp="1xx.xxx.xxx.xxx", userId="", password="", eventsButton=true, eventsPush=false, eventsCoIoT=true]

item-file:

Switch Eg_Haustuer_Bewegungsmelder "Haustuer Bewegungsmelder" <motion> {channel="shelly:shelly25-relay:xxxxxx:relay1#input"}
Switch Eg_Haustuer_Licht "Haustuere Licht" <switch> {channel="shelly:shelly25-relay:xxxxxx:relay1#output"}

rule-file:

rule "Licht Haustuer ein"
when
	Item Eg_Haustuer_Bewegungsmelder changed to ON
then
    if(Astro_Daylight_On.state != ON)
    {
	    sendCommand(Eg_Haustuer_Licht, ON) 
    }
end

events.log:
events.log (402 Bytes)

obenhab.log:
openhab.log (76.4 KB)



many thanks for your support

Together with @Kellermeister I’m working on optimizing the event handling

  • Speed up input/output event signalling
  • Work around/Fix for reported input channel by CoIoT events
  • Disabling push events by default (activating them disables btn_on/off events)

Details: https://github.com/openhab/openhab-addons/issues/6706

I may change the binding to register push events only in momentary switch mode and otherwise register button events. However, this might remove flexibility, because you loose full control, which event types to register (e.g. having a momentary switch in detached mode). What do you think?

Update 12/30:
Done.

@Kellermeister finished testing, we are now down to

  • input channel update by http events: around 900-100ms
  • by CoIoT/Coap event: about 700ms (Coap update comes a little quicker compared to http event)

This is a really good result, also relevant for detached mode.

fyi: Together with @dilisi we identified a problem that sensor things (e.g. HT) stay in status UNKNOWN after a OH restart when a thing was added manually in PaperUI or defined in a .things file.

details: https://github.com/openhab/openhab-addons/issues/6707

Update 12/30:
Done

@dilisi confirmed that the problem is solved with the DEV build, also verified with password protected devices

Updated DEV build: https://github.com/markus7017/myfiles/blob/master/org.openhab.binding.shelly-2.5.0-SNAPSHOT.jar?raw=true

Thanks Markus! I’m a bit novice to try the DEV build i think! I currently have 2 items defined for each channel on the RGBW2 (power channel - switch ON/OFF and Brightness channel - dimmer %), but the power channel still changes to ON when brightness channel is changed.

Looking forward to the thing config to disable the Auto-ON :slight_smile: I will hold off reconfiguring back to MQTT for now! Cheers!

let me know if you need support on installing the DEV build
https://github.com/markus7017/myfiles/blob/master/org.openhab.binding.shelly-2.5.0-SNAPSHOT.jar?raw=true

This is already implemenrted. Go to the thing configuration there is a Switch “Brightness Auto-ON”, set this to OFF. Make sure you deleted the thing and re-discovered (Item linkage will be restored)

Does anybody has a Shelly EM and could verify with the latest DEV build that all channels get their value including the proper units?

https://github.com/markus7017/myfiles/blob/master/org.openhab.binding.shelly-2.5.0-SNAPSHOT.jar?raw=true

A user has the problem that the channels get the values, but some of them don’t show the unit. I check channel definition and code, which looks good and even more strange meter1 shows the V on voltage, but meter 2 doesn’t even it uses exactly the same channel definition.
![71625234-fddfda80-2be6-11ea-9e93-a3150daa0b7a|274x500 (upload://53ky5qUtuenzBHLHJvD8f0T65HB.png)

The trace shows the correct channel update from the binding, but then the item doesn’t receive the unit (I also checked the display pattern definition).

shellyem-b9f299: Channel meter1#voltage updated with 234.35 V (type class org.eclipse.smarthome.core.library.types.QuantityType).
ShellyemB9f299192168048_Meter1_Voltage changed from 233.03 to 234.35

It seems like the californium libs donot survive a clean-cache and reboot.
Does anybody can point me to a jar to be placed in the addon folder? (or is there a way to install it permanentely in the karaf console?)

Reboot yes, clean-cache no. A clean-cache removes all dependencies, which are no longer use. In our situation the Californium libs are install aside from the binding jar, the framework doesn’t detect this dependency and removes the openhab-transport-coap feature.

see Shelly Binding - #729 by markus7017 “Installung DEV/SNAPSHOT build” to get the URLs for GSon (OH 2.4 only) and Californium. Copying those to the addons folder make them resistent to a clean-cache.

This doesn’t apply for the release version, because there the framework knows that dependency.

Hi,
great binding!

I just stumbled over the “Temperature Sensor Addon for Shelly 1/1PM” in the shelly shop.

Are these already supported?

In theory yes, but nobody had one so far. If you provide me the JSON from /settings and /status it should be easy to integrate.

Hi Markus,
i ordered the Addon yesterday for my Shelly1 probably i can provide you the JSON then.

BR Peter

:+1:

To complete the device support:
Does anybody has a Shelly Smoke or the new Window/Door sensor?

I ordered several door/ window sensors but they havent been deliverd yet

:+1: let me know when you have them

To start with I need the output form /settings and /status

The next OH release is on the road: 2.5.1. Deadline for submitting changes is 12.1.2020
I created a new PR including all last changes: #6764

The DEV build has been updated to the latest code base (2.5.1 core + binding): https://github.com/markus7017/myfiles

My test buddy @igi did already some testing :slight_smile:. I highly appreciate more support on this during the next days. The DEV build is stable, but maybe we catch 1 or 2 more bugs. There will be no new features until 2.5.1 is released. If you requested a feature for this release I would expect doing some final testing.

Please make sure to remove the 2.5.0-SNAPSHOT before installing 2.5.1-SNAPSHOT. Installation works in the same way (see READMEbeta). Also check the updated README

No comments / results?

Sadly, this week I don’t really have time to test. Moreover the new shellys door/windows sensors were not delivered yet.