Move keypad battery implementation details into py-august (#32349)
* Move keypad battery implementation details into py-august * Upgrade to py-august 0.22.0 which also adds gen2 doorbell battery data * remove cruft from previous refactor
This commit is contained in:
1 parent
924c313c8a
commit
7ca4665711
7 files changed
+146
-18
No files matched your search
@@ -9,10 +9,6 @@ from homeassistant.helpers.entity import Entity
|
||||
from .const import DATA_AUGUST, DOMAIN
|
||||
from .entity import AugustEntityMixin
|
||||
|
||||
BATTERY_LEVEL_FULL = "Full"
|
||||
BATTERY_LEVEL_MEDIUM = "Medium"
|
||||
BATTERY_LEVEL_LOW = "Low"
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -26,16 +22,7 @@ def _retrieve_linked_keypad_battery_state(detail):
|
||||
if detail.keypad is None:
|
||||
return None
|
||||
|
||||
battery_level = detail.keypad.battery_level
|
||||
|
||||
if battery_level == BATTERY_LEVEL_FULL:
|
||||
return 100
|
||||
if battery_level == BATTERY_LEVEL_MEDIUM:
|
||||
return 60
|
||||
if battery_level == BATTERY_LEVEL_LOW:
|
||||
return 10
|
||||
|
||||
return 0
|
||||
return detail.keypad.battery_percentage
|
||||
|
||||
|
||||
SENSOR_TYPES_BATTERY = {
|
||||
|
||||
Reference in new issue
Block a user