|
@@ -179,7 +179,7 @@ class base(dict):
|
179
|
179
|
if self.warning_callback is not None:
|
180
|
180
|
self.warning_callback(self, warn_txt)
|
181
|
181
|
|
182
|
|
- def warning_text(self, data):
|
|
182
|
+ def warning_text(self):
|
183
|
183
|
return "default warning text - replace parent warning_text function"
|
184
|
184
|
|
185
|
185
|
def previous_value(self, key):
|
|
@@ -336,6 +336,35 @@ class silvercrest_powerplug(base):
|
336
|
336
|
self.set_output_0('toggle')
|
337
|
337
|
|
338
|
338
|
|
|
339
|
+class silvercrest_motion_sensor(base):
|
|
340
|
+ KEY_BATTERY = "battery"
|
|
341
|
+ KEY_BATTERY_LOW = "battery_low"
|
|
342
|
+ KEY_LINKQUALITY = "linkquality"
|
|
343
|
+ KEY_OCCUPANCY = "occupancy"
|
|
344
|
+ KEY_UNMOUNTED = "tamper"
|
|
345
|
+ KEY_VOLTAGE = "voltage"
|
|
346
|
+ #
|
|
347
|
+ RX_KEYS = [KEY_BATTERY, KEY_BATTERY_LOW, KEY_LINKQUALITY, KEY_OCCUPANCY, KEY_UNMOUNTED, KEY_VOLTAGE]
|
|
348
|
+
|
|
349
|
+ def __init__(self, mqtt_client, topic):
|
|
350
|
+ super().__init__(mqtt_client, topic)
|
|
351
|
+
|
|
352
|
+ def warning_call_condition(self):
|
|
353
|
+ return self.get(self.KEY_BATTERY_LOW)
|
|
354
|
+
|
|
355
|
+ def warning_text(self, data):
|
|
356
|
+ return "Battery low: level=%d" % self.get(self.KEY_BATTERY)
|
|
357
|
+
|
|
358
|
+ #
|
|
359
|
+ # RX
|
|
360
|
+ #
|
|
361
|
+
|
|
362
|
+ @property
|
|
363
|
+ def linkquality(self):
|
|
364
|
+ """rv: numeric value"""
|
|
365
|
+ return self.get(self.KEY_LINKQUALITY)
|
|
366
|
+
|
|
367
|
+
|
339
|
368
|
class my_powerplug(base):
|
340
|
369
|
KEY_OUTPUT_0 = "output/1"
|
341
|
370
|
KEY_OUTPUT_1 = "output/2"
|