snowdd1 / homebridge-knx

KNX platform shim for homebridge
https://github.com/nfarina/homebridge
GNU General Public License v2.0
97 stars 56 forks source link

External Source for Add-Ins #160

Closed Luehrsen closed 4 years ago

Luehrsen commented 4 years ago

https://github.com/snowdd1/homebridge-knx/blob/2d5fdb7226c4894ff4e6f9f3ef5fbdeb99e8eb7d/lib/customServiceAPI.js#L21

The current implementation requires add-ins to be present in the npm package and therefore in this repository. This is not perfect, as this limits the customizability tremendously. (Or you're forced to run homebridge in debug & plugin-dev mode, as I'm doing at the moment.)

So I would like to propose a small addition to the add-ins api:

1) add a new config option in knx_config named AddinsPath to define an absolute path to addins. (default /var/lib/homebridge/knx_addins/) 2) Check if a Handler-file exists in /lib/addins/, if not, check the AddinsPath for the file. (With something like fs.existsSync(path) 3) Load the handler like normal

Would you consider such a feature as sensible? I could start working on a PR. (should only be a few lines of code)

snowdd1 commented 4 years ago

Sure, great idea. I am also happy if people share their add ins by creating PRs here. So also the „handlers“ get spread widely.