mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Remove unneeded call active check in modbus (#136487)
We have an asyncio.Lock in place to prevent polling collisions now so this is no longer needed Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> Co-authored-by: Shay Levy <levyshay1@gmail.com>
This commit is contained in:
parent
1bf97e3f45
commit
412636a198
@ -107,13 +107,9 @@ class ModbusBinarySensor(BasePlatform, RestoreEntity, BinarySensorEntity):
|
|||||||
"""Update the state of the sensor."""
|
"""Update the state of the sensor."""
|
||||||
|
|
||||||
# do not allow multiple active calls to the same platform
|
# do not allow multiple active calls to the same platform
|
||||||
if self._call_active:
|
|
||||||
return
|
|
||||||
self._call_active = True
|
|
||||||
result = await self._hub.async_pb_call(
|
result = await self._hub.async_pb_call(
|
||||||
self._slave, self._address, self._count, self._input_type
|
self._slave, self._address, self._count, self._input_type
|
||||||
)
|
)
|
||||||
self._call_active = False
|
|
||||||
if result is None:
|
if result is None:
|
||||||
self._attr_available = False
|
self._attr_available = False
|
||||||
self._result = []
|
self._result = []
|
||||||
|
@ -88,7 +88,6 @@ class BasePlatform(Entity):
|
|||||||
self._input_type = entry[CONF_INPUT_TYPE]
|
self._input_type = entry[CONF_INPUT_TYPE]
|
||||||
self._value: str | None = None
|
self._value: str | None = None
|
||||||
self._scan_interval = int(entry[CONF_SCAN_INTERVAL])
|
self._scan_interval = int(entry[CONF_SCAN_INTERVAL])
|
||||||
self._call_active = False
|
|
||||||
self._cancel_timer: Callable[[], None] | None = None
|
self._cancel_timer: Callable[[], None] | None = None
|
||||||
self._cancel_call: Callable[[], None] | None = None
|
self._cancel_call: Callable[[], None] | None = None
|
||||||
|
|
||||||
@ -389,13 +388,9 @@ class BaseSwitch(BasePlatform, ToggleEntity, RestoreEntity):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# do not allow multiple active calls to the same platform
|
# do not allow multiple active calls to the same platform
|
||||||
if self._call_active:
|
|
||||||
return
|
|
||||||
self._call_active = True
|
|
||||||
result = await self._hub.async_pb_call(
|
result = await self._hub.async_pb_call(
|
||||||
self._slave, self._verify_address, 1, self._verify_type
|
self._slave, self._verify_address, 1, self._verify_type
|
||||||
)
|
)
|
||||||
self._call_active = False
|
|
||||||
if result is None:
|
if result is None:
|
||||||
self._attr_available = False
|
self._attr_available = False
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user