cflurin / homebridge-mqtt

Homebridge-mqtt is a Plugin for Homebridge.
Apache License 2.0
229 stars 39 forks source link

make client id configurable #106

Closed emes closed 3 years ago

emes commented 3 years ago

Allow the mqtt client id to be configurable. This is helpful when running multiple instances of homebridge-mqtt.

cflurin commented 3 years ago

Hi @emes You already get different cliendIds at start. What is the purpose for making them configurable?

emes commented 3 years ago

The current client ids are random. That's fine when you're running one instance of homebridge-mqtt. I run six instances, so if debugging at the mqtt broker, I need to figure out which instance got which random string.

emes commented 3 years ago

Configurable client-ids are pretty common. If you're really averse to adding an additional configuration option. Then I could revise with just something like this in model.js:

options.clientId = this.config.topic_prefix || 'homebridge-mqtt_' + Math.random().toString(16).substr(2, 8);

It's a little less flexible, but would allow for easily identifiable ids for those not running a default single instance and nothing added to configuration.

cflurin commented 3 years ago

If you're really averse to adding an additional configuration option.

No, I just wondered how people use homebridge-mqtt