1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00

Homekit controller BLE groundwork (part 2) (#20548)

* Only fetch values of characteristics we are tracking.

* Use callbacks on subclasses to update individual values

* Update alarm_control_panel to use update callbacks

* Update climate to use update callbacks

* Update cover to use update callbacks

* Update light to use update callbacks

* Update lock to use update callbacks

* Update switch to use update callbacks

* Remove compatibility code as all entities migrated

* pylint by name rather than code
This commit is contained in:
Jc2k
2019-01-28 20:27:26 +00:00
committed by Martin Hjelmare
parent 41c1997b88
commit abeb875c61
7 changed files with 76 additions and 112 deletions

View File

@@ -61,18 +61,11 @@ class HomeKitLock(HomeKitEntity, LockDevice):
CharacteristicsTypes.BATTERY_LEVEL,
]
def update_characteristics(self, characteristics):
"""Synchronise the Lock state with Home Assistant."""
# pylint: disable=import-error
from homekit.model.characteristics import CharacteristicsTypes
def _update_lock_mechanism_current_state(self, value):
self._state = CURRENT_STATE_MAP[value]
for characteristic in characteristics:
ctype = characteristic['type']
ctype = CharacteristicsTypes.get_short(ctype)
if ctype == "lock-mechanism.current-state":
self._state = CURRENT_STATE_MAP[characteristic['value']]
elif ctype == "battery-level":
self._battery_level = characteristic['value']
def _update_battery_level(self, value):
self._battery_level = value
@property
def name(self):