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:
J. Nick Koston authored and GitHub committed 2020-03-01 23:22:28 -08:00
1 parent 924c313c8a
commit 7ca4665711
7 files changed
+146 -18

No files matched your search

@@ -18,7 +18,6 @@ class AugustEntityMixin(Entity):
super().__init__()
self._data = data
self._device = device
self._undo_dispatch_subscription = None
@property
def should_poll(self):
@@ -3,7 +3,7 @@
"name": "August",
"documentation": "https://www.home-assistant.io/integrations/august",
"requirements": [
"py-august==0.21.0"
"py-august==0.22.0"
],
"dependencies": [
"configurator"
+1 -14
View File
@@ -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 = {