Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python examples incorrectly set MQTT client ID to broker URL #312

Open
tgrusendorf opened this issue Aug 17, 2023 · 0 comments
Open

Python examples incorrectly set MQTT client ID to broker URL #312

tgrusendorf opened this issue Aug 17, 2023 · 0 comments

Comments

@tgrusendorf
Copy link
Contributor

In the Python examples, the MQTT client ID is incorrectly set to the broker URL instead of letting it generate a random client ID. It looks like the parameters for the connect function were mistakenly copied to the constructor.

This prevents multiple Python clients from connecting to the same broker because they all use the same client ID.

client = mqtt.Client(serverUrl, 1883, 60)
client.on_connect = on_connect
client.on_message = on_message
client.username_pw_set(myUsername, myPassword)
deathByteArray = bytearray(deathPayload.SerializeToString())
client.will_set("spBv1.0/" + myGroupId + "/NDEATH/" + myNodeName, deathByteArray, 0, False)
client.connect(serverUrl, 1883, 60)

The first line should be changed to:

client = mqtt.Client()

Reference:
https://pypi.org/project/paho-mqtt/#client

tgrusendorf added a commit to tgrusendorf/tahu that referenced this issue Aug 17, 2023
tgrusendorf added a commit to tgrusendorf/tahu that referenced this issue Aug 17, 2023
tgrusendorf added a commit to tgrusendorf/tahu that referenced this issue Aug 17, 2023
tgrusendorf added a commit to tgrusendorf/tahu that referenced this issue Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant