nuki_hub icon indicating copy to clipboard operation
nuki_hub copied to clipboard

Nuki Hub gets unavailable for a couple of hours a day - also tries to reconnect every minute afterwards

Open DeckardCain2014 opened this issue 1 year ago • 11 comments

PROBLEM DESCRIPTION

Nuki Hub is several times a day unavailable via MQTT for several hours.

REQUESTED INFORMATION

  • [x] Read the Contributing Guide and Policy and the Code of Conduct
  • [x] Searched the problem in issues
  • [x] Searched the problem in discussions
  • [x] Searched the problem in the docs
  • [x] Searched the problem in the chat
  • [x] Device used (e.g., ESP32-S3): ESP32 NodeMCU Module
  • [x] Nuki Hub binary firmware version number used: 8.35
    • [x] Pre-compiled
    • [ ] Self-compiled
  • [x] Provide the output of http://nukihubIP/info:
System Information
Nuki Hub version: 8.35
Nuki Hub build: 9596492875.1136.1 (release)
run: true
confVersion: 835
deviceId: 4004615175
deviceIdOp: 4004615175
nukiId: ***
nukidOp: 
mqttbroker: 192.168.178.170
mqttport: 1883
mqttuser: ***
mqttpass: ***
mqttlog: false
checkupdates: true
websrvena: false
lockena: true
lockpin: 1
mqttpath: nuki
openerena: false
openerpin: 
openercont: false
mqttoppath: 
maxkpad: 
opmaxkpad: 
maxtc: 
opmaxtc: 
enabtlprst: false
mqttca: 
mqttcrt: 
mqttkey: 
hassdiscovery: homeassistant
hassConfigUrl: 
buffsize: 
dhcpena: true
ipaddr: 
ipsub: 
ipgtw: 
dnssrv: 
nwhw: 1
nwwififb: false
rssipb: 60
hostname: nukihub
nwbestrssi: true
nettmout: 500
restdisc: true
rstbcn: 60
lockStInterval: 1800
tcPerEntry: false
kpPerEntry: false
configInterval: 3600
batInterval: 1800
kpInterval: 1800
kpCntrlEnabled: true
kpInfoEnabled: false
kpPubCode: false
tcCntrlEnabled: false
tcInfoEnabled: false
cnfInfoEnabled: false
regAsApp: false
regOpnAsApp: false
nrRetry: 3
rtryDelay: 100
crdusr: 
crdpass: 
disnonjson: false
pubAuth: false
pubdbg: false
prdtimeout: 60
offHybrid: false
hybridTimer: 600
hybridAct: false
hybridRtry: false
hasmac: false
macb0: 
macb1: 
macb2: 
latest: 8.35
tsksznetw: 
tsksznuki: 
authmaxentry: 
kpmaxentry: 
tcmaxentry: 
MQTT connected: Yes
Lock firmware version: 3.9.5
Lock hardware version: 4.10
Lock paired: Yes
Lock valid PIN set: Yes
Lock has door sensor: No
Lock has keypad: No
Lock ACL (Lock): Allowed
Lock ACL (Unlock): Allowed
Lock ACL (Unlatch): Allowed
Lock ACL (Lock N Go): Allowed
Lock ACL (Lock N Go Unlatch): Allowed
Lock ACL (Full Lock): Allowed
Lock ACL (Fob Action 1): Allowed
Lock ACL (Fob Action 2): Allowed
Lock ACL (Fob Action 3): Allowed
Lock config ACL (Name): Disallowed
Lock config ACL (Latitude): Disallowed
Lock config ACL (Longitude): Disallowed
Lock config ACL (Auto Unlatch): Disallowed
Lock config ACL (Pairing enabled): Allowed
Lock config ACL (Button enabled): Allowed
Lock config ACL (LED flash enabled): Allowed
Lock config ACL (LED brightness): Disallowed
Lock config ACL (Timezone offset): Disallowed
Lock config ACL (DST mode): Disallowed
Lock config ACL (Fob Action 1): Disallowed
Lock config ACL (Fob Action 2): Disallowed
Lock config ACL (Fob Action 3): Disallowed
Lock config ACL (Single Lock): Allowed
Lock config ACL (Advertising Mode): Disallowed
Lock config ACL (Timezone ID): Disallowed
Lock config ACL (Unlocked Position Offset Degrees): Disallowed
Lock config ACL (Locked Position Offset Degrees): Disallowed
Lock config ACL (Single Locked Position Offset Degrees): Disallowed
Lock config ACL (Unlocked To Locked Transition Offset Degrees): Disallowed
Lock config ACL (Lock n Go timeout): Disallowed
Lock config ACL (Single button press action): Disallowed
Lock config ACL (Double button press action): Disallowed
Lock config ACL (Detached cylinder): Disallowed
Lock config ACL (Battery type): Disallowed
Lock config ACL (Automatic battery type detection): Disallowed
Lock config ACL (Unlatch duration): Disallowed
Lock config ACL (Auto lock timeout): Disallowed
Lock config ACL (Auto unlock disabled): Allowed
Lock config ACL (Nightmode enabled): Disallowed
Lock config ACL (Nightmode start time): Disallowed
Lock config ACL (Nightmode end time): Disallowed
Lock config ACL (Nightmode auto lock enabled): Disallowed
Lock config ACL (Nightmode auto unlock disabled): Disallowed
Lock config ACL (Nightmode immediate lock on start): Disallowed
Lock config ACL (Auto lock enabled): Allowed
Lock config ACL (Immediate auto lock enabled): Disallowed
Lock config ACL (Auto update enabled): Disallowed
Network device: Built-in Wi-Fi
BSSID of AP: 34:31:C4:FB:FD:88
Uptime: 13 minutes
Heap: 78136
Stack watermarks: nw: 7092, nuki: 4924, pd: 7092
Restart reason FW: RestartOnDisconnectWatchdog
Restart reason ESP: ESP_RST_SW: Software reset via esp_restart.
 

TO REPRODUCE

Let Nuki Hub run a few hours. Then it is shown as unavailable in HomeAssistant for a couple of hours. Later, it automatically reappears and works as designed.

EXPECTED BEHAVIOUR

Connection stays stable.

SCREENSHOTS

none

ADDITIONAL CONTEXT

Output from Mosquito broker:

2024-06-26 18:28:04: New client connected from 192.168.178.81:60166 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:28:28: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:28:34: New connection from 192.168.178.81:60167 on port 1883.
2024-06-26 18:28:34: New client connected from 192.168.178.81:60167 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:28:58: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:29:04: New connection from 192.168.178.81:60168 on port 1883.
2024-06-26 18:29:04: New client connected from 192.168.178.81:60168 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:29:28: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:29:34: New connection from 192.168.178.81:60169 on port 1883.
2024-06-26 18:29:34: New client connected from 192.168.178.81:60169 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:29:58: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:30:04: New connection from 192.168.178.81:60170 on port 1883.
2024-06-26 18:30:04: New client connected from 192.168.178.81:60170 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:30:28: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:30:39: New connection from 192.168.178.81:60171 on port 1883.
2024-06-26 18:30:39: New client connected from 192.168.178.81:60171 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:31:04: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:31:10: New connection from 192.168.178.81:60172 on port 1883.
2024-06-26 18:31:10: New client connected from 192.168.178.81:60172 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:31:34: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:31:40: New connection from 192.168.178.81:60173 on port 1883.
2024-06-26 18:31:40: New client connected from 192.168.178.81:60173 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:32:04: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:32:13: Saving in-memory database to /data//mosquitto.db.
2024-06-26 18:32:15: New connection from 192.168.178.81:60174 on port 1883.
2024-06-26 18:32:15: New client connected from 192.168.178.81:60174 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:32:40: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:32:46: New connection from 192.168.178.81:60175 on port 1883.
2024-06-26 18:32:46: New client connected from 192.168.178.81:60175 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:33:10: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:33:16: New connection from 192.168.178.81:60176 on port 1883.
2024-06-26 18:33:16: New client connected from 192.168.178.81:60176 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:33:40: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:33:46: New connection from 192.168.178.81:60177 on port 1883.
2024-06-26 18:33:46: New client connected from 192.168.178.81:60177 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:34:10: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:34:16: New connection from 192.168.178.81:60178 on port 1883.
2024-06-26 18:34:16: New client connected from 192.168.178.81:60178 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:34:40: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:34:46: New connection from 192.168.178.81:60179 on port 1883.
2024-06-26 18:34:46: New client connected from 192.168.178.81:60179 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:35:10: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:35:29: New connection from 192.168.178.81:60181 on port 1883.
2024-06-26 18:35:29: New client connected from 192.168.178.81:60181 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:35:52: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:35:58: New connection from 192.168.178.81:60182 on port 1883.
2024-06-26 18:35:58: New client connected from 192.168.178.81:60182 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:36:22: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:36:28: New connection from 192.168.178.81:60183 on port 1883.
2024-06-26 18:36:28: New client connected from 192.168.178.81:60183 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:36:52: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:36:58: New connection from 192.168.178.81:60184 on port 1883.
2024-06-26 18:36:58: New client connected from 192.168.178.81:60184 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:37:22: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:37:36: New connection from 192.168.178.81:60186 on port 1883.
2024-06-26 18:37:36: New client connected from 192.168.178.81:60186 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:37:58: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:38:04: New connection from 192.168.178.81:60187 on port 1883.
2024-06-26 18:38:04: New client connected from 192.168.178.81:60187 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:38:28: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:38:39: New connection from 192.168.178.81:60188 on port 1883.
2024-06-26 18:38:39: New client connected from 192.168.178.81:60188 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:39:04: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:39:15: New connection from 192.168.178.81:60189 on port 1883.
2024-06-26 18:39:15: New client connected from 192.168.178.81:60189 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:39:40: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:39:51: New connection from 192.168.178.81:60190 on port 1883.
2024-06-26 18:39:51: New client connected from 192.168.178.81:60190 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:40:16: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:40:26: New connection from 192.168.178.81:60191 on port 1883.
2024-06-26 18:40:26: New client connected from 192.168.178.81:60191 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:40:52: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:41:01: New connection from 192.168.178.81:60192 on port 1883.
2024-06-26 18:41:01: New client connected from 192.168.178.81:60192 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:41:28: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:41:37: New connection from 192.168.178.81:60193 on port 1883.
2024-06-26 18:41:37: New client connected from 192.168.178.81:60193 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:42:04: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:42:12: New connection from 192.168.178.81:60194 on port 1883.
2024-06-26 18:42:12: New client connected from 192.168.178.81:60194 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:42:34: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:42:47: New connection from 192.168.178.81:60195 on port 1883.
2024-06-26 18:42:47: New client connected from 192.168.178.81:60195 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:43:10: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:43:23: New connection from 192.168.178.81:60196 on port 1883.
2024-06-26 18:43:23: New client connected from 192.168.178.81:60196 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:43:46: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:43:58: New connection from 192.168.178.81:60197 on port 1883.
2024-06-26 18:43:58: New client connected from 192.168.178.81:60197 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 18:44:22: Client nukihub has exceeded timeout, disconnecting.
2024-06-26 18:47:32: New connection from 192.168.178.81:51014 on port 1883.
2024-06-26 18:47:32: New client connected from 192.168.178.81:51014 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 19:02:14: Saving in-memory database to /data//mosquitto.db.
2024-06-26 19:32:15: Saving in-memory database to /data//mosquitto.db.
2024-06-26 20:02:16: Saving in-memory database to /data//mosquitto.db.
2024-06-26 20:13:26: New connection from 192.168.178.81:54669 on port 1883.
2024-06-26 20:13:26: Client nukihub already connected, closing old connection.
2024-06-26 20:13:26: New client connected from 192.168.178.81:54669 as nukihub (p2, c0, k15, u'mqttUser').
2024-06-26 20:15:23: New connection from 192.168.178.81:59567 on port 1883.
2024-06-26 20:15:23: Client nukihub already connected, closing old connection.
2024-06-26 20:15:23: New client connected from 192.168.178.81:59567 as nukihub (p2, c0, k15, u'mqttUser').

(Please, remember to close the issue when the problem has been addressed)

DeckardCain2014 avatar Jun 26 '24 18:06 DeckardCain2014

Same here. If mosquitto Broker output is needed please just tell.

StefanX13 avatar Jun 28 '24 08:06 StefanX13

I suggest trying the latest PR with Arduino Core 3 and IDF 5.1. Besides many changes to the networking stack it also includes nuki hub specific improvements regarding MQTT.

You can find the binaries here: https://github.com/technyon/nuki_hub/actions/runs/9711394389

Do note that these binaries need to be flashed using USB/serial once because of changes to the partition table.

iranl avatar Jun 28 '24 18:06 iranl

I tried flashing it with the Espressif Flash Download Tools, however it shows only 'null' in the command line and red fields in the UI

DeckardCain2014 avatar Jun 29 '24 07:06 DeckardCain2014

I find that to be a horrible tool and exclusively use esptools.

See https://docs.espressif.com/projects/esptool/en/latest/esp32/installation.html or https://www.flamingo-tech.nl/2021/03/21/installing-and-using-esptools/ for how to install esptools.

You can just use the command in the how-to-flash.txt file. You only need to change the COM port.

iranl avatar Jun 30 '24 17:06 iranl

Worked now. Different machine, different tool. I will update here how stable it is

DeckardCain2014 avatar Jul 01 '24 16:07 DeckardCain2014

Basically it works now. However, the main lock topic is unavailable image

DeckardCain2014 avatar Jul 01 '24 16:07 DeckardCain2014

Is there a solution to unknown state?

fir3drag0n avatar Jul 02 '24 21:07 fir3drag0n

I suggest trying the latest PR with Arduino Core 3 and IDF 5.1. Besides many changes to the networking stack it also includes nuki hub specific improvements regarding MQTT.

You can find the binaries here: https://github.com/technyon/nuki_hub/actions/runs/9711394389

Do note that these binaries need to be flashed using USB/serial once because of changes to the partition table.

with this binary, I cannot get a connection by ethernet anymore, specifically with a M5Stack Atom PoE Kit - W5500. Nuki Hub does not respond anymore. If I disconnect it from the module, I can reach it by wifi.

fir3drag0n avatar Jul 06 '24 15:07 fir3drag0n

I can conform that core 3 breaks both W5500 and LAN8720 ethernet support. Please follow up regarding this in issue #416, not here.

technyon avatar Jul 06 '24 15:07 technyon

Lets keep this open until we have confirmation this is fixed in latest builds

iranl avatar Jul 09 '24 11:07 iranl

I just flashed the latest build (9876220444.1180.1), trying this now.

DeckardCain2014 avatar Jul 10 '24 18:07 DeckardCain2014

Works like a charm since then!

DeckardCain2014 avatar Jul 14 '24 06:07 DeckardCain2014

Thanks for reporting back.

Closing as completed

iranl avatar Jul 14 '24 15:07 iranl

Unfortunately I'm still having issues with the lock being unavailable.

While the builds from main are better. They still haven't fixed it for me!

MQTT just stays unconnected, despite the restart on disconnect option being ticked. Sometimes it's fine for days. Other times only a few hours. With 8.33 I never had this issue.

adamlc avatar Jul 21 '24 20:07 adamlc

@adamlc Could you get serial logs while this is happening?

technyon avatar Jul 22 '24 09:07 technyon

I'll see what I can do to capture them :)

adamlc avatar Jul 22 '24 13:07 adamlc

Just a quick update. I've now had different behaviour without any changes.

MQTT is now reported as connected but updates aren't sent and everything seems out of sync with HA. Unfortunately I've not been able to get any logs at the time it happens.

Because of the instability I've had to sadly revert to 8.33 as that was rock solid before. All the new improvements to 8.35 did look fantastic and I hope with some more time I can debug.

adamlc avatar Jul 26 '24 10:07 adamlc

@adamlc Which version are you on now?

technyon avatar Jul 26 '24 12:07 technyon

Back on 8.33 which has since been rock solid!

adamlc avatar Jul 29 '24 07:07 adamlc

And the problems you had with 8.35, or the 9.0 beta, or both?

technyon avatar Jul 31 '24 11:07 technyon

Sorry for the late reply on this. Seems to now be resolved on the stable 9.0 builds 👍

adamlc avatar Aug 30 '24 07:08 adamlc

It's really stable now with 9.0! Thanks for all the work 🍾

DeckardCain2014 avatar Aug 30 '24 08:08 DeckardCain2014