From da79f876cd2a7d2354ef14b42bb26bb037ba875a Mon Sep 17 00:00:00 2001 From: sunjie Date: Tue, 22 Jul 2025 19:45:46 +0800 Subject: [PATCH] =?UTF-8?q?1.=20mqtt=20=E5=8D=95=E7=8B=AC=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E6=9B=B4=E6=96=B0=E5=88=B0gzth=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mqtt/config.sample.ini | 7 +++---- mqtt/main.py | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mqtt/config.sample.ini b/mqtt/config.sample.ini index 9612d748b..b28cb0a6a 100644 --- a/mqtt/config.sample.ini +++ b/mqtt/config.sample.ini @@ -9,13 +9,12 @@ password = gzsthtz@126.com [mqtt] # MQTT Broker connection details -host = 1.12.37.24 +host = 43.143.225.150 port = 1883 +username = odoo +password = odoo123 client_id = OdooMqttConnector -# A comma-separated list of topics to subscribe to for replies. -# You can list multiple topics here. -reply_topics = [app] # How often to poll Odoo for new messages, in seconds. diff --git a/mqtt/main.py b/mqtt/main.py index a90643b47..ffab82a06 100644 --- a/mqtt/main.py +++ b/mqtt/main.py @@ -50,7 +50,9 @@ async def main(): # 2. Connect to MQTT and run tasks async with aiomqtt.Client( hostname=mqtt_cfg['host'], - port=int(mqtt_cfg['port']) + port=int(mqtt_cfg['port']), + username=mqtt_cfg['username'], + password=mqtt_cfg['password'] ) as client: logger.info(f"Connected to MQTT broker at {mqtt_cfg['host']}:{mqtt_cfg['port']}")