Set up everything from the ground up - where is my network key pulled from?

This is strange. I have a lock that is added secure to the network. I set up Home Assistant from the ground up again to update everything to Buster. And the lock works as it should, which means that the network key is correct, but I can’t find out where it gets the network key from! The file options.xml has the network key commented out, so it’s not from there. I can only assume that it’s from the Z-Stick, and that it doesn’t need to have the key set in Home Assistant anymore. Is that right, or am I totally wrong here? Also I was unable to pair a device securely, is that because there is no network key set in options.xml? I’m afraid to mess with it and maybe mess up my setup!

The network key should be in your configuration.yaml file under zwave:

It’s not. As I said I set up the system from the ground up, and when I tried to add anything to the config file, Hass refused to start. So this is my full config file (password redacted):

# Configure a default setup of Home Assistant (frontend, api, etc)

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
   api_password: My_top_secret_password

# Text to speech
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

So everything I added (MQTT, Z-Wave, Telldus Live) was added as integrations. All though I think Z-Wave was added automatically, probably since it saw the Z-Stick connected to it.

Then I fear you might need to re-add all the devices. Do you have a backup of your old config by chance? Maybe you are also able to get the network key, add it to your configuration.yaml and it will work again but I’m not sure, you need to test this.
This might be helpful as well

Thanks, I have a backup of all the home automation I have done since around 1998, when I started! :wink: So that’s not the problem. I know what my key is too. So the question was more of curiosity, where Home Assistant pulls this key from since it’s not in the configuration, but it is obviously used, or the secure included lock would not work.

Edit: And it can’t be a randomly generated key Hass is using, because that would crash with the securely included lock too, and I would be unable to get the status from it or lock and unlock it.

That’s good :slight_smile: I could imagine that it’s somehow saved in the Z-Wave stick, but no idea how Home Assistant was able to connect to it. Maybe there is something stored in one of the config json files.

Maybe, I’l have a look through those. But it seems like HS can only partly use it since it’s able to communicate with stuff that’s already added, but not to add new secure nodes. Weird.

Your network key is stored in the .storage directory in configuration file there.

Thanks, found it! :slight_smile: So I must have put it in there at some point. Can’t remember when, though. And it doesn’t explain why my secondary controller, which I added today to do an OTA update, can’t see the info on the secue node. Maybe it just doesn’t work using a secondary cotntroller in that way in Hass? I know it works in Smart Things (a guy on a Norwegian forum did it), but I don’t think anybody has tried in Hass. I can get info frm and switch on and off all non secure stuff, but not get info from the secure node.

By default Home Assistant generates a random key for you on install.

Home Assistant, as far as I am aware, does not support secondary controllers for Zwave.

There some broadcast command you’d need to send in order to get it done, you’d have to check the OpenZwave forums/mailing list.

@firstof9 I don’t think you read the messages over. If Home Assistant generated a random key that worked with the lock that was added secure before I did the new installation, that would be a security hole I could drive the new Ford Mustang Mach E through. :wink: So it’s not generated, it’s pulled from somewhere. My guess is the Z-Stick, but I’m not sure.

Home Assistant can add secondary controllers, that was exactly what I did. I haven’t tried to use it as a secondary controller with Hass, but I will probably try for fun. What it can’t seem to do is to add the controller securely, so it gets access to secure nodes.

And thanks for the tip about the OZW forums, I will check out that.

The zstick does not store network keys, only device associations. As for why your network key seems to have not changed the only way that could occur is if you used the same config files because that is the ONLY place the network key would be stored.

1 Like

Then I know what the reason. must be I tried to start the latest Hass with my old config.yaml file, which contained the key. It froze some time during the startup (the files in .Homeassistant stopped changing), but the key must have been copied from the config.yaml to .storage. That’s the only possibility, since I didn’t copy .storage. It’s the old Arthur Conan Doyle axiom:

" Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth."

1 Like