fix
This commit is contained in:
@ -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"
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
Reference in New Issue
Block a user