Zigbee2mqtt: Split out device config from configuration.yml

Created on 7 Nov 2018  Â·  11Comments  Â·  Source: Koenkk/zigbee2mqtt

Hi,
i try to setup zigee2mqtt with ansible but it is very hard to manage zigbee2mqtt with a config management system if you have a config file with static and dynamic values (like devices). So i would love to see an option to specify a separate file for device informations.

Maybe something like:

devices:
    file: /opt/zigbee2mqtt/data/devices.yml

Thanks for your great work
Edit: If you accept pull requests, i can give it a try and dig into it

stale

Most helpful comment

I like it! Will have a look on this at the next days

All 11 comments

Perhaps we can use something like !include devices.yaml (similar to home assistant: https://www.home-assistant.io/docs/configuration/splitting_configuration/).

Could you make a pr for that?

I like it! Will have a look on this at the next days

Is anyone looking at this? It would be very useful for our ansible-orchestrated zigbee2mqtt systems :)

I have done some first steps locally. But i can't find a good library for that the most of them are outdated.

The other way is to use a simple string compare/regex to detect !import but it feels a little bit hacky and dirty. @Koenkk what do you think?

That feels indeed hacky, could you find out how home assistant does this?

Don't know how home assistant does it but surely leveraging something like https://www.npmjs.com/package/yaml-include
or
https://www.npmjs.com/package/yaml-import would be the way to go about it.

https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/util/yaml.py

Looks like they've extended the yaml parser.

On Tue, 4 Dec 2018, 19:45 Koen Kanters <[email protected] wrote:

That feels indeed hacky, could you find out how home assistant does this?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Koenkk/zigbee2mqtt/issues/573#issuecomment-444232470,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA-DzADlBtyzeT0VAlSJF_rGmg5_J-zFks5u1tDtgaJpZM4YTij5
.

@clockbrain yes that are the libraries i am talking about. But both of them are outdated and i am not sure if one of them is a solid base to start with..

@Koenkk could we consider having a seperate devices.yaml by default?

That way configuration.yaml is limited to static configuration only. Then there would be a dynamic "device specific" devices.yaml. It would allow much easier automatic config generation in a hassio-addon as an example.

I think this would be easier to achieve as struggling around with an include setup. Because this would be a breaking change we can make it optional with an opt-in attribute in the config.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings