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

This commit is contained in:
Jc2k 2019-03-11 18:59:41 +00:00 committed by Paulus Schoutsen
parent 4f5446ff02
commit 5e2302e469
7 changed files with 76 additions and 63 deletions

View file

@ -80,21 +80,21 @@ class HomeKitClimateDevice(HomeKitEntity, ClimateDevice):
def _update_temperature_target(self, value):
self._target_temp = value
def set_temperature(self, **kwargs):
async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
temp = kwargs.get(ATTR_TEMPERATURE)
characteristics = [{'aid': self._aid,
'iid': self._chars['temperature.target'],
'value': temp}]
self.put_characteristics(characteristics)
await self._accessory.put_characteristics(characteristics)
def set_operation_mode(self, operation_mode):
async def async_set_operation_mode(self, operation_mode):
"""Set new target operation mode."""
characteristics = [{'aid': self._aid,
'iid': self._chars['heating-cooling.target'],
'value': MODE_HASS_TO_HOMEKIT[operation_mode]}]
self.put_characteristics(characteristics)
await self._accessory.put_characteristics(characteristics)
@property
def state(self):