Shelly Binding

what happens now when you restart OH (keeping the thing) and then pressing the button
I see that the sensor update is already received before channels are added and linked.

Hello Markus,

i still want to ask about my problem with shellydimmer. I get no longpush event if i press the button. In the log i see the longpush

2020-07-26 21:31:29.883 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6: CoIoT Message from /192.168.177.20:5683 (MID=20759): {"G":[[0,111, 57],[0,121, 1],[0,131, 2],[0,141, 0],[0,211,11.306],[0,212,25.358],[0,213,25.257],[0,214,2465],[0,311,47.48],[0,312,117.46],[0,313,0]]}
2020-07-26 21:31:29.886 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6: CoIoT Sensor data {"G":[[0,111, 57],[0,121, 1],[0,131, 2],[0,141, 0],[0,211,11.306],[0,212,25.358],[0,213,25.257],[0,214,2465],[0,311,47.48],[0,312,117.46],[0,313,0]]}
2020-07-26 21:31:29.890 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6: 11 CoAP sensor updates received
2020-07-26 21:31:29.893 [TRACE] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6:  Sensor value[0]: id=111, Value=57.0 (Brightness, Type=S, Range=0/100, Link=0: Dimmer)
2020-07-26 21:31:29.895 [TRACE] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6:  Sensor value[1]: id=121, Value=1.0 (State, Type=S, Range=0/1, Link=0: Dimmer)
2020-07-26 21:31:29.900 [TRACE] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6:  Sensor value[2]: id=131, Value=2.0 (Input, Type=S, Range=0(off)/1(on)/2(longpush), Link=0: Dimmer)
2020-07-26 21:31:29.903 [TRACE] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6:  Sensor value[3]: id=141, Value=0.0 (Input, Type=S, Range=0(off)/1(on)/2(longpush), Link=0: Dimmer)
2020-07-26 21:31:29.906 [TRACE] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6:  Sensor value[4]: id=211, Value=11.306 (Energy counter 0 [W-min], Type=S, Range=null, Link=0: Dimmer)
2020-07-26 21:31:29.910 [TRACE] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6:  Sensor value[5]: id=212, Value=25.358 (Energy counter 1 [W-min], Type=S, Range=null, Link=0: Dimmer)
2020-07-26 21:31:29.913 [TRACE] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6:  Sensor value[6]: id=213, Value=25.257 (Energy counter 2 [W-min], Type=S, Range=null, Link=0: Dimmer)
2020-07-26 21:31:29.917 [TRACE] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6:  Sensor value[7]: id=214, Value=2465.0 (Energy counter total [W-min], Type=S, Range=null, Link=0: Dimmer)
2020-07-26 21:31:29.920 [TRACE] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6:  Sensor value[8]: id=311, Value=47.48 (Temperature C, Type=T, Range=-40/300, Link=0: Dimmer)
2020-07-26 21:31:29.924 [TRACE] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6:  Sensor value[9]: id=312, Value=117.46 (Temperature F, Type=T, Range=-40/300, Link=0: Dimmer)
2020-07-26 21:31:29.932 [TRACE] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6:  Sensor value[10]: id=313, Value=0.0 (Overtemp, Type=S, Range=0/1, Link=0: Dimmer)
2020-07-26 21:31:30.042 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellyswitch25-c46f26: CoIoT Message from /192.168.177.24:5683 (MID=51399): {"G":[[0,112,0],[0,122,0],[0,111,0.000000],[0,121,0.000000],[0,118,0],[0,128,1],[0,115,59.15],[0,116,138.46],[0,117,0],[0,211,0.000],[0,212,0.000],[0,213,0.000],[0,214,1288],[0,221,0.000],[0,222,0.000],[0,223,0.000],[0,224,2]]}
2020-07-26 21:31:30.046 [TRACE] [elly.internal.coap.ShellyCoapHandler] - shellyswitch25-c46f26: Serial 54285 was already processed, ignore update
2020-07-26 21:31:30.359 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6: CoIoT Message from /192.168.177.20:5683 (MID=20760): {"G":[[0,111, 57],[0,121, 1],[0,131, 0],[0,141, 0],[0,211,11.306],[0,212,25.358],[0,213,25.257],[0,214,2465],[0,311,47.48],[0,312,117.46],[0,313,0]]}
2020-07-26 21:31:30.362 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellydimmer-d45ff6: CoIoT Sensor data {"G":[[0,111, 57],[0,121, 1],[0,131, 0],[0,141, 0],[0,211,11.306],[0,212,25.358],[0,213,25.257],[0,214,2465],[0,311,47.48],[0,312,117.46],[0,313,0]]}

I need the log output from the first event. This one os treated as duplicated and ignored (“Serial 54285 was already processed, ignore update”). I need an example where the button state changes and the messages is processed. Please include 20 lines before and everything until the next event from the log

I tested with Dimmer 2 and learned that it brings another button mode “one_button”. I refactored the handling to include this and implemented the following logic

  • A CoAP update with sensor id = 131 with value 1 is mapped to SHORT_PRESSED
  • a value of 2 is mapped to LONG_PRESSED
  • value 0 is mapped to RELEASED

Shelly Button1 doesn’t send a RELEASED, for this the binding simulates a RELEASE after the regular event is processed.

I updated the DEV build. Please try & povide feedback.

Thanks for the tip!
After restarting it indeed started registering the events.

Did experience a weird issue where some channels were missing in the thing in Paper UI after another restart but that recovered after removing/adding the binding again.
Will see if I can reproduce.
Will try with the latest dev binding.

I’m also testing a Button 1 and it seems that when using the same action, it doesn’t seem to fully register.
If I short press once I get following in log:

2020-07-28 12:55:44.044 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellybutton1-a4cf12f44cdf: CoIoT Message from /192.168.8.164:5683 (MID=12744): {"G":[[0,77,71],[0,118,0],[0,119,"S"],[0,120,1]]}

2020-07-28 12:55:44.057 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellybutton1-a4cf12f44cdf: Duplicate serial 256 will be processed, because payload is different: {"G":[[0,77,71],[0,118,0],[0,119,"S"],[0,120,1]]} vs. {"G":[[0,77,72],[0,118,0],[0,119,"S"],[0,120,1]]}

2020-07-28 12:55:44.069 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellybutton1-a4cf12f44cdf: CoIoT Sensor data {"G":[[0,77,71],[0,118,0],[0,119,"S"],[0,120,1]]}

2020-07-28 12:55:44.081 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellybutton1-a4cf12f44cdf: 4 CoAP sensor updates received

2020-07-28 12:55:44.093 [DEBUG] [y.internal.handler.ShellyBaseHandler] - shellybutton1-a4cf12f44cdf: Update button state with S/SHORT_PRESSED

==> /var/log/openhab2/events.log <==

2020-07-28 12:55:44.126 [vent.ChannelTriggeredEvent] - shelly:shellybutton1:f44cdf:status#button triggered SHORT_PRESSED

==> /var/log/openhab2/openhab.log <==

2020-07-28 12:55:44.122 [DEBUG] [lly.internal.util.ShellyChannelCache] - shellybutton1-a4cf12f44cdf: Channel battery#batteryLevel updated with 71.0 % (type class org.eclipse.smarthome.core.library.types.QuantityType).

2020-07-28 12:55:44.168 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellybutton1-a4cf12f44cdf: 1 channels updated from CoIoT status

2020-07-28 12:55:44.201 [INFO ] [clipse.smarthome.model.script.Shelly] - button pressed:shelly:shellybutton1:f44cdf:status#button triggered SHORT_PRESSED

2020-07-28 12:55:45.615 [DEBUG] [y.internal.handler.ShellyBaseHandler] - shellybutton1-a4cf12f44cdf: Simulating Button RELEASED

==> /var/log/openhab2/events.log <==

2020-07-28 12:55:45.640 [vent.ChannelTriggeredEvent] - shelly:shellybutton1:f44cdf:status#button triggered RELEASED

==> /var/log/openhab2/openhab.log <==

2020-07-28 12:55:45.738 [INFO ] [clipse.smarthome.model.script.Shelly] - button pressed:shelly:shellybutton1:f44cdf:status#button triggered RELEASED

when I short press again it doesn’t trigger and I only get:

2020-07-28 12:56:07.068 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellybutton1-a4cf12f44cdf: CoIoT Message from /192.168.8.164:5683 (MID=11024): {“G”:[[0,77,71],[0,118,0],[0,119,“S”],[0,120,1]]}

when short pressing again after a longer wait I get the same single line:

2020-07-28 13:09:35.306 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellybutton1-a4cf12f44cdf: CoIoT Message from /192.168.8.164:5683 (MID=47248): {“G”:[[0,77,71],[0,118,0],[0,119,“S”],[0,120,1]]}

when performing another action like double press short it triggers again:
2020-07-28 13:12:06.038 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellybutton1-a4cf12f44cdf: CoIoT Message from /192.168.8.164:5683 (MID=36606): {“G”:[[0,77,71],[0,118,0],[0,119,“SS”],[0,120,1]]}

2020-07-28 13:12:06.049 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellybutton1-a4cf12f44cdf: Duplicate serial 256 will be processed, because payload is different: {"G":[[0,77,71],[0,118,0],[0,119,"SS"],[0,120,1]]} vs. {"G":[[0,77,71],[0,118,0],[0,119,"S"],[0,120,1]]}

2020-07-28 13:12:06.062 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellybutton1-a4cf12f44cdf: CoIoT Sensor data {"G":[[0,77,71],[0,118,0],[0,119,"SS"],[0,120,1]]}

2020-07-28 13:12:06.086 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellybutton1-a4cf12f44cdf: 4 CoAP sensor updates received

2020-07-28 13:12:06.098 [DEBUG] [y.internal.handler.ShellyBaseHandler] - shellybutton1-a4cf12f44cdf: Update button state with SS/DOUBLE_PRESSED

==> /var/log/openhab2/events.log <==

2020-07-28 13:12:06.128 [vent.ChannelTriggeredEvent] - shelly:shellybutton1:f44cdf:status#button triggered DOUBLE_PRESSED

==> /var/log/openhab2/openhab.log <==

2020-07-28 13:12:06.191 [DEBUG] [lly.internal.util.ShellyChannelCache] - shellybutton1-a4cf12f44cdf: Channel status#lastEvent updated with SS (type class org.eclipse.smarthome.core.library.types.StringType).

2020-07-28 13:12:06.233 [DEBUG] [elly.internal.coap.ShellyCoapHandler] - shellybutton1-a4cf12f44cdf: 1 channels updated from CoIoT status

==> /var/log/openhab2/events.log <==

2020-07-28 13:12:06.211 [vent.ItemStateChangedEvent] - Button1_LastEvent changed from S to SS

==> /var/log/openhab2/openhab.log <==

2020-07-28 13:12:06.286 [INFO ] [clipse.smarthome.model.script.Shelly] - button pressed:shelly:shellybutton1:f44cdf:status#button triggered DOUBLE_PRESSED

2020-07-28 13:12:07.627 [DEBUG] [y.internal.handler.ShellyBaseHandler] - shellybutton1-a4cf12f44cdf: Simulating Button RELEASED

==> /var/log/openhab2/events.log <==

2020-07-28 13:12:07.657 [vent.ChannelTriggeredEvent] - shelly:shellybutton1:f44cdf:status#button triggered RELEASED

==> /var/log/openhab2/openhab.log <==

2020-07-28 13:12:07.746 [INFO ] [clipse.smarthome.model.script.Shelly] - button pressed:shelly:shellybutton1:f44cdf:status#button triggered RELEASED

This is the log with newest dev build
dimmer.log (10.9 KB)

Has anyone the same problem like me ?

Hey There,
I just read in the official shelly Facebook group that Coap Implementation will completly change starting Firmware 1.8. This was confirmed by CEO Dimitar in the group. Does amyone know what the impact on the shelly binding is? Iirc the binding is based on coap, isnt it?
Best.

Link to FB. Check the comments : https://www.facebook.com/groups/ShellyIoTCommunitySupport/permalink/2984059315026746/

the DEV build is work in progress at the moment. I‘m doing some changed to support CoAP v2 as you can read above. Please wait until I notify here before using the latest build

Input handling, event triggers, CoAP v2 are work in progress un addition to refactoring
the topic is more tricky than it sounds, because the device only provides the current/last status instead of real events, Button behaves different than other ones, I reported 2 firmware bugs to Alterco and don‘t have enough timeđŸ€Ș

Hi @markus7017,

I finally managed to download the right jar file and the additional core files 

Furthermore I found that your binding does not yet officially support the new Number definitiion which includes the unit (because the documentation still shows the legacy item definition)

=> item file syntax

Number  ITEM_NAME ...
  versus
Number:Power ITEM_NAME ...

It actually works already with three of four shelly devices but it may cause a problem when the device is not online at OH startup 


Anyway, with the new binding and the fallback to the legacy item definition it works now!

Thanks for your quick and continuous support!

Cheers
Justus

please provide a DEBUG log

While working on CoAP 2


I plan to remove the channels
meter.lastMin2
meter.lastMin3
roller.lastDirection

They are not part of the CoAP 2 updates and it doesn’t make sense to update others via CoAP and those only via REST.

Does anyone use those channels? for what purpose?

Hi,
I encounter a strange behavior with a Shelly i3. Only 1 switch is attached to input 1. When pressing the switch, I get the following results in the log:

shelly:shellyix3:68c63afa9d2a:status1#button triggered SHORT_PRESSED
shelly:shellyix3:68c63afa9d2a:status2#button triggered SHORT_PRESSED

Does anybody know, why input 2 receives a trigger when there is no switch attached?

I do use org.openhab.binding.shelly-2.5.8-SNAPSHOT version of the binding.

Thanks

see above, processing inputs/mapping to channel triggers is work in progress

ok thanks, must have missed that.

Continuing the discussion from Shelly Binding:

Hi,
I have the same problem. I am new at openHAB and have no idea how to fix this.
Allways change from 0.0 to 100.0 and from 100.0 to 0.0. It never stopps.

Blockquote
2020-08-06 09:59:55.799 [vent.ItemStateChangedEvent] - Rollershutter_Terrasse changed from 0.0 to 100.0
2020-08-06 09:59:55.804 [vent.ItemStateChangedEvent] - Dimmer_Terrasse changed from 0.0 to 100.0
2020-08-06 09:59:57.705 [vent.ItemStateChangedEvent] - Rollershutter_Terrasse changed from 100.0 to 0.0
2020-08-06 09:59:57.714 [vent.ItemStateChangedEvent] - Dimmer_Terrasse changed from 100.0 to 0.0
2020-08-06 10:00:10.843 [vent.ItemStateChangedEvent] - Rollershutter_Terrasse changed from 0.0 to 100.0
2020-08-06 10:00:10.848 [vent.ItemStateChangedEvent] - Dimmer_Terrasse changed from 0.0 to 100.0
2020-08-06 10:00:11.463 [vent.ItemStateChangedEvent] - Rollershutter_Terrasse_Door changed from 0.0 to 100.0
2020-08-06 10:00:11.467 [vent.ItemStateChangedEvent] - RollladenTerrassentR_Roller_RollerControl changed from 0.0 to 100.0

Is there a solution?

Regard
Georg

please show your item definitions
which version are you running?
2.5.7 release or DEV build

Hi Markus,
thank you for your answer.
I have version 2.5.7 running.
My definition looks like this:

Blockquote
Rollershutter Rollershutter_Terrasse_Door “Terrasse Tuer” { channel=“shelly:shelly25-roller:68c63af97c4d:roller#control”}
Rollershutter Rollershutter_Terrasse “Terrasse” { channel=“shelly:shelly25-roller:68c63af91248:roller#control”}
Dimmer Dimmer_Terrasse “Terrasse Position” { channel=“shelly:shelly25-roller:68c63af91248:roller#control”}

And I can control them, but the logfile allways tells me the position changed from 0 to 100 and from 100 to 0 but they don’t move in that time.