Yes, please. I was already asking for it, but without luck so far:
Hi !
I have managed to get it to work with HA, and got all of the sensors and functionality, cool!
However, in the 2 weeks I had it working, my battery level dropped from 100% to 20%! normally this takes me 6-10 weeks.
I’ve noticed suspicious activity on the LED indicated quite frequently - as frequently as once a minutes. Could this configuration somehow cause the lock to abandon normal power saving methods and run through the battery on always-on WIFI connectivity?
Hilik
Anyone else experiencing this? In the full week since removing the MQTT entity created by the autodiscovery script my battery merely went from 100% to 90% - perfectly fine…
Would really love to restore the batery indicator functionality though…
Read the MQTT spec. Page 4 says:
When the debug mode of the Smart Lock and “LED signal on the Smart Lock” are
both active, the red LED of the Smart Lock acts as a traffic indicator for incoming
WIFI packets, similar to a traffic indicator of a network switch. Turn off “LED signal on
the Smart Lock” to disable this diagnostic feature.
And yes, this can drain your Smart Locks battery very quickly.
What drains the battery - the LED indication or the actual debug mode?
BTW - my LED flashes mostly white, just very rarely red.
Thanks a lot for your work.
Because I sometimes prefer complicated things I have created a YAML configuration for my Smartlock and your script helped me to confirm I understood the documentation correctly.
To be honest, it looks like more state are supported by MQTT auto-discovery I.E. locking, unlocking and opening state are not available according to the Home Assistant documentation so I will miss some information so looks like using auto-discovery makes the integration more complete.
EDIT: after reading homeassistant/components/mqtt/lock.py
, it looks like these states are not managed at all so YAML configuration and auto-discovery both provide exactly the same features.
Hi Patrick,
I’m still a little bit stuck in integrating the lock to HA because I cannot use the script in HACS.
May you be so kind and share your yaml config?
Thanks a lot!
Dominik
To be honest, I’ve succesfully checked it by comparing with the script and syntactically but I’m still procrastinating the migration from the actual working integration using my bridge to the new with WI-Fi
I plan to do it tomorrow (I know, it looks like another procrastination ) and as soon as I will be sure it is OK I will share it for sure.
If you really need it before I test it I can share it with you but I prefer waiting to be sure it works before sharing anything
To install the script with HACS Phyton scripts for HomeAssistant must be activated, see: Repository can currently not be integrated via HACS · Issue #1 · MattDog06/Nuki-MQTT-auto.-Discovery · GitHub
@fireballrs I posted my configuration in the topic about Home Assistant autodiscovery implementation specifications to avoid polluting this post which is specifically about the script made by @MattDog_06
Hey Patrick,
thank you for sharing me the link to your config. Got it working but so far i never get live values and i can’t lock / unlock the door. So i think i need a bit more testing with the mqtt connection.
greetings
dominik
Hi all,
I’ve forked this script from @MattDog_06 to make it more complient to Home Assistant best practices for MQTT auto discovery.
Differences with original script
- The smartlock ID is used for entity unique IDs instead of the name which could be changed
Using this method, if the smartlock is renamed in the Nuki app, the existing entities will be updated instead of create new entities (not visible actually but would be an issue when the smartlock will manage MQTT) - Node ID is not used anymore for MQTT topics
- MQTT abbreviations are used
- Locking, unlocking and jammed states are implemented. This change should be visible from Home Assistant 2023.2
- Open and opening states are removed, these don’t exist in Home Assistant for lock entities
- Apply conventional namming for entities, for example the door sensor of the smartlock Front door will be named Front door Door sensor instead of Front door Door Sensor
- In the rot of the repository, there is now a script to remove original device and entities.
It uses the same parameters you used to add the smartlock entities,nuki_remove_old
has to be used instead ofnuki_mqtt_discovery
when calling the service, you must place thepython_scripts/nuki_remove_old.py
to thepython_script
subdirectory of your Home Assistant configuration directory
I would recommand to use this implementation, particularly because the original one did not implement real unique IDs, in the case it would be used officially you would have two smartlock if renamming the old one.
Do not esitate if you need some help and if some idea about facilitating old MQTT topics removal.
I would honestly have prefered these modification to be implemented in the original repository but I unfortunately had no answer when I made pull requests.
@mattdog_06 if you read it and are OK to discus about updating your script I would be glad if we could share our competences
Link to the fork:
Hi @Nardol,
Thanks for your work! Unfortunately I can’t install it correcty. Only the file python_scripts/nuki_remove_old.py
ist there after installing with HACS as described. The other one is missing. There is also no error in the log. Do you have any idea why this could Happen?
Any advice would be appreciated!
Hi @Grawper
The reason looks being between my chair and my keyboard please test 2.0.1 and tel me if you still encounter any issue.
If it is the case I will create separate repository for the removal script.
In this release I also removed all unlatch related state to return unlocked, I think I made things to much complicated by doing this, lock should stay in unlocked state with previous information returned by the smartlock.
The Installation with HACS is working fine now, thanks! I already tried to set it all up but so far the Lock is shown as unavailable in HA. I did not really find a guide how to set it up so I did the following:
- Installed Beta Firmware 3.5.6 on lock
- Enabled debug mode
- set up a user called nuki with password SHA256 of WiFi PW in mosquitto in HA (I use the mosquitto addon). I have read this in the mqtt API Specification
- restarted lock by removing battery Back
However it is still not working and I did not yet find a possibility to debug this. In the Specification it says you can check the mqtt connection in the App but I did not find it there.
Is there anything I missed or some general guide how to set it up? And is there any possibility to debug this on my side?
Thanks in advance for any help
Edit: I have read through some other posts and I guess I have found a possibe issue. The lock cannot find my mqtt Server because it is execting it at mqtt.local. So I guess I have to set up some local DNS server for this. I will try to do it in the next days. And I also found out that I can’t find anything in the App due to the beta status.
Yes, your MQTT server must be accessible at mqtt.local (MDNS) or mqtt (using local DNS).
I use Home Assistant core so I was able to set a service adding mqtt.local using a MDNS alias which I believe is not possible with HA OS or HA supervised, the only solution is to set a local DNS on your network which would be set to all your machins using DHCP or using another machine always online on your local network to set a MDNS alias.
I published the last version: 2.1.
A new parameter remove_lock
is added to remove all created MQTT topics, which will remove device and associated entities.
To use it you also have to specify other usual parameters.
And if you want to apply the last version, this parameter must be used firstly because now really all unique IDs are prefixed with nuki_
to be sur of their uniqueness.
Do not esitate to make some feedback if I made a mistake or if you have some question.
I am aware I make too much changes but I want to be sure all is at least near perfect for Home Assistant integration.
That’s why I don’t want to touch anything else from now except if there is a bug somewhere.
Hi all,
in case anyone stumbles across this post (as this ist also in the release now): I installed the addon dnsmasq for home assistant to resolve the address. It worked perfectly.
Hi and thanks for the hint. I’m googling a while now and are not able to find out if dnsmasq supports mDNS. How is your config? Did you announce the DNS server through DHCP to all devices in the network or do you configure dnsmasq to announce the host mqtt.local via mDNS? Last option I would prefer if possible…