Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
magnuselden authored and magnuselden committed Aug 29, 2024
1 parent 8355ae6 commit 28142cb
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ async def async_pause_charger(self) -> None:
elif _call_ok or self.model.unsuccessful_stop:
await self.async_call_charger(CallTypes.Pause)
await self.async_internal_state(ChargerStates.Pause, time.time())
else:
self._check_unsuccessful_stop()

async def async_call_charger(self, command: CallTypes) -> None:
try:
Expand Down Expand Up @@ -246,12 +248,17 @@ async def async_internal_state_off(self, call_time: time) -> None:
self.model.running = False
self.model.unsuccessful_stop = False
_LOGGER.debug('Internal charger has been stopped')
elif time.time() - self.model.lastest_call_off > 20:
self.model.unsuccessful_stop = True
self.model.lastest_call_off = time.time()
log_once_per_minute(
f'Fail when trying to stop connected charger. Retrying stop-attempt...', 'warning'
)
else:
self._check_unsuccessful_stop()

def _check_unsuccessful_stop(self):
if time.time() - self.model.lastest_call_off > 20:
if self.model.running:
self.model.unsuccessful_stop = True
self.model.lastest_call_off = time.time()
log_once_per_minute(
f'Fail when trying to stop connected charger. Retrying stop-attempt...', 'warning'
)

async def async_do_update(self, calls_domain, calls_command, calls_params) -> bool:
if self._charger.servicecalls.options.switch_controls_charger:
Expand Down

0 comments on commit 28142cb

Please sign in to comment.