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 authored and Martin Hjelmare committed 2019-01-28 21:27:26 +01:00
1 parent 41c1997b88
commit abeb875c61
7 files changed
+76 -112

No files matched your search

@@ -42,18 +42,11 @@ class HomeKitSwitch(HomeKitEntity, SwitchDevice):
CharacteristicsTypes.OUTLET_IN_USE,
]
def update_characteristics(self, characteristics):
"""Synchronise the switch state with Home Assistant."""
# pylint: disable=import-error
from homekit.model.characteristics import CharacteristicsTypes
def _update_on(self, value):
self._on = value
for characteristic in characteristics:
ctype = characteristic['type']
ctype = CharacteristicsTypes.get_short(ctype)
if ctype == "on":
self._on = characteristic['value']
elif ctype == "outlet-in-use":
self._outlet_in_use = characteristic['value']
def _update_outlet_in_use(self, value):
self._outlet_in_use = value
@property
def is_on(self):