I integrated the new MQTT API (v1.4) into the Smart Home Software IP-Symcon (IPS) with success.
So IPS acts as a MQTT Server and subscribes to all topics the Smart Lock (SL) is publishing.
On the first provisioning and connection to IPS the SL publishes all topics and IPS retains them.
This will be also done if the SL restarts (plug battery off, plugin in battery again).
From there on the SL only publishes changes to IPS. I think that is the idea of MQTT.
So far, so good.
Now it cloud happen that the IPS MQTT Server is down for any reason.
So the SL can’t publish his topics/changes.
Also in the app the connection is marked as disconnected.
So is there an automatic reconnect from the SL to IPS?
Can I force the SL to publish all topics again without restarting the SL?
The Smart Lock makes a reconnect trial once per hour or when its own WIFI connectivity drops. All topics will be republished upon reconnect. i.e. just wait and everything should come back.
MQTT Server switched to offline.
Smart Lock recognizes that the MQTT Server connection is offline.
MQTT Server switched on after several minutes.
Smart Look did a reconnect and publishes topics.
Hi to all.
3 days ago i bought my First smart lock, nuki 3.0 pro.
I have a Raspberry with home assistant and a broker mqtt (mosquitto).
All works fine but… If i reboot my Raspberry (for any reason, for example After an update), the nuki lose the mqtt connection and i have to reconfigure It from nuki app. Is there a way to get automatic reconnect? Maybe it happens automatically after a long time?
Thanks
Hi my Nuki is loosing connection after some time to mqtt server. Sometimes after whole home assistant stack restart, but in my opinion it happens just sporadically. any hints how to solve?
If you also restart your mqtt server it can take up to 1h until the Smart Lock reconnects.
The WiFi reconnect scheme is connected to the connection to the Nuki servers. i.e. you might see connects & disconnects if your internet goes up&down. If you just wait it should reconnect.
@Juergen thanks for your reply.
Unfortunately it does not reconnect. It even lost connection yday without any restart on HA stack. Nuki reconnects only if I go into the App → Funktionen und Konfiguration → MQTT → Tap on already configured MQTT server (with green mark) → Sichern (Save) without any change.
After the tap Nuki reconnects immediatly and the status and controls are visible/usable in Home Assistant again.
The problem might not be the connection but that not all services are republished upon every reconnect, especially the retained HA config topics.
When the problem occurs again, please connect with a desktop MQTT client to your MQTT server and check which topics you see for your Nuki lock. Most likely they are not the same than the ones you see when you connect right now, when everything is ok.
same problem here after a lost connection to my Matt server because of a reboot. these are the republished topics in my case (way to less topics):
another problem: the reconnect itself is way too long… what if my mitt server reboots when I am not at home, and I return lets say 30 minutes after a reboot. the Nuki Lock will reconnect in 60minutes (as far as I understand), so its not reconnected when coming home and I cannot open my door
any ideas how to handle that?
Hi @Juergen , unfortunately I have still issues with auto-reconnecting to MQTT server. Nuki lock does not reconnect even after few hours. The problem is that Nuki app or maybe the lock itself does not remember mqtt password (only the user does). So after trying to re-connect it uses blank password. My MQTT setup is without anonymous allowed and every service integrated to mosquitto server has own user and pw.
Good morning @Juergen
I tried to repower the unit and it seems working great in that case
MQTT server log:
Blockquote
2023-09-14 06:39:16: Client SL3P_3709CD64 already connected, closing old connection.
2023-09-14 06:39:16: New client connected from 192.168.4.94:52433 as SL3P_3709CD64 (p2, c1, k300, u’nuki’).
2023-09-14 06:39:56: Saving in-memory database to mosquitto.db.
But if we lost connection to MQTT server in another scenario (restarting MQTT docker or whole NAS server) the Nuki does not reconnect automatically.
My assumption is that the Nuki is set correctly when the power is lost and it does what it is supposed to do. But if only the connectivity between the lock and the MQTT server is lost, then Nuki does not try to connect with the mqtt username and mqtt password which was set.