nuki_hub
nuki_hub copied to clipboard
Better MQTT Auto. Discovery for Home Assistant
In general a better MQTT auto. discovery for Home Assistant would be nice. I have created some payloads and added them manually. It would be nice if someone could add them to the source: Front Door Lock.zip .
Originally posted by @MattDog06 in https://github.com/technyon/nuki_hub/issues/27#issuecomment-1209282129
Hi,
noticed and some are already implemented. It's very tedious to generate the home assistant JSON in C++.
Which of the sensors and switches are most important to add?
Not sure if it works, but there appears to be a library to help with that.
Edit: I read up a bit on the library and it appears to do more than just generate the autodiscovery topics. Probably not to useful then.
Hi, for me personal is the most import the lock/doorSensorState.
Yes the door sensor makes a lot of sense. I've added it in release 5.11.
Bringing over the various configuration switches would be nice in the long run. Also some diagnostic sensors like uptime (to detect restarts) and #33,
I believe that MQTT discovery payloads can be improved a bit (based on my experience implementing similar stuff):
- I see that you use device name to generate entity names, by adding prefixes to it, like
name + "bluetooth signal strength"
. Instead, you can set name to"Bluetooth signal strength"
and additionally generateobject_id
field usinguidString
. In this case, HASS will useobject_id
to generate entity ID, and it won't depend of device name (which is mutable) and entity name will be short but still linked to the correct device entity - I've got better results by using
"optimistic": true
mode, because, when Nuki and ESP32 aren't fast enough in connecting/executing/pushing state back, you can experience entity state flickering as HASS expects nearly immediate broadcast of updated status. - You generate JSONs as strings by concatenation, is there a reason for not using ArduinoJson library for that? Size constraints maybe? The library is small and handy and improves code readability and maintenance a lot
I believe that MQTT discovery payloads can be improved a bit (based on my experience implementing similar stuff):
@kvj your knowledge on Nuki APIs and HA could be really valuable if you decide to contribute to this project. I just received some M5AtomU and M5AtomLite to test. I hope we can finally get rid of the Nuki Bridge thanks to the work of @technyon. :)