From d54e8d3947e8f739ee216cb6ee02a6b9a1662c39 Mon Sep 17 00:00:00 2001 From: Daniel Raper Date: Tue, 2 Jan 2024 22:19:39 +0000 Subject: [PATCH] Shorten ChargingBinarySensor cooldown --- custom_components/ohme/binary_sensor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/ohme/binary_sensor.py b/custom_components/ohme/binary_sensor.py index 500e810..a7d123e 100644 --- a/custom_components/ohme/binary_sensor.py +++ b/custom_components/ohme/binary_sensor.py @@ -188,9 +188,9 @@ def _calculate_state(self) -> bool: @callback def _handle_coordinator_update(self) -> None: """Update data.""" - # Don't accept updates if 20s hasnt passed + # Don't accept updates if 5s hasnt passed # State calculations use deltas that may be unreliable to check if requests are too often - if self._last_updated and (utcnow().timestamp() - self._last_updated.timestamp() < 20): + if self._last_updated and (utcnow().timestamp() - self._last_updated.timestamp() < 5): _LOGGER.debug("ChargingBinarySensor: State update too soon - suppressing") return