diff --git a/custom_components/peaqev/peaqservice/chargecontroller/chargecontroller.py b/custom_components/peaqev/peaqservice/chargecontroller/chargecontroller.py index 4873e886..26735580 100644 --- a/custom_components/peaqev/peaqservice/chargecontroller/chargecontroller.py +++ b/custom_components/peaqev/peaqservice/chargecontroller/chargecontroller.py @@ -1,6 +1,7 @@ from __future__ import annotations import logging +import time from typing import TYPE_CHECKING, Tuple from peaqevcore.common.models.observer_types import ObserverTypes @@ -27,7 +28,8 @@ class ChargeController(IChargeController): def __init__( self, hub: HomeAssistantHub, charger_states: dict, charger_type: ChargerType ): - self._aux_running_grace_timer = WaitTimer(timeout=300, init_now=False) + self._aux_running_grace_timer = WaitTimer(timeout=300, init_now=True) + self._init_time = time.time() super().__init__(hub, charger_states, charger_type) @property @@ -103,8 +105,8 @@ async def async_get_status_connected( return ChargeControllerStates.Error, True async def _aux_check_running_charger_mismatch(self, status_type: ChargeControllerStates) -> None: - if self._aux_running_grace_timer.is_timeout() and self._aux_running_grace_timer.value > 0: - _LOGGER.warning(f"Charger seems to be running without Peaqev controlling it. Attempting aux stop. If you wish to charge without Peaqev you need to disable it on the switch.") + if self._aux_running_grace_timer.is_timeout(): + _LOGGER.warning(f"Charger seems to be running without Peaqev controlling it. Attempting aux stop. If you wish to charge without Peaqev you need to disable it on the switch. {self._aux_running_grace_timer.value}, {self._aux_running_grace_timer.timeout}, {self._init_time}") await self.hub.observer.async_broadcast(ObserverTypes.KillswitchDead) self._aux_running_grace_timer.reset() elif status_type in [