Skip to content

Commit

Permalink
Remove unneeded call active check in modbus (home-assistant#136487)
Browse files Browse the repository at this point in the history
We have an asyncio.Lock in place to prevent polling collisions
now so this is no longer needed

Co-authored-by: Joost Lekkerkerker <[email protected]>
Co-authored-by: Shay Levy <[email protected]>
  • Loading branch information
3 people authored Jan 25, 2025
1 parent 1bf97e3 commit 412636a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
4 changes: 0 additions & 4 deletions homeassistant/components/modbus/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,9 @@ async def _async_update(self) -> None:
"""Update the state of the sensor."""

# 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(
self._slave, self._address, self._count, self._input_type
)
self._call_active = False
if result is None:
self._attr_available = False
self._result = []
Expand Down
5 changes: 0 additions & 5 deletions homeassistant/components/modbus/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def __init__(
self._input_type = entry[CONF_INPUT_TYPE]
self._value: str | None = None
self._scan_interval = int(entry[CONF_SCAN_INTERVAL])
self._call_active = False
self._cancel_timer: Callable[[], None] | None = None
self._cancel_call: Callable[[], None] | None = None

Expand Down Expand Up @@ -389,13 +388,9 @@ async def _async_update(self) -> None:
return

# 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(
self._slave, self._verify_address, 1, self._verify_type
)
self._call_active = False
if result is None:
self._attr_available = False
return
Expand Down

0 comments on commit 412636a

Please sign in to comment.