Browse Source

send setting always for heating valve device

videv_dev
Dirk Alders 1 year ago
parent
commit
54d72802c2
1 changed files with 7 additions and 4 deletions
  1. 7
    4
      devices/__init__.py

+ 7
- 4
devices/__init__.py View File

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
32
 # TODO: usage of base.mqtt as parent for class base
29
 # TODO: usage of base.mqtt as parent for class base
33
 
30
 
34
 __DEPENDENCIES__ = []
31
 __DEPENDENCIES__ = []
35
 
32
 
33
+import copy
36
 import json
34
 import json
37
 import logging
35
 import logging
38
 
36
 
110
     RX_IGNORE_TOPICS = []
108
     RX_IGNORE_TOPICS = []
111
     RX_IGNORE_KEYS = []
109
     RX_IGNORE_KEYS = []
112
     RX_FILTER_DATA_KEYS = []
110
     RX_FILTER_DATA_KEYS = []
111
+    #
112
+    TX_BASE_DATA = None
113
 
113
 
114
     def __init__(self, mqtt_client, topic):
114
     def __init__(self, mqtt_client, topic):
115
         # data storage
115
         # data storage
194
             else:
194
             else:
195
                 self.logger.debug("Sending data for %s - %s", key, str(data))
195
                 self.logger.debug("Sending data for %s - %s", key, str(data))
196
                 if self.TX_TYPE == self.TX_DICT:
196
                 if self.TX_TYPE == self.TX_DICT:
197
-                    self.mqtt_client.send('/'.join([self.topic, self.TX_TOPIC]), json.dumps({key: data}))
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))
198
                 else:
200
                 else:
199
                     if type(data) not in [str, bytes]:
201
                     if type(data) not in [str, bytes]:
200
                         data = json.dumps(data)
202
                         data = json.dumps(data)
856
     KEY_WINDOW_DETECTION = "window_detection"
858
     KEY_WINDOW_DETECTION = "window_detection"
857
     #
859
     #
858
     TX_TYPE = base.TX_DICT
860
     TX_TYPE = base.TX_DICT
861
+    TX_BASE_DATA = {KEY_PRESET: "manual", KEY_SYSTEM_MODE: "heat"}
859
     #
862
     #
860
     RX_KEYS = [KEY_LINKQUALITY, KEY_BATTERY, KEY_HEATING_SETPOINT, KEY_TEMPERATURE]
863
     RX_KEYS = [KEY_LINKQUALITY, KEY_BATTERY, KEY_HEATING_SETPOINT, KEY_TEMPERATURE]
861
     RX_IGNORE_KEYS = [KEY_AWAY_MODE, KEY_CHILD_LOCK, KEY_PRESET, KEY_SYSTEM_MODE, KEY_VALVE_DETECTION, KEY_WINDOW_DETECTION]
864
     RX_IGNORE_KEYS = [KEY_AWAY_MODE, KEY_CHILD_LOCK, KEY_PRESET, KEY_SYSTEM_MODE, KEY_VALVE_DETECTION, KEY_WINDOW_DETECTION]

Loading…
Cancel
Save