Shelly Binding

yes

  • open the device’s web ui
  • on the left you find Diagnostics
  • click the play button on the upper right corner of the panel
  • wait until script dies
  • download debug data

Of course, via the IP address…

Okay, will come back with the logs later.

I have to leave the “Diagnostics” window open in the browser? Otherwise it doesn’t seem to log…

Furthermore, which log should I enable?

Here is the error when the script stops:

shelly_bluetooth_rel:91 ADV b0:c7:de:32:b9:90: mfd={“0ba9”:“AQEACwIACpC5Mt7HsA==”}, svc={“fcd2”:“RADIAWQFhAMALQA/AADwAgLxAAkAAQ==”}

12:13:00

Uncaught Error: Cannot read property ‘t’ of undefined

12:13:00

at _value = this.getBufValue(_bth.t, buffer);

12:13:00

^

12:13:00

in function “unpack” called from …ice_data[BTHOME_SVC_ID_STR]);

12:13:00

^

12:13:01

in function “getData” called from …ShellyBLUParser.getData(res); // skip if parsing failed

12:13:01

^

12:13:01

in function called from system

12:13:01

12:13:01

shelly_user_script.:397 error: Error in EjsCall

12:13:01

shelly_notification:163 Status change of script:1: {“id”:1,“errors”:[“error”],“running”:false}

Here’s mine (I have a more elaborate file in case there’s previous stuff important, but it looks like attachments are impossible):

shelly_notification:163 Status change of switch:0: {"id":0,"aenergy":{"by_minute":[0.000,0.000,0.000],"minute_ts":1706558939,"total":49589.837}}
21:09:00
shos_rpc_inst.c:355 0x3ffe2b00: duplicate id 'shellyplus1pm-d4d4da7df89c'
21:09:32
shos_rpc_inst.c:230 Shelly.GetStatus via HTTP_in POST 192.168.1.9:52218
21:09:32
shelly_bluetooth_rel:91 ADV 3c:2e:f5:69:4b:59: mfd={"0ba9":"AQEACwIACllLafUuPA=="}, svc={"fcd2":"RAAuAWQFAAAALQA/AADwAgLxAAkAAQ=="}
21:09:33
Uncaught Error: Cannot read property 't' of undefined
21:09:33
at _value = this.getBufValue(_bth.t, buffer);
21:09:33
^
21:09:33
in function "unpack" called from ...ice_data[BTHOME_SVC_ID_STR]);
21:09:33
^
21:09:33
in function "getData" called from ...ShellyBLUParser.getData(res); // skip if parsing failed
21:09:33
^
21:09:33
in function called from system
21:09:33
21:09:33
shelly_user_script.:397 error: Error in EjsCall
21:09:33
shelly_notification:163 Status change of script:1: {"id":1,"errors":["error"],"running":false}
21:09:34

Is there a bug in the shelly binding or another Problems with Shelly BLU Sensors? There are some problems, because the status is not updatet. For much details, have a look at: Problems with Shelly BLU Door/Window Sensor - Add-ons / Bindings - openHAB Community

Thanks Sebastian

See above :wink:

I took an (uneducated) guess and changed line 97 of the script from

if (_bth === "undefined") {

to:

if (typeof _bth === "undefined") {

I would expect there to be either “typeof”, or no quotation marks. But I could be wrong, of course.

Let’s see if this new code stays alive. @MiniOh, can you try this as well?

I tried in the meantime. For me is running for more than 6 hours until know.

Unfortunatelly it stopped again.

Same Error?

Do you mean you encountered the same error? The question mark is throwing me off. :slight_smile:

My code is still running since I altered it.

I now for two days had an issue with a Shelly Plus 1 not being reachable from OpenHAB.

The Thing showed “ERROR:COMM”, and in the log file I can see this error:

2024-01-31 09:46:04.636 [WARN ] [y.internal.handler.ShellyBaseHandler] - shellyplus1-7c87ce64f858: ERROR: Unable to process command ON for channel shelly:shellyplus1:4cbd683cd4:relay#output - API Timeout for POST http://192.168.0.27/rpc

During the time this error was shown, a ping to the IP address worked and I could control the Shelly via the Shelly app. After I restarted OH, also OH showed the Thing as “ONLINE” again and could control it. Any idea what could cause such a timeout, when the device is actually reachable?

With this change the script definitely runs longer. But it was finished last night and again this morning.
But I don’t have an error message about it yet.
The log only seems to be written when the browser is open and you are still logged in.

Indeed. Makes logging more difficult, of course…

Too bad it broke again… Mine is still alive, but I shouldn’t get my hopes up, apparently.

I now see that this solution was already thought of a day earlier: [shelly] Script oh-blu-scanner.js crashes in Shelly Plus when receiving buffer contains data of "undefined" type · Issue #16344 · openhab/openhab-addons · GitHub

My script is still alive, by the way.

I change line 97 on the Gateway Shelly.
But this is always “overwritten”.
Where does it come from?

I have the same.

Deactivate “BLU Gateway Support” in your openhab thing configuration of your shelly plus device, after you modified the script. This option keeps overwriting your changes.
Your shelly BLU things will still work in openhab as long as the modified script is running.

Mmm why hasn’t it overwritten my script yet?