hassio-zigbee2mqtt icon indicating copy to clipboard operation
hassio-zigbee2mqtt copied to clipboard

ENOENT: no such file or directory, open '/config/zigbee2mqtt/secret.yaml'

Open ViRuSTriNiTy opened this issue 1 year ago • 0 comments

Hi there,

I currently trying to switch from ZHA to Zigbee2MQTT but I struggle to get the password setting right.

The documentation in section Specifying MQTT server/user/password and network_key in a different file states that password: '!secret.yaml password' could be used to store the password in secret.yaml.

I have tried to leave out the .yaml to use the approach documented on page [Storing secrets]https://www.home-assistant.io/docs/configuration/secrets/] of the official Homage Assistant but it seems that Zigbee2MQTT does not support it. When I start the add on everything works but as soon as an action is executed, like removing a device in the Web UI, the add-on crashes and the logs will contain the following lines:

Zigbee2MQTT:info  2022-12-20 18:16:09: Removing device '0xb4e3f9fffec1f918' (block: false, force: true)
Zigbee2MQTT:debug 2022-12-20 18:16:09: Clearing Home Assistant discovery topic for '0xb4e3f9fffec1f918'
Zigbee2MQTT:error 2022-12-20 18:16:09: Request 'zigbee2mqtt/bridge/request/device/remove' failed with error: 'Failed to remove device '0xb4e3f9fffec1f918' (block: false, force: true) (Error: ENOENT: no such file or directory, open '/config/zigbee2mqtt/secret.yaml')'
Zigbee2MQTT:debug 2022-12-20 18:16:09: Error: Failed to remove device '0xb4e3f9fffec1f918' (block: false, force: true) (Error: ENOENT: no such file or directory, open '/config/zigbee2mqtt/secret.yaml')
    at Bridge.removeEntity (/app/lib/extension/bridge.ts:577:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Creting file /config/zigbee2mqtt/secret.yaml solves the error but this results in

error 2022-12-20 18:02:07: TypeError: Cannot read properties of undefined (reading 'j1shin_password')
    at Object.updateIfChanged (/app/lib/util/yaml.ts:30:16)
    at write (/app/lib/util/settings.ts:222:22)
    at Object.addDevice (/app/lib/util/settings.ts:552:5)
    at Device.ensureInSettings (/app/lib/model/device.ts:41:22)
    at Zigbee.resolveDevice (/app/lib/zigbee.ts:234:20)
    at /app/lib/zigbee.ts:276:30
    at Array.map (<anonymous>)
    at Zigbee.devices (/app/lib/zigbee.ts:276:14)
    at Zigbee.start (/app/lib/zigbee.ts:113:35)
    at Controller.start (/app/lib/controller.ts:101:27)

because j1shin_password is missing in the file. I don't want to add the password here as it should be loaded from the secrets.yaml mentioned on page [Storing secrets]https://www.home-assistant.io/docs/configuration/secrets/] of the official Homage Assistant.

If this even possible? I thought this would be a general feature of HA and this includes the add-ons, right?

So lonG

ViRuSTriNiTy avatar Dec 20 '22 17:12 ViRuSTriNiTy