|
41 | 41 | ATTR_BATTERY_TYPE_AND_QUANTITY, |
42 | 42 | ATTR_DEVICE_ID, |
43 | 43 | ATTR_DEVICE_NAME, |
| 44 | + ATTR_NOTE, |
44 | 45 | ATTR_PREVIOUS_BATTERY_LEVEL, |
45 | 46 | ATTR_REMOVE, |
46 | 47 | ATTR_SOURCE_ENTITY_ID, |
|
51 | 52 | CONF_BATTERY_QUANTITY, |
52 | 53 | CONF_BATTERY_TYPE, |
53 | 54 | CONF_FILTER_OUTLIERS, |
| 55 | + CONF_NOTE, |
54 | 56 | CONF_SOURCE_ENTITY_ID, |
55 | 57 | DEFAULT_BATTERY_INCREASE_THRESHOLD, |
56 | 58 | DEFAULT_BATTERY_LOW_THRESHOLD, |
@@ -107,6 +109,7 @@ class BatteryNotesSubentryCoordinator(DataUpdateCoordinator[None]): |
107 | 109 | device_name: str |
108 | 110 | battery_type: str |
109 | 111 | battery_quantity: int |
| 112 | + battery_note: str |
110 | 113 | battery_low_threshold: int |
111 | 114 | battery_low_template: str | None |
112 | 115 | battery_percentage_template: str | None |
@@ -148,6 +151,7 @@ def __init__( # noqa: PLR0912 |
148 | 151 | return |
149 | 152 |
|
150 | 153 | self.battery_type = cast(str, self.subentry.data.get(CONF_BATTERY_TYPE, "")) |
| 154 | + self.battery_note = cast(str, self.subentry.data.get(CONF_NOTE, "")) |
151 | 155 | try: |
152 | 156 | self.battery_quantity = cast( |
153 | 157 | int, self.subentry.data.get(CONF_BATTERY_QUANTITY, 1) |
@@ -412,6 +416,7 @@ def battery_low_template_state(self, value): |
412 | 416 | ATTR_BATTERY_LOW_THRESHOLD: self.battery_low_threshold, |
413 | 417 | ATTR_BATTERY_TYPE_AND_QUANTITY: self.battery_type_and_quantity, |
414 | 418 | ATTR_BATTERY_TYPE: self.battery_type, |
| 419 | + ATTR_NOTE: self.battery_note, |
415 | 420 | ATTR_BATTERY_QUANTITY: self.battery_quantity, |
416 | 421 | ATTR_BATTERY_LEVEL: 0, |
417 | 422 | ATTR_PREVIOUS_BATTERY_LEVEL: 100, |
@@ -444,6 +449,7 @@ def battery_low_template_state(self, value): |
444 | 449 | ATTR_BATTERY_LOW_THRESHOLD: self.battery_low_threshold, |
445 | 450 | ATTR_BATTERY_TYPE_AND_QUANTITY: self.battery_type_and_quantity, |
446 | 451 | ATTR_BATTERY_TYPE: self.battery_type, |
| 452 | + ATTR_NOTE: self.battery_note, |
447 | 453 | ATTR_BATTERY_QUANTITY: self.battery_quantity, |
448 | 454 | ATTR_BATTERY_LEVEL: 100, |
449 | 455 | ATTR_PREVIOUS_BATTERY_LEVEL: 0, |
@@ -478,6 +484,7 @@ def battery_low_binary_state(self, value): |
478 | 484 | ATTR_BATTERY_LOW_THRESHOLD: self.battery_low_threshold, |
479 | 485 | ATTR_BATTERY_TYPE_AND_QUANTITY: self.battery_type_and_quantity, |
480 | 486 | ATTR_BATTERY_TYPE: self.battery_type, |
| 487 | + ATTR_NOTE: self.battery_note, |
481 | 488 | ATTR_BATTERY_QUANTITY: self.battery_quantity, |
482 | 489 | ATTR_BATTERY_LEVEL: 0, |
483 | 490 | ATTR_PREVIOUS_BATTERY_LEVEL: 100, |
@@ -510,6 +517,7 @@ def battery_low_binary_state(self, value): |
510 | 517 | ATTR_BATTERY_LOW_THRESHOLD: self.battery_low_threshold, |
511 | 518 | ATTR_BATTERY_TYPE_AND_QUANTITY: self.battery_type_and_quantity, |
512 | 519 | ATTR_BATTERY_TYPE: self.battery_type, |
| 520 | + ATTR_NOTE: self.battery_note, |
513 | 521 | ATTR_BATTERY_QUANTITY: self.battery_quantity, |
514 | 522 | ATTR_BATTERY_LEVEL: 100, |
515 | 523 | ATTR_PREVIOUS_BATTERY_LEVEL: 0, |
@@ -562,6 +570,7 @@ def current_battery_level(self, value): |
562 | 570 | ATTR_BATTERY_LOW_THRESHOLD: self.battery_low_threshold, |
563 | 571 | ATTR_BATTERY_TYPE_AND_QUANTITY: self.battery_type_and_quantity, |
564 | 572 | ATTR_BATTERY_TYPE: self.battery_type, |
| 573 | + ATTR_NOTE: self.battery_note, |
565 | 574 | ATTR_BATTERY_QUANTITY: self.battery_quantity, |
566 | 575 | ATTR_BATTERY_LEVEL: self.rounded_battery_level, |
567 | 576 | ATTR_PREVIOUS_BATTERY_LEVEL: self.rounded_previous_battery_level, |
@@ -597,6 +606,7 @@ def current_battery_level(self, value): |
597 | 606 | ATTR_BATTERY_LOW_THRESHOLD: self.battery_low_threshold, |
598 | 607 | ATTR_BATTERY_TYPE_AND_QUANTITY: self.battery_type_and_quantity, |
599 | 608 | ATTR_BATTERY_TYPE: self.battery_type, |
| 609 | + ATTR_NOTE: self.battery_note, |
600 | 610 | ATTR_BATTERY_QUANTITY: self.battery_quantity, |
601 | 611 | ATTR_BATTERY_LEVEL: self.rounded_battery_level, |
602 | 612 | ATTR_PREVIOUS_BATTERY_LEVEL: self.rounded_previous_battery_level, |
|
0 commit comments