From dbdd24822eedbfe8532df0004463f016a6b41275 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Thu, 7 Nov 2024 22:15:20 +0100 Subject: [PATCH] fix --- deployment/configmap.yml | 2 +- src/main.py | 8 ++++---- src/message_processor.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/deployment/configmap.yml b/deployment/configmap.yml index a1f8e28..c7b98f4 100644 --- a/deployment/configmap.yml +++ b/deployment/configmap.yml @@ -20,7 +20,7 @@ data: "status": "heating/system/status" } MQTT_STATUS_TOPIC: "heating/status" - MQTT_STATUSTEXT_TOPIC_PREFIX: "heating/statustext/" + MQTT_CONTEXT_TOPIC_PREFIX: "heating/context/" OFF_TEMPERATURE: "5.0" LOW_TEMPERATURE: "15.0" DEFAULT_HIGH_TEMPERATURE: "21.0" diff --git a/src/main.py b/src/main.py index 640ada3..08463b0 100644 --- a/src/main.py +++ b/src/main.py @@ -19,7 +19,7 @@ LOW_TEMPERATURE = os.getenv("LOW_TEMPERATURE", "15.0") DEFAULT_HIGH_TEMPERATURE = os.getenv("DEFAULT_HIGH_TEMPERATURE", "21.0") MAINTENANCE_TEMPERATURE = os.getenv("MAINTENANCE_TEMPERATURE", "30.0") STATUS_TOPIC = os.getenv("MQTT_STATUS_TOPIC") -STATUSTEXT_TOPIC_PREFIX = os.getenv("MQTT_STATUSTEXT_TOPIC_PREFIX") +CONTEXT_TOPIC_PREFIX = os.getenv("MQTT_CONTEXT_TOPIC_PREFIX") # Check if required environment variables are set missing_vars = [] @@ -33,8 +33,8 @@ if not CENTRAL_TOPICS_CONFIG: missing_vars.append('MQTT_CENTRAL_TOPICS') if not STATUS_TOPIC: missing_vars.append('MQTT_STATUS_TOPIC') -if not STATUSTEXT_TOPIC_PREFIX: - missing_vars.append('MQTT_STATUSTEXT_TOPIC_PREFIX') +if not CONTEXT_TOPIC_PREFIX: + missing_vars.append('MQTT_CONTEXT_TOPIC_PREFIX') if missing_vars: logger.error(f"Error: The following environment variables are not set: {', '.join(missing_vars)}") @@ -49,7 +49,7 @@ context['low_temperature'] = LOW_TEMPERATURE context['default_high_temperature'] = DEFAULT_HIGH_TEMPERATURE context['maintenance_temperature'] = MAINTENANCE_TEMPERATURE context['status_topic'] = STATUS_TOPIC -context['statustext_topic_prefix'] = STATUSTEXT_TOPIC_PREFIX +context['context_topic_prefix'] = CONTEXT_TOPIC_PREFIX # Load box configurations from JSON try: diff --git a/src/message_processor.py b/src/message_processor.py index c35c8ba..3fe69d6 100644 --- a/src/message_processor.py +++ b/src/message_processor.py @@ -64,8 +64,8 @@ def process_message(box_name, topic_key, payload, context): context['client'].publish(publish_topic, result_message) logger.info(f"[{box_name}] Result published on '{publish_topic}': {status} {result_message}") - statustext_topic = f"{context['statustext_topic_prefix']}{box['label']}" - context['client'].publish(statustext_topic, json.dumps(local_context)) + context_topic = f"{context['context_topic_prefix']}{box['label']}" + context['client'].publish(context_topic, json.dumps(local_context)) logger.info(f"[{box_name}] Local context after: {local_context}") except Exception as e: