changes
This commit is contained in:
@ -42,6 +42,11 @@ context['publish'] = PUBLISH_PREFIX
|
||||
# Load box configurations from JSON
|
||||
try:
|
||||
boxes = json.loads(BOXES_CONFIG)
|
||||
|
||||
# here, boxes store their internal state
|
||||
boxes['context'] = {}
|
||||
|
||||
# boxes structure added to global context to give process_message access to it
|
||||
context['boxes'] = boxes
|
||||
except json.JSONDecodeError as e:
|
||||
logger.error(f"Error parsing JSON configuration for boxes: {e}")
|
||||
@ -83,6 +88,9 @@ def on_connect(client, userdata, flags, rc):
|
||||
# Generate topics based on configured box-specific prefixes and box label
|
||||
topics = {}
|
||||
for topic_key, prefix in box_topic_prefixes.items():
|
||||
if topic_key == 'window':
|
||||
for window in boxes.windows:
|
||||
|
||||
topics[topic_key] = f"{prefix}{label}"
|
||||
config["subscribe"] = topics # Store the generated topics
|
||||
|
||||
|
Reference in New Issue
Block a user