diff --git a/src/message_processor.py b/src/message_processor.py index 1662f62..3493c89 100644 --- a/src/message_processor.py +++ b/src/message_processor.py @@ -142,7 +142,13 @@ def process_high_temp(box_name, context, local_context, payload): return True def process_window(box_name, context, local_context, sub_key, payload): - local_context['window_state'][sub_key] = CONVERTERS["window_contact_input"][box["windows"][sub_key]["converter"]](payload) + // default converter + converter = lambda x:x + for sk in box["windows"]: + if sk["label"] == sub_key: + converter = CONVERTERS["window_contact_input"][sk["converter"]] + break + local_context['window_state'][sub_key] = converter(payload) _calculate_output_temperature(local_context) return True