Open sofakng opened 2 years ago
Not currently, unfortunately. I agree: it's a pain particularly when using the configuration GUI.
Unfortunately, Homebridge accessories must either be of the 'platform' type where one configuration is used for all accessories, or as individually-configured accessories (as mqttthing is). I had hoped that it might be possible to use a 'platform' Config block for shared/default settings and then individually-configured accessories for the accessory-specific settings, but my understanding is that this isn't allowed.
Given time I'd like to move mqttthing to the former (and probably rewrite it in TypeScript), probably as an incompatible 'version 2'. Hopefully one day...
What about using environment variables to allow these to be set? For example, this plugin: https://github.com/joe-ng/homebridge-dyson-link/blob/b7deeb46a6d00e60590e3e830dcd5716f206d6bd/index.js#L47-L48
Alternatively, I believe you can share configuration at the platform level — at least this CBUS plugin does this:
Yes, cbus does it how I'd do it now (!) - it uses a platform-level config with an array of accessories. If I ever get time to do an MQTT-Thing 2.0 I'll go with that design, but it would be incompatible with existing configurations.
Good idea re. environment variables as an alternative. I'll have a look at that.
I could raise PR for the env-var thing if you'd like?
Thanks, go for it!
https://github.com/arachnetech/homebridge-mqttthing/pull/505 Let me know if there's anything else you'd like me to do on that PR.
Is it possible to only specify the MQTT server/username/password once?
For example, I have many accessories (zwavejs2mqtt) that I'd like to use with mqttthing but it seems redundant to specify the server/username/password repeatedly. I'm also worried that each accessory makes a separate connection to the MQTT server?