|
@@ -26,11 +26,13 @@ devices (DEVICES)
|
26
|
26
|
|
27
|
27
|
"""
|
28
|
28
|
|
|
29
|
+# TODO: Usage of mqtt_base for all devices
|
|
30
|
+#
|
|
31
|
+# TODO: brennenstuhl_heatingvalve: always send "{"preset": "manual", "system_mode": "heat"}" with any information
|
29
|
32
|
# TODO: usage of base.mqtt as parent for class base
|
30
|
33
|
|
31
|
34
|
__DEPENDENCIES__ = []
|
32
|
35
|
|
33
|
|
-import copy
|
34
|
36
|
import json
|
35
|
37
|
import logging
|
36
|
38
|
|
|
@@ -108,8 +110,6 @@ class base(dict):
|
108
|
110
|
RX_IGNORE_TOPICS = []
|
109
|
111
|
RX_IGNORE_KEYS = []
|
110
|
112
|
RX_FILTER_DATA_KEYS = []
|
111
|
|
- #
|
112
|
|
- TX_BASE_DATA = None
|
113
|
113
|
|
114
|
114
|
def __init__(self, mqtt_client, topic):
|
115
|
115
|
# data storage
|
|
@@ -194,9 +194,7 @@ class base(dict):
|
194
|
194
|
else:
|
195
|
195
|
self.logger.debug("Sending data for %s - %s", key, str(data))
|
196
|
196
|
if self.TX_TYPE == self.TX_DICT:
|
197
|
|
- tx_data = copy.copy(self.TX_BASE_DATA or {})
|
198
|
|
- tx_data[key] = data
|
199
|
|
- self.mqtt_client.send('/'.join([self.topic, self.TX_TOPIC]), json.dumps(tx_data))
|
|
197
|
+ self.mqtt_client.send('/'.join([self.topic, self.TX_TOPIC]), json.dumps({key: data}))
|
200
|
198
|
else:
|
201
|
199
|
if type(data) not in [str, bytes]:
|
202
|
200
|
data = json.dumps(data)
|
|
@@ -858,7 +856,6 @@ class brennenstuhl_heatingvalve(base):
|
858
|
856
|
KEY_WINDOW_DETECTION = "window_detection"
|
859
|
857
|
#
|
860
|
858
|
TX_TYPE = base.TX_DICT
|
861
|
|
- TX_BASE_DATA = {KEY_PRESET: "manual", KEY_SYSTEM_MODE: "heat"}
|
862
|
859
|
#
|
863
|
860
|
RX_KEYS = [KEY_LINKQUALITY, KEY_BATTERY, KEY_HEATING_SETPOINT, KEY_TEMPERATURE]
|
864
|
861
|
RX_IGNORE_KEYS = [KEY_AWAY_MODE, KEY_CHILD_LOCK, KEY_PRESET, KEY_SYSTEM_MODE, KEY_VALVE_DETECTION, KEY_WINDOW_DETECTION]
|