Skip to content

Commit

Permalink
Merge pull request #78 from kpetremann/fix_mqtt_client_id
Browse files Browse the repository at this point in the history
fix: mqttv3 does not have properties
  • Loading branch information
kpetremann authored Mar 31, 2024
2 parents e8e6a59 + dad51e3 commit 81079ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mqtt_exporter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _create_msg_counter_metrics():
def subscribe(client, _, __, reason_code, properties):
"""Subscribe to mqtt events (callback)."""
user_data = {"client_id": settings.MQTT_CLIENT_ID}
if not settings.MQTT_CLIENT_ID:
if not settings.MQTT_CLIENT_ID and settings.MQTT_V5_PROTOCOL:
user_data["client_id"] = properties.AssignedClientIdentifier

client.user_data_set(user_data)
Expand Down

0 comments on commit 81079ef

Please sign in to comment.