iobroker-community-adapters / ioBroker.shelly

Integrate your Shelly devices into ioBroker via MQTT or CoIoT
Other
167 stars 67 forks source link

[Bug]: mqtt prefix issue: Shellys constantly disconnect #1026

Open jenbenn opened 2 months ago

jenbenn commented 2 months ago

I'm sure that

Shelly device

all Gen 2 devices connected via mqtt

Shelly firmware version

1.4.0

Protocol

MQTT

The problem

I still have a major issue with shellys spamming the protocol of iobroker with millions of "Client close" and "unable to get mqttprefix of client" messages, practically jamming the iobroker. The whole System becomes totally unresponsive and inoperative. It takes about 6-8 hours for the issue to settle down and all shellys to have a stable connection without interruption.

I had a hint that this may be due to an incompatible switch in my network, so I ordered a new switch from a different manufacturer and installed it. However that did not change anything, if at all the problem got worse.

Can somebody please help? I am now using a Fritzbox 7590 with 4 Fritz repeaters configured as access points and connected via RJ45 to a TP link managed switch TL SG116E.

Is there any setting I need to change to solve this issue?

iobroker.current.log (in debug mode!)

  | Nachricht -- | -- shelly.1 | 2024-08-15 09:23:18.444 | info | [MQTT] Device with client id "shellyplus2pm-c049ef836d4c" connected! shelly.1 | 2024-08-15 09:23:07.718 | info | [MQTT] Device with client id "shellyplusplugs-e465b8432078" connected! shelly.1 | 2024-08-15 09:23:06.389 | info | [MQTT] Device with client id "shellyplusplugs-d48afc5717dc" connected! shelly.1 | 2024-08-15 09:22:39.399 | error | [MQTT] Unable to get mqttprefix of client with id "shelly1pmmini-348518df2440" shelly.1 | 2024-08-15 09:22:39.398 | error | [MQTT] Unable to get mqttprefix of client with id "shellyplus2pm-b8d61a894dbc" shelly.1 | 2024-08-15 09:22:39.398 | error | [MQTT] Unable to get mqttprefix of client with id "shellyplus2pm-80646fdc2a00" shelly.1 | 2024-08-15 09:22:39.294 | error | [MQTT] Unable to get mqttprefix of client with id "shellyplusplugs-d48afc56da50" shelly.1 | 2024-08-15 09:22:39.252 | error | [MQTT] Unable to get mqttprefix of client with id "shellyplus1-441793a38f98" shelly.1 | 2024-08-15 09:22:39.058 | error | [MQTT] Unable to get mqttprefix of client with id "shellyplus2pm-c049ef87cf00" shelly.1 | 2024-08-15 09:22:39.294 | error | [MQTT] Unable to get mqttprefix of client with id "shellyplusplugs-d48afc56da50" shelly.1 | 2024-08-15 09:22:39.252 | error | [MQTT] Unable to get mqttprefix of client with id "shellyplus1-441793a38f98" shelly.1 | 2024-08-15 09:22:39.058 | error | [MQTT] Unable to get mqttprefix of client with id "shellyplus2pm-c049ef87cf00" shelly.1 | 2024-08-15 09:22:39.021 | info | [MQTT] Client Close: (shellyplus2pm / shellyplus2pm-80646fdc2a00 / shellyplus2pm#80646fdc2a00#1) (false) shelly.1 | 2024-08-15 09:22:38.879 | error | [MQTT] Unable to get mqttprefix of client with id "shellyplus2pm-c049ef8690a8" shelly.1 | 2024-08-15 09:22:38.878 | error | [MQTT] Unable to get mqttprefix of client with id "shellyplus2pm-441793cefd9c" shelly.1 | 2024-08-15 09:22:38.790 | error | [MQTT] Unable to get mqttprefix of client with id "shellyplus1pm-083af201f0f0" shelly.1 | 2024-08-15 09:22:38.788 | error | [MQTT] Unable to get mqttprefix of client with id "shellyplus2pm-c049ef836d4c" shelly.1 | 2024-08-15 09:22:38.786 | error | [MQTT] Unable to get mqttprefix of client with id "shellyplus2pm-c049ef8d77c8" shelly.1 | 2024-08-15 09:22:38.784 | error | [MQTT] Unable to get mqttprefix of client with id "shellyplus1-441793cf9f1c" shelly.1 | 2024-08-15 09:22:36.333 | info | [MQTT] Client Close: (shellyplusplugs / shellyplusplugs-d48afc56da50 / shellyplusplugs#d48afc56da50#1) (false) shelly.1 | 2024-08-15 09:22:34.853 | info | [MQTT] Client Close: (shellyplus2pm / shellyplus2pm-c049ef8690a8 / shellyplus2pm#c049ef8690a8#1) (false) shelly.1 | 2024-08-15 09:22:33.876 | info | [MQTT] Client Close: (shellyplus2pm / shellyplus2pm-c049ef87cf00 / shellyplus2pm#c049ef87cf00#1) (false) shelly.1 | 2024-08-15 09:22:30.837 | info | [MQTT] Client Close: (shelly1pmmini / shelly1pmmini-348518df2440 / shelly1pmmini#348518df2440#1) (false) shelly.1 | 2024-08-15 09:22:29.023 | info | [MQTT] Device with client id "shellyplus2pm-80646fdc2a00" connected!

Version of nodejs

18.19.0

Version of ioBroker js-controller

5.0.19

Version of adapter

7.0.0

github-actions[bot] commented 2 months ago

Thanks for reporting a new issue @jenbenn!

  1. Please make sure your topic is not covered in the documentation
  2. Please attach all necessary log files (in debug mode!), screenshots and other information to reproduce this issue
  3. Search for the issue topic in other/closed issues to avoid duplicates!

    Otherwise this issue will be closed.

JoergGiencke commented 2 months ago

Firstly, I would update the js-controller to the latest version (5.0.19 > 6.0.9). This may not help, but should be ruled out as a source of error.

jenbenn commented 2 months ago

Firstly, I would update the js-controller to the latest version (5.0.19 > 6.0.9). This may not help, but should be ruled out as a source of error.

Done this morning. No change, issue still persists. Its been going on for months, no update of Node-JS or JS-controller ever changed anything.

jenbenn commented 2 months ago

Here is the log from one of the sehllies: Connected. 12:36:05 shelly_debug.cpp:236 Streaming logs to 192.168.178.27:50651 12:36:05 shos_rpc_inst.c:242 Shelly.GetComponents via SHC 34.78.248.225:6022 12:36:05 shos_dns_sd_respond:236 ws(0x3ffde4a8): Announced ShellyPlusI4-083AF20117F4 any@any (192.168.178.143) 12:36:08 shos_mqtt_conn.c:623 MQTT0: Connecting to 192.168.178.87:1882 (192.168.178.87:1882) 12:36:47 shos_mqtt_conn.c:512 MQTT0: Connect status 257 12:36:57 shos_mqtt_conn.c:885 MQTT0: Connecting after 57980 ms 12:36:57 shos_mqtt_conn.c:623 MQTT0: Connecting to 192.168.178.87:1882 (192.168.178.87:1882) 12:37:55 shos_mqtt_conn.c:512 MQTT0: Connect status 257 12:38:05 shos_mqtt_conn.c:885 MQTT0: Connecting after 57176 ms 12:38:05 wifi I (5344087) wifi:int: state=0 i=2 12:38:15 wifi I (5344097) wifi:int: state=0 i=0 12:38:15 shos_mqtt_conn.c:623 MQTT0: Connecting to 192.168.178.87:1882 (192.168.178.87:1882) 12:39:02 shos_mqtt_conn.c:512 MQTT0: Connect status 257 12:39:12 shos_mqtt_conn.c:885 MQTT0: Connecting after 58595 ms 12:39:12 shos_time.c:54 Setting time from SNTP (1724063955.818 delta -0.036) 12:39:15 shelly_sys.cpp:217 Time set to 5402.892225 from 1 12:39:15 wifi I (5404167) wifi:int: state=0 i=2 12:39:15 wifi I (5404247) wifi:int: state=0 i=0 12:39:15 wifi I (5439357) wifi:int: state=0 i=2