thkl / homebridge-homematic

Homematic plugin for homebridge: https://github.com/nfarina/homebridge
180 stars 49 forks source link

Merge separate config file to main config.json #557

Closed mkellsy closed 4 years ago

mkellsy commented 4 years ago

Is your feature request related to a problem? Please describe. Having a separate config file for your plugin is hampering efforts of other plugins to easily manage their configs. For example homebridge-config-ui-x and HOOBS have a configuration editor based on the config.json file. The file is a well known file and easy to consume, and pipe the changes through an API. Your plugin uses a different file. If other plugins start to do this, it is nearly impossible to determine what file does what. It's best to define all the fields your plugin uses in the config.schema.json file.

Describe the solution you'd like I would like to see these config directives merged back into the config.json file for easy management. Or have an option to use either or.

Describe alternatives you've considered I looked into scanning the storage path for .json files, but this is problematic because there is not definitive correlation between the file and the plugin.

thkl commented 4 years ago

since homebridge-config-ui-x is currently deleting config items which are not covered by the config.schema.json i had to split the configuration into two files. Adding all configurations to the config.schema.json (even as a dynamic schema) is not possible during the fact that there are many optionals or settings only available for selected services.

the homematic plugin will merge configurations together at launch so u are able to put all in your config.json and put only a {} into the homematic-config.json. Do not remove the file cause it will be recreated if not found at launch.

mkellsy commented 4 years ago

HOOBS only delete null or empty items so this solution should work for us.

thkl commented 4 years ago

I do not know hoobs but homebridge-config-ui-x deletes items which are not in the schema. ( https://github.com/oznu/homebridge-config-ui-x/issues/537 )

And due to the fact the settings in this plugin can get very complex depending on the service u choose for a homematic actor this plugin will get its own web config later.

The settings in the config.json are necessary for initial configuration. The plugin will run with settings made there.

mkellsy commented 4 years ago

With HOOBS you can add an "Object" property in the schema and we will show a JSON field inline with the other fields. I think UI-X will do this too.

thkl commented 4 years ago

yes i get it. But the plugin will later use its own configuration utility for special settings like the mapping of homematic vs homekit devices and configuration like this :

image