Add an asyncio Lock around pairing, which cant be used concurrently (#21933)

This commit is contained in:
Jc2k authored and Paulus Schoutsen committed 2019-03-11 11:59:41 -07:00
1 parent 4f5446ff02
commit 5e2302e469
7 files changed
+76 -63

No files matched your search

@@ -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):