arachnetech / homebridge-mqttthing

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

"mqtt-thing stopped" #610

Open jbuttnz opened 1 year ago

jbuttnz commented 1 year ago

Can anyone identify what's going on here?

Screenshot
arachnetech commented 1 year ago

That's the default 'last will and testament' message (see https://www.hivemq.com/blog/mqtt-essentials-part-9-last-will-and-testament/) that MQTT-thing uses if you don't configure one explicitly.

The 'will' message is sent automatically by the MQTT broker when mqtt-thing disconnects (e.g. when Homebridge is stopped).

In reality, MQTT-Thing's default probably isn't the best choice - every configured accessory will publish a message to the same WillMsg topic.

Here's the complete set of default MQTT settings, for reference:

        // standard options set by mqtt-thing
        var myOptions = {
            keepalive: 10,
            clientId: clientId,
            protocolId: 'MQTT',
            protocolVersion: 4,
            clean: true,
            reconnectPeriod: 1000,
            connectTimeout: 30 * 1000,
            will: {
                topic: 'WillMsg',
                payload: 'mqtt-thing [' + ctx.config.name + '] has stopped',
                qos: 0,
                retain: false
            },
            username: config.username || process.env.MQTTTHING_USERNAME,
            password: config.password || process.env.MQTTTHING_PASSWORD,
            rejectUnauthorized: false
        };