Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nukihub 9.09 disconnects from MQTT server and the Web UI still shows "connected: yes" #637

Open
10 tasks done
ssorgatem opened this issue Mar 7, 2025 · 19 comments
Open
10 tasks done

Comments

@ssorgatem
Copy link

ssorgatem commented Mar 7, 2025

PROBLEM DESCRIPTION

NukiHub disappears from Home Assistant 2 minutes after rebooting, and won't appear until I manually reboot the nukihub. In the web UI MQTT appears as "connected" both before and after disappearing from Home Assistant (however int he info page MQTT appears as "disconnected", so t the very least this is a bug concerning the UI not agreeing witht he info page)

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

System Information
------------ NUKI HUB ------------
Device: ESP32-C3
Version: 9.09
Build: 13675437614.11.1
Build type: Release
Build date: 2025-03-05
Updater version: 9.09
Updater build: 13675437614.11.1
Updater build date: 2025-03-03
Uptime (min): 1320
Config version: 909
Last restart reason FW: RestartOnDisconnectWatchdog
Last restart reason ESP: ESP_RST_SW: Software reset via esp_restart.
Free internal heap: 60944
Total internal heap: 255368
PSRAM Available: No
Network task stack high watermark: 7652
Nuki task stack high watermark: 5484

------------ SPIFFS ------------
SPIFFS Total Bytes: 113201
SPIFFS Used Bytes: 27359
SPIFFS Free Bytes: 85842

------------ GENERAL SETTINGS ------------
Network task stack size: 12288
Nuki task stack size: 8192
Check for updates: Yes
Latest version: 9.09
Allow update from MQTT: Yes
Update Nuki Hub and Nuki devices time using NTP: Yes
Web configurator username: ***
Web configurator password: ***
Web configurator bypass for proxy IP: Not set
Web configurator authentication: Basic
Session validity (in seconds): 3600
Session validity remember (in hours): 720
Duo Push MFA enabled: No
TOTP MFA enabled: No
Web configurator enabled: Yes
HTTP SSL: Disabled
Advanced menu enabled: No
Publish free heap over MQTT: No
Nuki connect debug logging enabled: No
Nuki communication debug logging enabled: No
Nuki readable data debug logging enabled: No
Nuki hex data debug logging enabled: No
Nuki command debug logging enabled: No
MQTT log enabled: Yes
Webserial enabled: No
Bootloop protection enabled: No

------------ NETWORK ------------
Network device: Built-in Wi-Fi
Network connected: Yes
IP Address: 192.168.7.199
SSID: Shub-Niggurath
BSSID of AP: 24:2F:D0:32:9B:D2
ESP32 MAC address: 64:E8:33:88:63:48

------------ NETWORK SETTINGS ------------
Nuki Hub hostname: nukihub
DHCP enabled: No
Static IP address: 192.168.7.199
Static IP subnet: 255.255.255.0
Static IP gateway: 192.168.7.1
Static IP DNS server: 192.168.7.214
RSSI Publish interval (s): 60
Find WiFi AP with strongest signal: Yes
Restart ESP32 on network disconnect enabled: Yes
Disable Network if not connected within 60s: No
MQTT Timeout until restart (s): 60

------------ MQTT ------------
MQTT connected: No
MQTT broker address: 192.168.7.215
MQTT broker port: 1883
MQTT username: ***
MQTT password: ***
MQTT base topic: nukihub
MQTT SSL: Disabled

------------ BLUETOOTH ------------
Bluetooth connection mode: New
Bluetooth TX power (dB): 9
Bluetooth command nr of retries: 3
Bluetooth command retry delay (ms): 100
Seconds until reboot when no BLE beacons received: 60

------------ QUERY / PUBLISH SETTINGS ------------
Lock/Opener state query interval (s): 1800
Publish Nuki device authorization log: No
Max authorization log entries to retrieve: 5
Battery state query interval (s): 1800
Most non-JSON MQTT topics disabled: Yes
Publish Nuki device config: Yes
Config query interval (s): 3600
Publish Keypad info: No
Keypad query interval (s): 1800
Enable Keypad control: Yes
Publish Keypad topic per entry: No
Publish Keypad codes: No
Allow checking Keypad codes: No
Max keypad entries to retrieve: 10
Publish timecontrol info: No
Keypad query interval (s): 1800
Enable timecontrol control: Yes
Publish timecontrol topic per entry: No
Max timecontrol entries to retrieve: 10
Enable authorization control: No
Publish authorization topic per entry: No
Max authorization entries to retrieve: 5

------------ HOME ASSISTANT ------------
Home Assistant auto discovery enabled: Yes
Home Assistant auto discovery topic: homeassistant/
Nuki Hub configuration URL for HA: http://192.168.7.199
Nuki Hub ID: 79592324065380

------------ NUKI LOCK ------------
Lock enabled: Yes
Lock Ultra enabled: No
Paired: Yes
Nuki Hub device ID: 774882908
Nuki device ID: ***
Firmware version: 4.4.9
Hardware version: 8.3
Valid PIN set: Yes
Has door sensor: No
Has keypad: No
Timecontrol highest entries count: 0
Authorizations highest entries count: 0
Register as: App

------------ HYBRID MODE ------------
Hybrid mode enabled: Yes
Hybrid mode connected: Yes
Reboot Nuki lock on official MQTT failure: Yes
Sending actions through official MQTT enabled: Yes
Retry actions through BLE enabled: Yes
Time between status updates when official MQTT is offline (s): 600
Force Lock ID: No
Force Lock Keypad: No
Force Lock Doorsensor: No

------------ NUKI LOCK ACL ------------
Lock: Allowed
Unlock: Allowed
Unlatch: Allowed
Lock N Go: Allowed
Lock N Go Unlatch: Allowed
Full Lock: Allowed
Fob Action 1: Allowed
Fob Action 2: Allowed
Fob Action 3: Allowed

------------ NUKI LOCK CONFIG ACL ------------
Name: Allowed
Latitude: Allowed
Longitude: Allowed
Auto Unlatch: Allowed
Pairing enabled: Allowed
Button enabled: Allowed
LED flash enabled: Allowed
LED brightness: Allowed
Timezone offset: Allowed
DST mode: Allowed
Fob Action 1: Allowed
Fob Action 2: Allowed
Fob Action 3: Allowed
Single Lock: Allowed
Advertising Mode: Allowed
Timezone ID: Allowed
Unlocked Position Offset Degrees: Allowed
Locked Position Offset Degrees: Allowed
Single Locked Position Offset Degrees: Allowed
Unlocked To Locked Transition Offset Degrees: Allowed
Lock n Go timeout: Allowed
Single button press action: Allowed
Double button press action: Allowed
Detached cylinder: Allowed
Battery type: Allowed
Automatic battery type detection: Allowed
Unlatch duration: Allowed
Auto lock timeout: Allowed
Auto unlock disabled: Allowed
Nightmode enabled: Allowed
Nightmode start time: Allowed
Nightmode end time: Allowed
Nightmode auto lock enabled: Allowed
Nightmode auto unlock disabled: Allowed
Nightmode immediate lock on start: Allowed
Auto lock enabled: Allowed
Immediate auto lock enabled: Allowed
Auto update enabled: Allowed
Reboot Nuki: Allowed
Motor speed: Allowed
Enable slow speed during nightmode: Allowed

------------ NUKI OPENER ------------
Opener enabled: No

------------ GPIO ------------

Retain Input GPIO MQTT state: No

TO REPRODUCE

Steps to reproduce the behavior:
Just boot nukihub as always, but with version 9.09. It didn't happen with 9.08.

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen.
To keep the connection to the MQTT broker

SCREENSHOTS

If applicable, add screenshots to help explain your problem.

Image
The UI shows MQTT connected, but the info says it's not, and it's "unavailable" in Home Assistant

ADDITIONAL CONTEXT

Add any other context about the problem here.
The MQTT broker is mosquitto on a Debian stable server, and there's a bunch of other stuff using it. Among these, notably, a Nuki V4 lock, which I can still control through the official MQTT over thread.

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

@Ra72xx
Copy link

Ra72xx commented Mar 7, 2025

Same here. I had the problem already with previous versions, but with 9.09 the hub is offline for homeassistant most of the time. Mosquitto log shows very often messages like Client nukihub has exceeded timeout, disconnecting. .
EDIT:
Nukihub is only visible from Homeassistant directly after a reboot, after a few minutes it will became unavailable. The Nukihub info page will still show that MQTT is connected now and then afterwards, but in Homeassistant only a reboot will make it available again for a limited time.
For me Nukihub is completely unusable unfortunately. I now implement a fallback option over official MQTT (which still works) in Homeassistant to get at least basic functionality working.

@h1ghrise
Copy link

h1ghrise commented Mar 7, 2025

Same here. Had to revert back to 9.08

@technyon
Copy link
Owner

technyon commented Mar 8, 2025

At this point I really have no idea what could be causing this. Can you get serial logs while this is happening?

@bcutter
Copy link
Contributor

bcutter commented Mar 8, 2025

Thanks for filing this issue. That way one can skip this 9.09 release or revert to 9.08. So far nearly every 9.x release had similar surprises unfortunately.

Did you all have had similar issues (unavailable, out of sync web/HA/MQTT) with previous versions too (just not that excessively)?

@technyon
Copy link
Owner

technyon commented Mar 9, 2025

At this point it's a guessing game about what's happening. As a start, I'd need serial logs.

@ssorgatem
Copy link
Author

At this point it's a guessing game about what's happening. As a start, I'd need serial logs.

All I seem to get from the serial is this:

ESP-ROM:esp32c3-api1-20210207␍␊
Build:Feb  7 2021␍␊
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)␍␊
Saved PC:0x40382388␍␊
SPIWP:0xee␍␊
mode:DIO, clock div:1␍␊
load:0x3fcd5820,len:0x1024␍␊
load:0x403cc710,len:0x968␍␊
load:0x403ce710,len:0x2cc4␍␊
entry 0x403cc710␍␊

and nothing more until I reboot and I get the same

@technyon
Copy link
Owner

So after this there's no more serial output? This is from serial, not MQTT logs?

@ssorgatem
Copy link
Author

Yes, this is from serial, USB directly plugged into my PC and reading with cutecom.

Tried enabling all kinds of debug logs in the advanced settings, and rebooting, and nothing changed

@technyon
Copy link
Owner

Something is wrong here, with this kind of output there shouldn't be a web UI. At the very least you should get regular messages that the Nuki and Network task are running. Without the latter, there's no web interface.

@ssorgatem
Copy link
Author

I flashed the 9.08 binary from releases, and looked at the serial output through minicom (just in case it was a cutcom problem), and this is all the output I get:

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382388
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5820,len:0x1024
load:0x403cc710,len:0x968
load:0x403ce710,len:0x2cc4
entry 0x403cc710

Looks like the only serial output is from the bootloader. Nukihub 9.08 works without problem... but there is nothing logged to the serial.

@ssorgatem
Copy link
Author

I'm trying to bisect this but I'm having trouble building some of the commits with this error:

*** [.pio/build/esp32-c3/.pio/build/esp32-c3/x509_crt_bundle.S.o] Source `.pio/build/esp32-c3/x509_crt_bundle.S' not found, needed by target `.pio/build/esp32-c3/.pio/build/esp32-c3/x509_crt_bundle.S.o'.

@ssorgatem
Copy link
Author

The aforementioned error starts appearing after commit 59a5f02 ("Rename root CA bundle", 2025-02-16).
The commit right before that builds and it works.

@ssorgatem
Copy link
Author

I built 9.09 myself and... it kinda works. It reboots itself every 6-7 minutes with a ESP_RST_PANIC: Software reset due to exception/panic. but other than it works just fine, unlike the binary downloaded from releases.

I still can't get anything useful from the serial though.

@Ra72xx
Copy link

Ra72xx commented Mar 14, 2025

Anything one can do to help solve this problem?
I reverted to 9.07, which works flawlessly, and then to 9.08. 9.08 works, but strangely after a restart of Homeassistant Nukihub has always to be restarted, too, so that HA recognizes it again. So there seems to be some kind of MQTT problem also with 9.08.

@technyon
Copy link
Owner

I don't see any obvious changes regarding MQTT between 9.08 and 9.09, at this point I'm out of ideas, especially since there are no serial logs.

@ssorgatem You're using 115200 baud to get the serial logs?

@ssorgatem
Copy link
Author

Yes, and all I can see is bootloader stuff.

More puzzling still, I rebuilt 9.09 with no changes to code at all, and it now works. After a day or so it has stopped rebooting and it just works.

So maybe the issue is not in the source code but on the build itself...?

@technyon
Copy link
Owner

It sounds quite unlikely to me, unless you changed something about the build configuration. You could post your binary here for other users to test.

@iranl
Copy link
Collaborator

iranl commented Mar 14, 2025

Imho a very bad idea to suggest users try a binary from an untrusted source.

@technyon
Copy link
Owner

@ssorgatem I'd think the problem is somewhere else anyway. Maybe just start over, factory reset your ESP and flash the official Nuki Hub binary. You're using the C3 which is a single core chip, maybe it's worth trying an S3 preferrably with PSRAM. Sorry I can't give you more specific help, but without proper serial logs it's impossible to tell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants