Setting the network key for secure devices

I’m moving all my stuff over from SmartThings, as I was doing this, I got to my locks. I struggled with these for a long time, trying to decipher error messages, etc. Finally figured out I needed to set them up as secure devices (makes sense) and, after consulting the documentation, I needed to set the network key. I did this in the configuration.yaml file. Still no luck, same result. I was just about to give up for the night when I happened to look inside options.xml and see there is a Network Key field in there that’s commented out. Gave it one last shot defining the same network key in there and woohoo, success!

So my question is, Do you have to define the network key in both configuration.yaml and options.xml or only in options.xml? Once I got it working, I tried to search specifically for options.xml and still couldn’t find anything, if this is documented somewhere, it’s not easily found.

It’s supposed to be pulled from the configuration, and a key is set automatically. It sounds like you’ve hit a bug - please open an issue.

If you setup configuration.yaml originally without a network_key, a random one would have been generated for you. Once the key is generated, it cannot be changed unless you delete the integration from the UI. Setting it in configuration.yaml after already configuring it will have no effect, only the usb_path will override the integration value.

If you look in the file .storage/core.config_entries you will probably see an network key that does not match the one you are using.

Thanks, I’ll open an issue.

I didn’t have one setup originally and it doesn’t look like there is one defined in that core.config_entries file. The only thing in there is from my original attempt to setup the zwave controller, I had the device path incorrectly entered as /dev/ttyAMC0 and it’s actually /dev/USB0 on my system. Under that there’s a "network_key": null, is all. I don’t even see my /dev/ttyUSB0 device in that file, I do see my zigbee controller in there that’s /dev/ttyUSB1.

Then it’s likely then that importing from the config file doesn’t generate a network key for you, only when you use the UI Integration, so that would explain why your key is null since the default value is None. If you edit that file (shutdown HA first) and add your key (making sure the format is correct) you won’t need options.xml any longer.

When Z-Wave first implemented the Integration support, it imported the configuration.yaml values once, and ignored them forever. Then this change, reverted back to the original behavior, so now the usb_path in configuration.yaml always overrides what was set in the integration. The patch did not change how network_key is handled, so it still ignores any value in configuration.yaml.

You could probably make a valid argument that the same code change should be applied to the network key as with the usb path. You will run into problems though if you change your network key from a non-null one after already secure including other nodes. So I can understand why the code was never changed to allow it.