danielwelch / hassio-zigbee2mqtt

Hass.io add-on for zigbee2mqtt
Apache License 2.0
565 stars 190 forks source link

Can't save config if 'GENERATE' is used for network_key #522

Closed Duckle29 closed 3 years ago

Duckle29 commented 3 years ago

zigbee2mqtt add-on version (if edge, please report commit hash): 1.17.0.1

Operating environment (HassOS, Virtual Machine, Device/platform running Home Assistant): HassOS RPi 4 - 4GB Boot from USB SSD

Description of problem: Setting the network key to "GENERATE" causes saving the config to fail .

Your entire configuration from the frontend (with sensitive fields redacted):

data_path: /share/zigbee2mqtt
external_converters: []
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: false
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://core-mosquitto'
  user: mosquitto
  password: '!secret zigbee2mqtt_pass'
serial:
  port: /dev/ttyACM0
advanced:
  log_level: info
  pan_id: 6754
  channel: 15
  network_key: 'GENERATE'
  availability_blocklist: []
  availability_passlist: []
device_options: {}
blocklist: []
passlist: []
queue: {}
frontend:
  port: 8099
experimental:
  new_api: true
socat:
  enabled: false
  master: 'pty,raw,echo=0,link=/dev/ttyZ2M,mode=777'
  slave: 'tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5'
  restartdelay: 1
  initialdelay: 1
  options: '-d -d'
  log: false

Your logs from Home Assistant Failed to save addon configuration, not a valid value for dictionary value @ data['options']. Got ...

ciotlosm commented 3 years ago

This is due to option validation that expects an array https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/blob/dev/zigbee2mqtt/config.json#L124

I will have to check if options allow multiple option types in the schema.

Duckle29 commented 3 years ago

makes sense :) I stuck with the string option for now. I actually never checked if that supports generate, or if it'll cause issues with the key changing on reboots.

ciotlosm commented 3 years ago

Related to https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/issues/39 (new issues should go to new repo)