only allow one active call in each platform. (#52823)
This commit is contained in:
parent
19d3aa71ad
commit
12ac666459
5 changed files with 26 additions and 1 deletions
|
@ -194,13 +194,18 @@ class ModbusThermostat(BasePlatform, RestoreEntity, ClimateEntity):
|
|||
"""Update Target & Current Temperature."""
|
||||
# remark "now" is a dummy parameter to avoid problems with
|
||||
# async_track_time_interval
|
||||
|
||||
# do not allow multiple active calls to the same platform
|
||||
if self._call_active:
|
||||
return
|
||||
self._call_active = True
|
||||
self._target_temperature = await self._async_read_register(
|
||||
CALL_TYPE_REGISTER_HOLDING, self._target_temperature_register
|
||||
)
|
||||
self._current_temperature = await self._async_read_register(
|
||||
self._input_type, self._address
|
||||
)
|
||||
|
||||
self._call_active = False
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def _async_read_register(self, register_type, register) -> float | None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue