Homebridge-config-ui-x: Feature request: support for "plugins" key in config.json

Created on 6 May 2019  路  8Comments  路  Source: oznu/homebridge-config-ui-x

Please add a button to the _Plugins_ screen for each plugin (next to the _UNINSTALL_) to support for enabling/disabling the loading of installed plugins. This would manage the "plugins" key in config.json.

enhancement pinned

Most helpful comment

+1 for this, with many instances and many different plugins it can become very tedious to find the right plugin/instance, especially when using the config-ui-x panels.

But I guess with config-x being a separate server now it would make more sense to support multiple Homebridge instances right from one config-ui-x instance..

All 8 comments

That would be nice 馃憤

This would manage the "plugins" key in config.json.

Not really to the topic, but even after extensive use of google, what is that plugin key? Can鈥檛 find any info on syntax and where it belongs.

It belongs at the top-level object:

{
  "bridge": {
    ...
  },
  "plugins": [
    "homebridge-config-ui-x",
    "homebridge-hue"
  ],
  "platforms": [
    {
      "platform": "config",
      ...
    },
    {
      "platform": "Hue",
      ...
    }
  ]
}

When present, it whitelists the plugins to load at the very start of homebridge (before parsing the platforms and accessories arrays). This is particularly useful when running multiple instances of homebridge on the same server, with a single install directory (typically /usr/lib/node_modules) for all plugins. You only want each instance to load "their" plugins, and ignore the plugins for the other instances.

Look at the log to understand homebridge's startup sequence:

  • Homebridge first reads config.json:
    [5/24/2019, 2:58:01 PM] Loaded config.json with 0 accessories and 2 platforms.
  • Then, it loads the plugins (allowing them to register themselves):
    [5/24/2019, 2:58:01 PM] --- [5/24/2019, 2:58:01 PM] Loaded plugin: homebridge-config-ui-x [5/24/2019, 2:58:01 PM] Registering platform 'homebridge-config-ui-x.config' [5/24/2019, 2:58:01 PM] --- [5/24/2019, 2:58:01 PM] Loaded plugin: homebridge-hue [5/24/2019, 2:58:01 PM] Registering platform 'homebridge-hue.Hue'
  • Then, it initialises the platform plugins mentioned in platforms (and the accessory plugins mentioned in accessories):
    [5/24/2019, 2:58:01 PM] --- [5/24/2019, 2:58:01 PM] Loading 2 platforms... [5/24/2019, 2:58:01 PM] [Config] Initializing config platform... [5/24/2019, 2:58:01 PM] [Hue] Initializing Hue platform...

Without the plugins key in config.json, homebridge loads all installed plugins, and even initialises loaded platform plugins not mentioned in platforms that use the dynamic accessory model:

[5/25/2019, 12:45:41 PM] Loaded config.json with 0 accessories and 2 platforms.
[5/25/2019, 12:45:41 PM] ---
[5/25/2019, 12:45:41 PM] Loaded plugin: homebridge-config-ui-x
[5/25/2019, 12:45:41 PM] Registering platform 'homebridge-config-ui-x.config'
[5/25/2019, 12:45:41 PM] ---
[5/25/2019, 12:45:42 PM] Loaded plugin: homebridge-hue
[5/25/2019, 12:45:42 PM] Registering platform 'homebridge-hue.Hue'
[5/25/2019, 12:45:42 PM] ---
[5/25/2019, 12:45:42 PM] Loaded plugin: homebridge-music
[5/25/2019, 12:45:42 PM] Registering platform 'homebridge-music.Music'
[5/25/2019, 12:45:42 PM] ---
[5/25/2019, 12:45:42 PM] Loaded plugin: homebridge-otgw
[5/25/2019, 12:45:42 PM] Registering platform 'homebridge-otgw.OTGW'
[5/25/2019, 12:45:42 PM] ---
[5/25/2019, 12:45:43 PM] Loaded plugin: homebridge-p1
[5/25/2019, 12:45:43 PM] Registering platform 'homebridge-p1.P1'
[5/25/2019, 12:45:43 PM] ---
[5/25/2019, 12:45:43 PM] Loaded plugin: homebridge-ws
[5/25/2019, 12:45:43 PM] Registering platform 'homebridge-ws.WS'
[5/25/2019, 12:45:43 PM] ---
[5/25/2019, 12:45:43 PM] Loaded plugin: homebridge-zp
[5/25/2019, 12:45:43 PM] Registering platform 'homebridge-zp.ZP'
[5/25/2019, 12:45:43 PM] ---
[5/25/2019, 12:45:43 PM] Loading 2 platforms...
[5/25/2019, 12:45:43 PM] [Config] Initializing config platform...
[5/25/2019, 12:45:43 PM] [Hue] Initializing Hue platform...
Load homebridge-otgw.OTGW
Load homebridge-ws.WS

Thank you very much for that excellent explanation. I am actually running about ten homebridge instances and always thought how stupid it is that each one is loading all plugins. I had a look on the homebridge github page but couldn鈥檛 find anything about it. Going to implement this today. Thanks again.

+1 for this, with many instances and many different plugins it can become very tedious to find the right plugin/instance, especially when using the config-ui-x panels.

But I guess with config-x being a separate server now it would make more sense to support multiple Homebridge instances right from one config-ui-x instance..

+1 for this.

The solution to this feature request will land in the next release. While not exactly what was asked for, it achieves the same goal.

It will require Homebridge 1.3.0-beta.47 or later to support the new disabledPlugins array (https://github.com/homebridge/homebridge/pull/2775).

As part of these changes users will be able to toggle enable/disable a plugin, their config will be able to remain in the config.json and not stop Homebridge from loading.

image
image

Thanks, @oznu.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Finch106 picture Finch106  路  3Comments

DJay-X picture DJay-X  路  6Comments

afharo picture afharo  路  5Comments

MBarti picture MBarti  路  4Comments

mafyata picture mafyata  路  3Comments