Add an asyncio Lock around pairing, which cant be used concurrently (#21933)
This commit is contained in:
parent
4f5446ff02
commit
5e2302e469
7 changed files with 76 additions and 63 deletions
|
@ -48,20 +48,20 @@ class HomeKitSwitch(HomeKitEntity, SwitchDevice):
|
|||
"""Return true if device is on."""
|
||||
return self._on
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
async def async_turn_on(self, **kwargs):
|
||||
"""Turn the specified switch on."""
|
||||
self._on = True
|
||||
characteristics = [{'aid': self._aid,
|
||||
'iid': self._chars['on'],
|
||||
'value': True}]
|
||||
self.put_characteristics(characteristics)
|
||||
await self._accessory.put_characteristics(characteristics)
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
async def async_turn_off(self, **kwargs):
|
||||
"""Turn the specified switch off."""
|
||||
characteristics = [{'aid': self._aid,
|
||||
'iid': self._chars['on'],
|
||||
'value': False}]
|
||||
self.put_characteristics(characteristics)
|
||||
await self._accessory.put_characteristics(characteristics)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue