Skip to content

Duplicate mqtt-client-id's #206

@yodalived

Description

@yodalived

this->m_client->setClientId(QString("qt-openzwave-%1").arg(settings->value("Instance", 1).toInt()));

This line creates an mqtt client id of "qt-openzwave-0". If you have installations across multiple machines, their mqtt-client-id will be duplicated on the MQTT server. Since an MQTT server can only have unique client-id's, the older connection gets kicked off. In my instance, I have a two instances running in Docker connecting to the same MQTT server, both trying to connect with the same client id.

1616742757: New client connected from 192.168.105.219:45764 as qt-openzwave-0 (p2, c1, k60).
1616742765: New connection from 172.18.0.1:50662 on port 1883.
1616742765: Client closed its connection.
1616742765: New connection from 172.18.0.1:50666 on port 1883.
1616742765: Client qt-openzwave-0 already connected, closing old connection.

Can this be changed so that there is a short random number instead of 0 to allow multiple instances to connect to a single MQTT server?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions