arachnetech / homebridge-mqttthing

A plugin for Homebridge allowing the integration of many different accessory types using MQTT.
Apache License 2.0
467 stars 104 forks source link

Readme/Wiki: Best practices for topic naming? #50

Closed Christopher-A closed 4 years ago

Christopher-A commented 5 years ago

Big fan of this homebridge plugin. Other MQTT related plugins were a hard to wrap ones head around, but this couldn't be easier. More of a question as opposed to an issue, but what are the best practices for naming topics for multiple accessories of the same type?

For example, given the following configuration, how should I modify it if I have 2 or 3 accessories that do the same thing?

{ "accessory": "mqttthing", "type": "switch", "name": "fireplace", "topics": { "getOn": "fireplace/getOn", "setOn":"fireplace/setOn", }, "integerValue": true }

Should I just name them "fireplace1", "fireplace2", etc. and have topics "fireplace1/getOn", "fireplace2/getOn", etc? I guess that would mean I need to hardcode the "fireplace1" topic component into my accessory, which seems less than ideal...

arachnetech commented 5 years ago

One alternative to hard-coding is to use the ESP's chip ID: https://support.thingpulse.com/628/unique-id-per-device

arachnetech commented 4 years ago

Closing as inactive