thermostat working
This commit is contained in:
@@ -19,6 +19,7 @@ import logging
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from typing import Dict, Any
|
||||
|
||||
@@ -224,11 +225,16 @@ class DeviceSimulator:
|
||||
|
||||
async def run(self):
|
||||
"""Main simulator loop."""
|
||||
# Generate unique client ID to avoid collisions
|
||||
base_client_id = "device_simulator"
|
||||
client_suffix = os.environ.get("MQTT_CLIENT_ID_SUFFIX") or uuid.uuid4().hex[:6]
|
||||
unique_client_id = f"{base_client_id}-{client_suffix}"
|
||||
|
||||
try:
|
||||
async with Client(
|
||||
hostname=BROKER_HOST,
|
||||
port=BROKER_PORT,
|
||||
identifier="device_simulator"
|
||||
identifier=unique_client_id
|
||||
) as client:
|
||||
self.client = client
|
||||
logger.info(f"✅ Connected to MQTT broker {BROKER_HOST}:{BROKER_PORT}")
|
||||
|
||||
Reference in New Issue
Block a user