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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user