|
@@ -96,10 +96,10 @@ class base(dict):
|
96
|
96
|
self.__previous__[key] = prev_value
|
97
|
97
|
# Filter, if needed
|
98
|
98
|
self.unpack_filter(key)
|
99
|
|
- self.logger.debug("Received data for (%s) %s - %s", self.topic, key, str(self.get(key)))
|
|
99
|
+ self.logger.debug("Received data %s - %s", key, str(self.get(key)))
|
100
|
100
|
self.callback_caller(key, self[key], self.get(key) != self.__previous__.get(key))
|
101
|
101
|
elif key not in self.RX_IGNORE_KEYS:
|
102
|
|
- self.logger.warning('Got a message from \"%s\" with unparsed content "%s"', self.topic, key)
|
|
102
|
+ self.logger.warning('Got a message with unparsed content: "%s - %s"', key, str(data))
|
103
|
103
|
else:
|
104
|
104
|
self.logger.debug("Ignoring key %s", key)
|
105
|
105
|
|
|
@@ -141,7 +141,7 @@ class base(dict):
|
141
|
141
|
if self.TX_TYPE < 0:
|
142
|
142
|
self.logger.error("Unknown tx type. Set TX_TYPE of class to a known value")
|
143
|
143
|
else:
|
144
|
|
- self.logger.debug("Sending data for (%s) %s - %s", self.topic, key, str(data))
|
|
144
|
+ self.logger.debug("Sending data for %s - %s", key, str(data))
|
145
|
145
|
if self.TX_TYPE == self.TX_DICT:
|
146
|
146
|
self.mqtt_client.send('/'.join([self.topic, self.TX_TOPIC]), json.dumps({key: data}))
|
147
|
147
|
else:
|
|
@@ -274,11 +274,11 @@ class shelly(base):
|
274
|
274
|
self.pack(self.KEY_OUTPUT_0, state)
|
275
|
275
|
|
276
|
276
|
def set_output_0_mcb(self, device, key, data):
|
277
|
|
- self.logger.log(logging.INFO if data != self.output_0 else logging.DEBUG, "%s: Changing output 0 to %s", self.topic, str(data))
|
|
277
|
+ self.logger.log(logging.INFO if data != self.output_0 else logging.DEBUG, "Changing output 0 to %s", str(data))
|
278
|
278
|
self.set_output_0(data)
|
279
|
279
|
|
280
|
280
|
def toggle_output_0_mcb(self, device, key, data):
|
281
|
|
- self.logger.info("%s: Toggeling output 0", self.topic)
|
|
281
|
+ self.logger.info("Toggeling output 0")
|
282
|
282
|
self.set_output_0('toggle')
|
283
|
283
|
|
284
|
284
|
def set_output_1(self, state):
|
|
@@ -286,11 +286,11 @@ class shelly(base):
|
286
|
286
|
self.pack(self.KEY_OUTPUT_1, state)
|
287
|
287
|
|
288
|
288
|
def set_output_1_mcb(self, device, key, data):
|
289
|
|
- self.logger.log(logging.INFO if data != self.output_1 else logging.DEBUG, "%s: Changing output 1 to %s", self.topic, str(data))
|
|
289
|
+ self.logger.log(logging.INFO if data != self.output_1 else logging.DEBUG, "Changing output 1 to %s", str(data))
|
290
|
290
|
self.set_output_1(data)
|
291
|
291
|
|
292
|
292
|
def toggle_output_1_mcb(self, device, key, data):
|
293
|
|
- self.logger.info("%s: Toggeling output 1", self.topic)
|
|
293
|
+ self.logger.info("Toggeling output 1")
|
294
|
294
|
self.set_output_1('toggle')
|
295
|
295
|
|
296
|
296
|
|
|
@@ -328,11 +328,11 @@ class silvercrest_powerplug(base):
|
328
|
328
|
self.pack(self.KEY_OUTPUT_0, state)
|
329
|
329
|
|
330
|
330
|
def set_output_0_mcb(self, device, key, data):
|
331
|
|
- self.logger.log(logging.INFO if data != self.output_0 else logging.DEBUG, "%s: Changing output 0 to %s", self.topic, str(data))
|
|
331
|
+ self.logger.log(logging.INFO if data != self.output_0 else logging.DEBUG, "Changing output 0 to %s", str(data))
|
332
|
332
|
self.set_output_0(data)
|
333
|
333
|
|
334
|
334
|
def toggle_output_0_mcb(self, device, key, data):
|
335
|
|
- self.logger.info("%s: Toggeling output 0", self.topic)
|
|
335
|
+ self.logger.info("Toggeling output 0")
|
336
|
336
|
self.set_output_0('toggle')
|
337
|
337
|
|
338
|
338
|
|
|
@@ -417,11 +417,11 @@ class my_powerplug(base):
|
417
|
417
|
self.pack(self.KEY_OUTPUT_0, state)
|
418
|
418
|
|
419
|
419
|
def set_output_0_mcb(self, device, key, data):
|
420
|
|
- self.logger.log(logging.INFO if data != self.output_0 else logging.DEBUG, "%s: Changing output 0 to %s", self.topic, str(data))
|
|
420
|
+ self.logger.log(logging.INFO if data != self.output_0 else logging.DEBUG, "Changing output 0 to %s", str(data))
|
421
|
421
|
self.set_output_0(data)
|
422
|
422
|
|
423
|
423
|
def toggle_output_0_mcb(self, device, key, data):
|
424
|
|
- self.logger.info("%s: Toggeling output 0", self.topic)
|
|
424
|
+ self.logger.info("Toggeling output 0")
|
425
|
425
|
self.set_output_0('toggle')
|
426
|
426
|
|
427
|
427
|
def set_output_1(self, state):
|
|
@@ -429,11 +429,11 @@ class my_powerplug(base):
|
429
|
429
|
self.pack(self.KEY_OUTPUT_1, state)
|
430
|
430
|
|
431
|
431
|
def set_output_1_mcb(self, device, key, data):
|
432
|
|
- self.logger.log(logging.INFO if data != self.output_1 else logging.DEBUG, "%s: Changing output 1 to %s", self.topic, str(data))
|
|
432
|
+ self.logger.log(logging.INFO if data != self.output_1 else logging.DEBUG, "Changing output 1 to %s", str(data))
|
433
|
433
|
self.set_output_1(data)
|
434
|
434
|
|
435
|
435
|
def toggle_output_1_mcb(self, device, key, data):
|
436
|
|
- self.logger.info("%s: Toggeling output 1", self.topic)
|
|
436
|
+ self.logger.info("Toggeling output 1")
|
437
|
437
|
self.set_output_1('toggle')
|
438
|
438
|
|
439
|
439
|
def set_output_2(self, state):
|
|
@@ -441,11 +441,11 @@ class my_powerplug(base):
|
441
|
441
|
self.pack(self.KEY_OUTPUT_2, state)
|
442
|
442
|
|
443
|
443
|
def set_output_2_mcb(self, device, key, data):
|
444
|
|
- self.logger.log(logging.INFO if data != self.output_2 else logging.DEBUG, "%s: Changing output 2 to %s", self.topic, str(data))
|
|
444
|
+ self.logger.log(logging.INFO if data != self.output_2 else logging.DEBUG, "Changing output 2 to %s", str(data))
|
445
|
445
|
self.set_output_2(data)
|
446
|
446
|
|
447
|
447
|
def toggle_output_2_mcb(self, device, key, data):
|
448
|
|
- self.logger.info("%s: Toggeling output 2", self.topic)
|
|
448
|
+ self.logger.info("Toggeling output 2")
|
449
|
449
|
self.set_output_2('toggle')
|
450
|
450
|
|
451
|
451
|
def set_output_3(self, state):
|
|
@@ -453,11 +453,11 @@ class my_powerplug(base):
|
453
|
453
|
self.pack(self.KEY_OUTPUT_3, state)
|
454
|
454
|
|
455
|
455
|
def set_output_3_mcb(self, device, key, data):
|
456
|
|
- self.logger.log(logging.INFO if data != self.output_3 else logging.DEBUG, "%s: Changing output 3 to %s", self.topic, str(data))
|
|
456
|
+ self.logger.log(logging.INFO if data != self.output_3 else logging.DEBUG, "Changing output 3 to %s", str(data))
|
457
|
457
|
self.set_output_3(data)
|
458
|
458
|
|
459
|
459
|
def toggle_output_3_mcb(self, device, key, data):
|
460
|
|
- self.logger.info("%s: Toggeling output 3", self.topic)
|
|
460
|
+ self.logger.info("Toggeling output 3")
|
461
|
461
|
self.set_output_3('toggle')
|
462
|
462
|
|
463
|
463
|
def set_output_all(self, state):
|
|
@@ -465,11 +465,11 @@ class my_powerplug(base):
|
465
|
465
|
self.pack(self.KEY_OUTPUT_ALL, state)
|
466
|
466
|
|
467
|
467
|
def set_output_all_mcb(self, device, key, data):
|
468
|
|
- self.logger.info("%s: Changing all outputs to %s", self.topic, str(data))
|
|
468
|
+ self.logger.info("Changing all outputs to %s", str(data))
|
469
|
469
|
self.set_output_all(data)
|
470
|
470
|
|
471
|
471
|
def toggle_output_all_mcb(self, device, key, data):
|
472
|
|
- self.logger.info("%s: Toggeling all outputs", self.topic)
|
|
472
|
+ self.logger.info("Toggeling all outputs")
|
473
|
473
|
self.set_output_0('toggle')
|
474
|
474
|
|
475
|
475
|
|
|
@@ -537,11 +537,11 @@ class tradfri_light(base):
|
537
|
537
|
self.pack(self.KEY_OUTPUT_0, state)
|
538
|
538
|
|
539
|
539
|
def set_output_0_mcb(self, device, key, data):
|
540
|
|
- self.logger.log(logging.INFO if data != self.output_0 else logging.DEBUG, "%s: Changing output 0 to %s", self.topic, str(data))
|
|
540
|
+ self.logger.log(logging.INFO if data != self.output_0 else logging.DEBUG, "Changing output 0 to %s", str(data))
|
541
|
541
|
self.set_output_0(data)
|
542
|
542
|
|
543
|
543
|
def toggle_output_0_mcb(self, device, key, data):
|
544
|
|
- self.logger.info("%s: Toggeling output 0", self.topic)
|
|
544
|
+ self.logger.info("Toggeling output 0")
|
545
|
545
|
self.set_output_0('toggle')
|
546
|
546
|
|
547
|
547
|
def set_brightness(self, brightness):
|
|
@@ -549,7 +549,7 @@ class tradfri_light(base):
|
549
|
549
|
self.pack(self.KEY_BRIGHTNESS, brightness)
|
550
|
550
|
|
551
|
551
|
def set_brightness_mcb(self, device, key, data):
|
552
|
|
- self.logger.log(logging.INFO if data != self.brightness else logging.DEBUG, "%s: Changing brightness to %s", self.topic, str(data))
|
|
552
|
+ self.logger.log(logging.INFO if data != self.brightness else logging.DEBUG, "Changing brightness to %s", str(data))
|
553
|
553
|
self.set_brightness(data)
|
554
|
554
|
|
555
|
555
|
def default_inc(self, speed=40):
|
|
@@ -566,7 +566,7 @@ class tradfri_light(base):
|
566
|
566
|
self.pack(self.KEY_COLOR_TEMP, color_temp)
|
567
|
567
|
|
568
|
568
|
def set_color_temp_mcb(self, device, key, data):
|
569
|
|
- self.logger.log(logging.INFO if data != self.color_temp else logging.DEBUG, "%s: Changing color temperature to %s", self.topic, str(data))
|
|
569
|
+ self.logger.log(logging.INFO if data != self.color_temp else logging.DEBUG, "Changing color temperature to %s", str(data))
|
570
|
570
|
self.set_color_temp(data)
|
571
|
571
|
|
572
|
572
|
|
|
@@ -608,7 +608,7 @@ class tradfri_button(base):
|
608
|
608
|
# WARNING CALL
|
609
|
609
|
#
|
610
|
610
|
def warning_call_condition(self):
|
611
|
|
- return self.get(self.KEY_BATTERY) <= BATTERY_WARN_LEVEL
|
|
611
|
+ return self.get(self.KEY_BATTERY) is not None and self.get(self.KEY_BATTERY) <= BATTERY_WARN_LEVEL
|
612
|
612
|
|
613
|
613
|
def warning_text(self):
|
614
|
614
|
return "Low battery level detected for %s. Battery level was %.0f%%." % (self.topic, self.get(self.KEY_BATTERY))
|
|
@@ -696,7 +696,7 @@ class nodered_gui_switch(nodered_gui_button):
|
696
|
696
|
self.pack(self.KEY_STATE, data)
|
697
|
697
|
|
698
|
698
|
def set_state_mcb(self, device, key, data):
|
699
|
|
- self.logger.debug("%s: Sending %s with content %s", self.topic, key, str(data))
|
|
699
|
+ self.logger.debug("Sending %s with content %s", key, str(data))
|
700
|
700
|
self.set_state(data)
|
701
|
701
|
|
702
|
702
|
|
|
@@ -735,7 +735,7 @@ class nodered_gui_brightness_color_temp(base):
|
735
|
735
|
self.pack(self.KEY_ENABLE, data)
|
736
|
736
|
|
737
|
737
|
def set_enable_mcb(self, device, key, data):
|
738
|
|
- self.logger.debug("%s: Sending %s with content %s", self.topic, key, str(data))
|
|
738
|
+ self.logger.debug("Sending %s with content %s", key, str(data))
|
739
|
739
|
self.set_enable(data)
|
740
|
740
|
|
741
|
741
|
def set_brightness(self, data):
|
|
@@ -743,7 +743,7 @@ class nodered_gui_brightness_color_temp(base):
|
743
|
743
|
self.pack(self.KEY_BRIGHTNESS, data)
|
744
|
744
|
|
745
|
745
|
def set_brightness_mcb(self, device, key, data):
|
746
|
|
- self.logger.debug("%s: Sending %s with content %s", self.topic, key, str(data))
|
|
746
|
+ self.logger.debug("Sending %s with content %s", key, str(data))
|
747
|
747
|
self.set_brightness(data)
|
748
|
748
|
|
749
|
749
|
def set_color_temp(self, data):
|
|
@@ -751,7 +751,7 @@ class nodered_gui_brightness_color_temp(base):
|
751
|
751
|
self.pack(self.KEY_COLOR_TEMP, data)
|
752
|
752
|
|
753
|
753
|
def set_color_temp_mcb(self, device, key, data):
|
754
|
|
- self.logger.debug("%s: Sending %s with content %s", self.topic, key, str(data))
|
|
754
|
+ self.logger.debug("Sending %s with content %s", key, str(data))
|
755
|
755
|
self.set_color_temp(data)
|
756
|
756
|
|
757
|
757
|
|
|
@@ -773,7 +773,7 @@ class nodered_gui_leds(base):
|
773
|
773
|
|
774
|
774
|
def set_led(self, key, data):
|
775
|
775
|
"""data: [True, False]"""
|
776
|
|
- self.logger.debug("%s: Sending %s with content %s", self.topic, key, str(data))
|
|
776
|
+ self.logger.debug("Sending %s with content %s", key, str(data))
|
777
|
777
|
self.pack(key, data)
|
778
|
778
|
|
779
|
779
|
|
|
@@ -828,7 +828,7 @@ class brennenstuhl_heatingvalve(base):
|
828
|
828
|
self.pack(self.KEY_HEATING_SETPOINT, setpoint)
|
829
|
829
|
|
830
|
830
|
def set_heating_setpoint_mcb(self, device, key, data):
|
831
|
|
- self.logger.info("%s: Changing heating setpoint to %s", self.topic, str(data))
|
|
831
|
+ self.logger.info("Changing heating setpoint to %s", str(data))
|
832
|
832
|
self.set_heating_setpoint(data)
|
833
|
833
|
|
834
|
834
|
|
|
@@ -891,7 +891,7 @@ class status(base):
|
891
|
891
|
self.pack(self.KEY_STATE + "/" + str(num), data)
|
892
|
892
|
|
893
|
893
|
def set_state_mcb(self, device, key, data):
|
894
|
|
- self.logger.info("%s: Changing state to %s", self.topic, str(data))
|
|
894
|
+ self.logger.info("Changing state to %s", str(data))
|
895
|
895
|
self.set_state(data)
|
896
|
896
|
|
897
|
897
|
|