Fix async issue in ViCare integration (#104541)
* use async executor for get_circuits * use async executor for get_burners and get_compressors
This commit is contained in:
parent
14387cf94b
commit
ad17acc6ca
5 changed files with 24 additions and 13 deletions
|
@ -103,7 +103,7 @@ async def async_setup_entry(
|
|||
entities = []
|
||||
api = hass.data[DOMAIN][config_entry.entry_id][VICARE_API]
|
||||
device_config = hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG]
|
||||
circuits = get_circuits(api)
|
||||
circuits = await hass.async_add_executor_job(get_circuits, api)
|
||||
|
||||
for circuit in circuits:
|
||||
entity = ViCareClimate(
|
||||
|
@ -154,7 +154,7 @@ class ViCareClimate(ViCareEntity, ClimateEntity):
|
|||
self._current_program = None
|
||||
self._attr_translation_key = translation_key
|
||||
|
||||
def update(self) -> None:
|
||||
async def async_update(self) -> None:
|
||||
"""Let HA know there has been an update from the ViCare API."""
|
||||
try:
|
||||
_room_temperature = None
|
||||
|
@ -205,11 +205,15 @@ class ViCareClimate(ViCareEntity, ClimateEntity):
|
|||
self._current_action = False
|
||||
# Update the specific device attributes
|
||||
with suppress(PyViCareNotSupportedFeatureError):
|
||||
for burner in get_burners(self._api):
|
||||
burners = await self.hass.async_add_executor_job(get_burners, self._api)
|
||||
for burner in burners:
|
||||
self._current_action = self._current_action or burner.getActive()
|
||||
|
||||
with suppress(PyViCareNotSupportedFeatureError):
|
||||
for compressor in get_compressors(self._api):
|
||||
compressors = await self.hass.async_add_executor_job(
|
||||
get_compressors, self._api
|
||||
)
|
||||
for compressor in compressors:
|
||||
self._current_action = (
|
||||
self._current_action or compressor.getActive()
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue