Zwave "network_key" value in HASS config?

So they mentioned this in the podcast that you can now set the network_key value in the config.yaml.

I’ve tried it as:

zwave:
  usb_path: /dev/zwave
  device_config: !include zwave_device_config.yaml
  config_path: /srv/homeassistant/src/python-openzwave/openzwave/config
  new_entity_ids: true
  network_key: "0x01 hex values..."

both with and without quotes. I’ve also tried commenting out the “config_path” from the config and keeping the network key value in there. Is this right? The network key I’m using is the same in the un-commented options.xml under that config directory.

I’m asking here because there isn’t an example on the hass.io website of how to use this value.

Thanks!

1 Like

Does this post help at all?

Thanks for the reply, but I’m already using the options.xml file, and linking to the /config directory. That seems to be working fine.

On the Z-Wave page, it states that you can use a property called “network_key” in your configuration.yaml file instead. I’d like to go this route in case for some reason that directory gets removed or updated.

I was taking another look at the doc again to reference the portion I was talking about, and it looks like I was looking at an outdated version for some reason.

network_key (Optional): The 16 byte network key in the form “0x01,0x02…” used in order to connect securely to compatible devices.

So it looks as if I need to surround the key with quotes, and have no spaces. I’ll give this a go later tonight then.

Thanks!

1 Like

Did this work for you?

In case someone else encounters that:
You should add something similar to the following in your configuration.yaml under the zwave component -

zwave:
  usb_path: /dev/your path...
  network_key: "0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11"

Obviously, change the key to something random (i.e. replace each pair of 11 with other more random pair). Just ensure to keep the exact same format, including the quotes.

The one-liner from the Zwave configuration page is an easy way to generate a unique value for the network key
cat /dev/urandom | tr -dc '0-9A-F' | fold -w 32 | head -n 1 | sed -e 's/\(..\)/0x\1, /g' -e 's/, $//'

3 Likes

Does this mean the NetworkKey field is no longer required in the options.xml?

Correct - it’s been many months since it could (and should) be stored in your HA configuration.

1 Like

I’m trying to setup my aeotec z-stick gen5 and am having trouble with the network_key option.

If I leave the network_key off, it works, but then I can’t use all of my devices fully. However, with network_key defined as 16 comma-separated hex values in quotes, it tells me the zwave component could not be configured.

Any ideas on what may be going wrong? I have these settings in configuration.yaml. Should they be somewhere else?

You should put them in secrets, but you don’t have to. Your configuration should look like:

zwave:
  network_key: "0xDE, 0xAD, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0xBE, 0xEF"

Thank you, I’ll do that.

The problem actually ended up being something else. At some point, the path changed from /dev/ttyACM0 to /dev/ttyACM1 and that was causing the problem.

looks like now you can specify /zwaveusbstick instead of /dev/ttyACM0 and it figures out the usb enumeration automatically. Can anyone confirm? I’ve struggled with this also.

Just for anyone trying to hunt down the HASSIO auto generated network key, I finally figured out where it was stored. In the following file has the Z-wave network key config: “config/.storage/core.config_entries”. I guess when I set up HASSIO I put a key in (and didn’t remember) or it was auto generated but wasn’t in my other config files. I couldn’t figure out where to find it or pull it from the logs. After much hunting i figure it out and thought I would share.

9 Likes