use correct broker setting

This commit is contained in:
2025-11-08 15:56:03 +01:00
parent 6bf8ac3f99
commit 6271f46019
5 changed files with 9 additions and 13 deletions

View File

@@ -38,8 +38,8 @@ def load_config(config_path: Path) -> dict[str, Any]:
logger.warning(f"Config file not found: {config_path}, using defaults")
return {
"mqtt": {
"broker": "172.16.2.16",
"port": 1883,
"broker": os.getenv("MQTT_BROKER", "localhost"),
"port": int(os.getenv("MQTT_PORT", "1883")),
"client_id": "home-automation-abstraction",
"keepalive": 60
},
@@ -227,8 +227,8 @@ async def mqtt_worker(config: dict[str, Any], redis_client: aioredis.Redis) -> N
redis_client: Redis client for UI updates
"""
mqtt_config = config.get("mqtt", {})
broker = mqtt_config.get("broker", "172.16.2.16")
port = mqtt_config.get("port", 1883)
broker = os.getenv("MQTT_BROKER") or mqtt_config.get("broker", "localhost")
port = int(os.getenv("MQTT_PORT", mqtt_config.get("port", 1883)))
client_id = mqtt_config.get("client_id", "home-automation-abstraction")
# Append a short suffix (ENV override possible) so multiple processes don't collide
client_suffix = os.environ.get("MQTT_CLIENT_ID_SUFFIX") or uuid.uuid4().hex[:6]