+1 same here
I can see the messages of the lock coming in when I’m listening manually.
But when I run this script as service, I see the same errors in the logs.
EDIT:
I managed to get it working.
The first exception comes from get_error_message, where two strings are concatenated with variable “parameter”. Since “parameter” is None when the required data doesn’t contain a device_id, this exception is thrown.
Then when the proposed change is applied, get_error_message outputs “Parameter None is required”, because in lines 233, 237 and 241 call get_error_message(device_id) (and device_id doesn’t exist).
I changed the code from line 232-242 to the following, to get better error messages (quotes + correct names):
if device_id == None or device_id == “”:
logger.error(get_error_message(“device_id”))
return
if device_name == None or device_name == “”:
logger.error(get_error_message(“device_name”))
return
if device_model == None or device_model == “”:
logger.error(get_error_message(“device_model”))
return
And then I realised that I was calling the service without appending the required data, as described on the Github page.
To get it working, execute the following in Developer tools:
- Service: Python Scripts: nuki_mqtt_discovery
- Go to YAML mode and make sure you add the required fields:
service: python_script.nuki_mqtt_discovery
data:
device_id: [ID OF YOUR LOCK IN HEX]
device_name: [NAME OF YOUR LOCK]
device_model: Smart Lock 3.0 Pro
Run the service, and the device will appear under your MQTT devices.