From e7ff9624c10e1623a56c9a7b4f6fb32a6a3e4ae0 Mon Sep 17 00:00:00 2001 From: Caique Date: Sat, 4 Jan 2025 09:05:36 -0300 Subject: [PATCH] feat: add username and password parameters to mqtt client --- sensor_simulation/clients/mqtt_client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sensor_simulation/clients/mqtt_client.py b/sensor_simulation/clients/mqtt_client.py index 58e48b5..b79b2ef 100644 --- a/sensor_simulation/clients/mqtt_client.py +++ b/sensor_simulation/clients/mqtt_client.py @@ -13,6 +13,8 @@ class MqttClient: def __init__(self, broker_address: str, port: int = 1883, + username: str = None, + password: str = None, keepalive: int = 60, bind_address: str = "", bind_port: int = 0, @@ -28,6 +30,7 @@ def __init__(self, :param bind_port: Bind port """ self.client = mqtt.Client(client_id=client_id) + self.client.username_pw_set(username, password) self.broker_address = broker_address self.port = port self.keepalive = keepalive