Shelly Button 1 - no/unreliable events and triggers

I’m using OpenHAB 3.1 with a lot of Shelly devices, working fine.
Now I added a new Shelly Button 1, but the events do only work for some time after I restart OpenHAB or disable/enable the thing in OpenHAB. The rules for “received update” of the input or lastEvent are only called a few times and then not any more.
The same is true for the trigger rule. It works a few times, but then it’s not called any more.
This one is looking like this:

rule "Shelly Button 1 Schlafzimmer"
  Channel "shelly:shellybutton1:XXXXXX:status#button" triggered
  logInfo("Info", "Shelly Button 1 Schlafzimmer: Trigger: " + receivedEvent.toString())

The events.log does not contain any events from the Shelly Button 1 if the rules are not called any more.

The Shelly Button 1 is basically working fine, because using the Action URLs of the device itself is working 100% reliable.

Any help is much appreciated! :slight_smile:


1 Like

Had the same problem with the trigger and found this to be more reliable:

Item GA_TorklingelButton_EventCount changed

where the item has been defined with the “eventCount” channel.

Hi Falk - thanks for this hint, but unfortunately this does not work much better here. I’m also missing the appropriate event messages inside the events.log file for the Shelly button 1.
All other Shelly devices are 100% reliable with the binding. The action URLs of the Shelly button 1 are also 100% reliable. My guess is, that it has something to do with the Shelly binding itself.

1 Like

Same issue here after Shelly Dimmer2 Update.

Found a workaround:

EDIT: No, I did not. Making changes on the Shelly Setup activated somehow the original function again. Please don’t ask my why.
The Follwing will not work!

creating a html file in /etc/openhab/html/Get2PostKitchenButtonEdgeOn.html

var myHeaders = new Headers();
myHeaders.append("Content-Type", "text/plain");
var raw = "ON";
var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
fetch("http://192.168.XXX.XXX:8080/rest/items/itemKitchenButtonEdgeOn", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

created the item
Switch itemKitchenButtonEdgeOn

Added to Shelly Actions BUTTON 1 SWITCHED ON URL

Lets keep an eye on Shelly 2.5 gen1 not firing event · Issue #67975 · home-assistant/core · GitHub

1 Like

Nice workaround, which I’d like to use in a similar use case with a Shelly1. But I realized, that the Javascript code gets not executed (no rest api call to OH) when the Shelly calls the configured Action URL. If I manually open the configured Action URL in a Chrome Browser it works as expected.

Is this not possible with a Shelly1? Any hint?

There should be no difference in this peace of software to other Shellys. Sounds more like a issue that your Shelly does not open or can not reach the url. Make sure your Shelly has really activated it (maybe a reboot) and there are no network restrictions.

Well that’s interesting. To be sure that the Shelly is actually executing and reaching the configured I/O action urls, I temporary setup a nginx webserver on the same openhab host and changed the action urls accordingly. First it was somehow unreliable, but after a restart of the Shelly it worked as expected, I see the Shelly requests in the nginx log. (nginx runs of course on a different port than OH, but I have no port restrictions inside my LAN)
I did this, because I suspect that there is no access log file which I can use to verify that requests to http://a.b.c.d:8080/static/foo.html are coming in. Or is there one?

I got similar problem today with my shelly button1.
I was working without porblem fro 3 month.
I am using a trigger on event count and then activate the action depending on the event state like the following example created in a Blockly script

// triple appui sur bouton shelly Chb
if (itemRegistry.getItem('ButtonSASshellybutton1349454768980192168176_Event').getState() == 'SSS') {
  if (itemRegistry.getItem('BIR_xBFE_3070_1_Neon_DO1').getState() == 'ON') {
    events.sendCommand('BIR_xBFE_3070_1_Neon_DO1', 'OFF');
  } else {
    events.sendCommand('BIR_xBFE_3070_1_Neon_DO1', 'ON');

This morning, nothing was working.
The Eventcount was not increasing anymore when I pressed the button so the script was not triggered.
The battery level was 61%, The button could be reached on his IP when connecting it on usb power.
Nothing appeared in the openhab frontail
I forced a reboot but without more success (event count was staying to 230, its last value since yesterday)

The disable led selector was working, i triggered it and got messsage in the frontail

20 minute later, without any action (but keeping the button on power supply, i got the even count suddendly update from 230 to 244.
So it seems that the event where recorded somewhere in a queue .

2023-03-03 08:05:03.661 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'ButtonSASshellybutton1349454768980192168176_DisableStatusLED' received command ON

2023-03-03 08:05:03.663 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'ButtonSASshellybutton1349454768980192168176_DisableStatusLED' predicted to become OFF

2023-03-03 08:18:50.619 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ButtonSASshellybutton1349454768980192168176_ForceSignal' changed from 3 to 2

2023-03-03 08:18:50.745 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ButtonSASshellybutton1349454768980192168176_EventCount' changed from 230 to 244

2023-03-03 08:18:50.825 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ButtonSASshellybutton1349454768980192168176_NiveauBatterie' changed from 69 % to 100 %

but new pressure on the button do not have effect anymore.

Any idea to diagnose or solve this?

Thanks in advance for any feedback
openHAB 3.3.0
Release Build


i don’t have any knowledge regading HTML Post / get…

I tried your solution but i could not get any result, is there anything to do on openhab like restart or refresh to make the html file running some action in openhab?

How can i adapt this html post script to the case of the shelly button 1 where i have 4 actions for one button
depending on numbre of pressure and short / long pressure.
I can associate an http link with a different script to to each action in the button but how to create the link the to toggle a light already existing in my openhab config?

Thanks for any feedback

It took some time to figure out what happend. I can not explain it and I was not aware of because I used the same item. But when I entered the “Switch on URL” into the shelly configuration, the original Openhab Shelly Binding reached the Shelly again without my knowledge.

I have tried it afterwards I entered the URL and I saw it worked well. But it was not the website that triggered it, it was the Shelly Binding that started working again after I have enabled the BUTTON 1 SWITCHED ON URL.

So my solution is unfortunatelly not a solution. I am awfully sorry. But now do not ask me why the binding is fixed after my change. My only explanation is some Network issue, but now that I dont have the problem any more, I can not debug it any more.