Z-wave Network Key Persistence

Whenever I updated home assistant (or maybe just on some version updates?) my z-wave network key gets wiped. This is quite annoying because I have to then remove my secure devices, re-add the network key to the appropriate file, and then re-add the devices.

Does anyone know how to prevent this from happening in the future?

I’m running home assistant (0.64.3) on a raspberry pi3 in a venv.

Updating should not touch your configuration files. Is anything else getting rewritten?

As far as I know, no. All of my other z-wave devices, automations, media players, scripts, floorplan, etc. are fine.

Where is your key stored? What happens to the file?

It is located at /srv/homeassistant/homeassistant_venv/lib/python3.6/site-packages/python_openzwave/ozw_config/config/options.xml

When it gets “wiped,” the file is set to how it is by default, with the key set to <!-- <Option name="NetworkKey" value="0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10" /> --> and commented out.

Thank you so much for your help!

Key should be stored in configuration.yaml, as per the docs👍

Ah indeed you’re correct! I think “back in the day” there wasn’t an option for a key in the config.

Regarding the doc, this information is on the “installation” page as opposed to the general component page, unlike other components. Do you agree with me that this should be moved? If so I might make a docs pull request.

I’m going to add the key to my config file and hope that upon next update it seamlessly cuts over, and doesn’t require a remove node/re-add. Does this syntax below look right to you? (Obviously I actually have other parameters in my config, and use secret. :slight_smile: )

zwave:
  network_key: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10

Off the top of my head it needs to be in quotes, but double check with the docs. I’m not home atm and mine is in secrets too so I can’t see if it’s in quotes or not.

Yeah, I think the docs for Zwave need a bit of a clean up.