add prepare_context
This commit is contained in:
@ -5,7 +5,7 @@ import uuid
|
||||
import signal
|
||||
from loguru import logger
|
||||
import paho.mqtt.client as mqtt
|
||||
from message_processor import process_message # Import the moved function
|
||||
from message_processor import process_message, prepare_context
|
||||
|
||||
|
||||
# MQTT configuration parameters
|
||||
@ -49,8 +49,8 @@ try:
|
||||
context['boxes'] = boxes
|
||||
|
||||
# add context dict to each box in the list
|
||||
for _, config in boxes.items():
|
||||
config['context'] = {}
|
||||
for box_name, config in boxes.items():
|
||||
config['context'] = prepare_context(box_name, context)
|
||||
except json.JSONDecodeError as e:
|
||||
logger.error(f"Error parsing JSON configuration for boxes: {e}")
|
||||
sys.exit(1)
|
||||
|
Reference in New Issue
Block a user