|
@@ -60,7 +60,6 @@ class base(dict):
|
60
|
60
|
TX_TYPE = -1
|
61
|
61
|
TX_FILTER_DATA_KEYS = []
|
62
|
62
|
#
|
63
|
|
- RX_LOG_INFO_ALWAYS_KEYS = []
|
64
|
63
|
RX_KEYS = []
|
65
|
64
|
RX_IGNORE_TOPICS = []
|
66
|
65
|
RX_IGNORE_KEYS = []
|
|
@@ -96,8 +95,10 @@ class base(dict):
|
96
|
95
|
self[key] = data
|
97
|
96
|
# Filter, if needed
|
98
|
97
|
self.unpack_filter(key)
|
99
|
|
- logger.log(logging.INFO if key in self.RX_LOG_INFO_ALWAYS_KEYS or prev_value != self.get(key) else logging.DEBUG,
|
100
|
|
- "Received data for (%s) %s - %s", self.topic, key, str(self.get(key)))
|
|
98
|
+ if prev_value != self.get(key):
|
|
99
|
+ logger.info("Received new data for (%s) %s - %s", self.topic, key, str(self.get(key)))
|
|
100
|
+ else:
|
|
101
|
+ logger.debug("Received data for (%s) %s - %s", self.topic, key, str(self.get(key)))
|
101
|
102
|
self.callback_caller(key, self[key])
|
102
|
103
|
elif key not in self.RX_IGNORE_KEYS:
|
103
|
104
|
logger.warning('Got a message from \"%s\" with unparsed content "%s"', self.topic, key)
|
|
@@ -143,6 +144,7 @@ class base(dict):
|
143
|
144
|
logger.error(
|
144
|
145
|
"Unknown tx type. Set TX_TYPE of class to a known value")
|
145
|
146
|
else:
|
|
147
|
+ logger.info("Sending data for (%s) %s - %s", self.topic, key, str(data))
|
146
|
148
|
if self.TX_TYPE == self.TX_DICT:
|
147
|
149
|
self.mqtt_client.send('/'.join([self.topic, self.TX_TOPIC]), json.dumps({key: data}))
|
148
|
150
|
else:
|
|
@@ -452,7 +454,6 @@ class tradfri_button(base):
|
452
|
454
|
KEY_BATTERY = "battery"
|
453
|
455
|
KEY_ACTION = "action"
|
454
|
456
|
#
|
455
|
|
- RX_LOG_INFO_ALWAYS_KEYS = [KEY_ACTION]
|
456
|
457
|
RX_KEYS = [KEY_LINKQUALITY, KEY_BATTERY, KEY_ACTION]
|
457
|
458
|
RX_IGNORE_TOPICS = []
|
458
|
459
|
RX_IGNORE_KEYS = ['update']
|
|
@@ -485,13 +486,14 @@ class nodered_gui(base):
|
485
|
486
|
KEY_STATE = "state"
|
486
|
487
|
KEY_BRIGHTNESS = "brightness"
|
487
|
488
|
KEY_COLOR_TEMP = "color_temp"
|
|
489
|
+ KEY_HEATING_BOOST = "heating_boost"
|
|
490
|
+ KEY_HEATING_SETPOINT = "heating_setpoint"
|
488
|
491
|
#
|
489
|
492
|
TX_TOPIC = 'set'
|
490
|
493
|
TX_TYPE = base.TX_VALUE
|
491
|
494
|
TX_FILTER_DATA_KEYS = []
|
492
|
495
|
#
|
493
|
|
- RX_LOG_INFO_ALWAYS_KEYS = []
|
494
|
|
- RX_KEYS = [KEY_STATE, KEY_BRIGHTNESS, KEY_COLOR_TEMP]
|
|
496
|
+ RX_KEYS = [KEY_STATE, KEY_BRIGHTNESS, KEY_COLOR_TEMP, KEY_HEATING_BOOST, KEY_HEATING_SETPOINT]
|
495
|
497
|
RX_IGNORE_TOPICS = [KEY_FEEDBACK + '/' + TX_TOPIC, KEY_ENABLE + '/' + TX_TOPIC]
|
496
|
498
|
RX_FILTER_DATA_KEYS = []
|
497
|
499
|
|
|
@@ -516,6 +518,16 @@ class nodered_gui(base):
|
516
|
518
|
"""rv: [0, ..., 100]"""
|
517
|
519
|
return self.get(self.KEY_COLOR_TEMP)
|
518
|
520
|
|
|
521
|
+ @property
|
|
522
|
+ def heating_boost(self):
|
|
523
|
+ """rv: [True, False]"""
|
|
524
|
+ return self.get(self.KEY_HEATING_BOOST)
|
|
525
|
+
|
|
526
|
+ @property
|
|
527
|
+ def heating_(self):
|
|
528
|
+ """rv: [5, ..., 30]"""
|
|
529
|
+ return self.get(self.KEY_HEATING_SETPOINT)
|
|
530
|
+
|
519
|
531
|
#
|
520
|
532
|
# TX
|
521
|
533
|
#
|
|
@@ -525,3 +537,61 @@ class nodered_gui(base):
|
525
|
537
|
def enable(self, data):
|
526
|
538
|
"""data: [True, False]"""
|
527
|
539
|
self.pack(self.KEY_ENABLE, data)
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+class brennenstuhl_heatingvalve(base):
|
|
543
|
+ KEY_LINKQUALITY = "linkquality"
|
|
544
|
+ KEY_BATTERY = "battery"
|
|
545
|
+ KEY_HEATING_SETPOINT = "current_heating_setpoint"
|
|
546
|
+ KEY_TEMPERATURE = "local_temperature"
|
|
547
|
+ #
|
|
548
|
+ KEY_AWAY_MODE = "away_mode"
|
|
549
|
+ KEY_CHILD_LOCK = "child_lock"
|
|
550
|
+ KEY_PRESET = "preset"
|
|
551
|
+ KEY_SYSTEM_MODE = "system_mode"
|
|
552
|
+ KEY_VALVE_DETECTION = "valve_detection"
|
|
553
|
+ KEY_WINDOW_DETECTION = "window_detection"
|
|
554
|
+ #
|
|
555
|
+ TX_TOPIC = 'set'
|
|
556
|
+ TX_VALUE = 0
|
|
557
|
+ TX_DICT = 1
|
|
558
|
+ TX_TYPE = base.TX_DICT
|
|
559
|
+ TX_FILTER_DATA_KEYS = []
|
|
560
|
+ #
|
|
561
|
+ RX_KEYS = [KEY_LINKQUALITY, KEY_BATTERY, KEY_HEATING_SETPOINT, KEY_TEMPERATURE]
|
|
562
|
+ RX_IGNORE_TOPICS = [TX_TOPIC]
|
|
563
|
+ RX_IGNORE_KEYS = [KEY_AWAY_MODE, KEY_CHILD_LOCK, KEY_PRESET,
|
|
564
|
+ KEY_SYSTEM_MODE, KEY_VALVE_DETECTION, KEY_WINDOW_DETECTION]
|
|
565
|
+ RX_FILTER_DATA_KEYS = []
|
|
566
|
+
|
|
567
|
+ def __init__(self, mqtt_client, topic):
|
|
568
|
+ super().__init__(mqtt_client, topic)
|
|
569
|
+ self.mqtt_client.send(self.topic + '/' + self.TX_TOPIC, json.dumps(
|
|
570
|
+ {self.KEY_WINDOW_DETECTION: "ON", self.KEY_CHILD_LOCK: "UNLOCK", self.KEY_VALVE_DETECTION: "ON", self.KEY_SYSTEM_MODE: "heat"}))
|
|
571
|
+
|
|
572
|
+ def warning_call_condition(self):
|
|
573
|
+ return self.get(self.KEY_BATTERY) <= BATTERY_WARN_LEVEL
|
|
574
|
+
|
|
575
|
+ def warning_text(self):
|
|
576
|
+ return "Low battery level detected for %s. Battery level was %.0f%%." % (self.topic, self.get(self.KEY_BATTERY))
|
|
577
|
+
|
|
578
|
+ #
|
|
579
|
+ # RX
|
|
580
|
+ #
|
|
581
|
+ @property
|
|
582
|
+ def linkqulity(self):
|
|
583
|
+ return self.get(self.KEY_LINKQUALITY)
|
|
584
|
+
|
|
585
|
+ @property
|
|
586
|
+ def heating_setpoint(self):
|
|
587
|
+ return self.get(self.KEY_HEATING_SETPOINT)
|
|
588
|
+
|
|
589
|
+ @property
|
|
590
|
+ def temperature(self):
|
|
591
|
+ return self.get(self.KEY_TEMPERATURE)
|
|
592
|
+
|
|
593
|
+ #
|
|
594
|
+ # TX
|
|
595
|
+ #
|
|
596
|
+ def set_heating_setpoint(self, setpoint):
|
|
597
|
+ self.pack(self.KEY_HEATING_SETPOINT, setpoint)
|