Hassio-zigbee2mqtt: Addon config not working

Created on 17 May 2018  Â·  17Comments  Â·  Source: danielwelch/hassio-zigbee2mqtt

I was expecting the addon config JSON to be written as configuration.yaml in the data_path dir (where the app looks for it).

e.g.
{
"data_path": "/share/zigbee2mqtt",
"homeassistant": true,
"permit_join": true,
"mqtt_base_topic": "zigbee2mqtt",
"mqtt_server": "mqtt://192.168.1.10:1883",
"serial_port": "/dev/ttyACM0",
"mqtt_user": "sensors",
"mqtt_pass": "xxxxxxxx"
}

would be written out as:

# Home Assistant integration (MQTT discovery)
homeassistant: true

# allow new devices to join
permit_join: true

# MQTT settings
mqtt:
  # MQTT base topic for zigbee2mqtt MQTT messages
  base_topic: zigbee2mqtt
  # MQTT server URL
  server: 'mqtt://192.168.1.10:1883'
  # MQTT server authentication, uncomment if required:
  user: sensors
  password: xxxxxxxx

# Serial settings
serial:
  # Location of CC2531 USB sniffer
  port: /dev/ttyACM0

# Advanced configuration

...
...

Did I misinterpret what the config is used for? Or is this a WIP?

All 17 comments

You understood correctly, looks like there’s a problem. I’ll look into it.

Im not unhappy to have to edit the yaml. I think it will be a challenge to keep all the settings in the config.
I guess it depends to an extent on how we choose to manage renaming of devices - either via the yaml or by using HA customization config/GUI.

Glad to hear things are working smoothly with the workaround.

Our ultimate goal is to have as much as possible configurable through the UI. As of now, we don’t have a solution for handling friendly names other than by editing the yaml. I have a couple of ideas but I’m not in love with any of them, and suggestions are welcome.

Maybe related.
I noticed an "Unknown option: --" error on start:

Unknown option: --
usage: python3 [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

> [email protected] start /app
> node index.js

2018-5-17 21:08:12 INFO Starting zigbee-shepherd
2018-5-17 21:08:12 INFO zigbee-shepherd started
2018-5-17 21:08:12 INFO Connecting to MQTT server at mqtt://192.168.1.10:1883
2018-5-17 21:08:12 INFO zigbee-shepherd ready
...
...

Looks like this was due to an error in how I was using args in to python's argparse in bash. I pushed some fixes in https://github.com/danielwelch/hassio-zigbee2mqtt/commit/176ba86f6ded859b268285df0e475bd7b1ba309e

If you could test this out, I'd appreciate it. I'm traveling and unable to test this on my local instance, so it may uncover some other problems.

Doesnt seem to have fixed it.
I uninstalled the addon, removed your repo, and removed your docker image so pretty sure it wasn't cached. Then reinstalled from scratch.

There's an error in my distribution script, so the docker image hasn't updated yet. whoops.

The latest image has now been pushed to docker hub so you should be able to get it.

This is the problem with being "pre-version," so to speak. We've kept the version as test until we get a more reliable working add-on. The version shows up as 'test' no matter what in your frontend. In the future, you can check the hub page to see when the last image was pushed, and all the builds on travis.

I think we're getting close to being ready for versioned releases.

I cloned your repo locally and tried removing your image from the config.json for local build, but the addon wouldn’t start.
Didn’t have time to try and debug why.

Just checked with latest updates and still getting errors.
This is with the default config:

Traceback (most recent call last):
  File "/data/options.json", line 3, in <module>
    "homeassistant": true,
NameError: name 'true' is not defined
/app/run.sh: line 11: null: command not found
/app/run.sh: line 15: null: command not found

> [email protected] start /app
> node index.js

2018-5-21 22:31:44 INFO Starting zigbee-shepherd
2018-5-21 22:31:45 INFO zigbee-shepherd started
...
...
...

@james-fry Sorry for the delay. Was finally able to test locally and iterate, and this should be fixed after latest commit. Try it out and let me know

Will test later. Btw how can I build locally?
I tried just taking the addon dir from repo but npm won’t start. The addon builds ok but I get a tini error can’t exec /app/run.sh.
Any ideas?

Just copy the zigbee2mqtt directory into your /addon directory. Only change necessary is to remove the “image” line from config.json to ensure a local build vs. pulling from docker

That's what I did exactly.
But I get the following error:

[FATAL tini (5)] exec /app/run.sh failed: No such file or directory

I just recloned your repo to check I have latest config.json, dockerfile, run.sh and set_config.py

Tested your changes and its working great:

Upgrade:

[Info] Configuration file found. Will overwrite configurable               fields with values from add-on configuration
[Info] Configuration written to /share/zigbee2mqtt/configuration.yaml

> [email protected] start /app
> node index.js

2018-5-22 21:29:49 INFO Starting zigbee-shepherd
...

Fresh install with no existing config:

[Info] Configuration written to /share/zigbee2mqtt/configuration.yaml

> [email protected] start /app
> node index.js

2018-5-22 21:32:55 INFO Migrating configuration.yaml to version 1...
2018-5-22 21:32:55 INFO Starting zigbee-shepherd
2018-5-22 21:32:56 INFO zigbee-shepherd started
...

The yaml is unlike the original though - now uses {} for lists and all comments were removed.
I guess that is the price to pay for parsing and rewriting the yaml.

BTW If you prefer I can open another issue for local install and close this one?
I think local install is important for people who need to be able to test new zigbee devices.
(i.e. in the dockerfile clone their fork of zigbee2mqtt with added device support)

Sounds good.
On May 22, 2018 at 4:37:04 PM, james-fry ([email protected]) wrote:

BTW If you prefer I can open another issue for local install and close
this one?
I think local install is important for people who need to be able to test
new zigbee devices.
(i.e. in the dockerfile clone their fork of zigbee2mqtt with added device
support)

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/danielwelch/hassio-zigbee2mqtt/issues/9#issuecomment-391132208,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHvnbTqK6Fan6zeYqbglG3lrr7sEov81ks5t1HbwgaJpZM4UCKIt
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

0xygen8 picture 0xygen8  Â·  6Comments

SPEC1AL1ST picture SPEC1AL1ST  Â·  12Comments

mclaudiopt picture mclaudiopt  Â·  8Comments

Johnnyyr picture Johnnyyr  Â·  9Comments

eric-zimmer picture eric-zimmer  Â·  6Comments