From 00575fae59bbf22e4f9936698b0c580226d63115 Mon Sep 17 00:00:00 2001 From: Joshua Leaper Date: Mon, 7 Jul 2025 19:14:23 +0930 Subject: [PATCH 1/2] fix capitalisation --- custom_components/alphaess/button.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/alphaess/button.py b/custom_components/alphaess/button.py index 392ee00..7b1a70e 100644 --- a/custom_components/alphaess/button.py +++ b/custom_components/alphaess/button.py @@ -122,12 +122,12 @@ async def async_press(self) -> None: if self._key == AlphaESSNames.stopcharging: _LOGGER.info("Stopped charging") self._movement_state = None - await self._coordinator.Control_EV(self._serial, self._ev_serial, 0) + await self._coordinator.control_ev(self._serial, self._ev_serial, 0) if self._key == AlphaESSNames.startcharging: _LOGGER.info("started charging") self._movement_state = None - await self._coordinator.Control_EV(self._serial, self._ev_serial, 1) + await self._coordinator.control_ev(self._serial, self._ev_serial, 1) global last_discharge_update global last_charge_update From a3a89f14765f660b7795359699c4b01c91147685 Mon Sep 17 00:00:00 2001 From: Joshua Leaper Date: Tue, 8 Jul 2025 20:56:13 +0930 Subject: [PATCH 2/2] Fix charging/discharge not working --- custom_components/alphaess/coordinator.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/custom_components/alphaess/coordinator.py b/custom_components/alphaess/coordinator.py index fa9a06d..3f2b9ca 100644 --- a/custom_components/alphaess/coordinator.py +++ b/custom_components/alphaess/coordinator.py @@ -66,10 +66,10 @@ async def get_rounded_time() -> str: return rounded_time.strftime("%H:%M") @staticmethod - def calculate_time_window(time_period_minutes: int) -> tuple[str, str]: + async def calculate_time_window(time_period_minutes: int) -> tuple[str, str]: """Calculate start and end time for a given period.""" now = datetime.now() - start_time_str = TimeHelper.get_rounded_time() + start_time_str = await TimeHelper.get_rounded_time() start_time = datetime.strptime(start_time_str, "%H:%M").replace( year=now.year, month=now.month, day=now.day ) @@ -358,7 +358,7 @@ async def _reset_charge_discharge_config( async def update_discharge(self, name: str, serial: str, time_period: int) -> None: """Update discharge configuration for specified time period.""" bat_use_cap = self.hass.data[DOMAIN][serial].get(name) - start_time, end_time = self.time_helper.calculate_time_window(time_period) + start_time, end_time = await self.time_helper.calculate_time_window(time_period) result = await self.api.updateDisChargeConfigInfo( serial, bat_use_cap, 1, end_time, "00:00", start_time, "00:00" @@ -372,7 +372,7 @@ async def update_discharge(self, name: str, serial: str, time_period: int) -> No async def update_charge(self, name: str, serial: str, time_period: int) -> None: """Update charge configuration for specified time period.""" bat_high_cap = self.hass.data[DOMAIN][serial].get(name) - start_time, end_time = self.time_helper.calculate_time_window(time_period) + start_time, end_time = await self.time_helper.calculate_time_window(time_period) result = await self.api.updateChargeConfigInfo( serial, bat_high_cap, 1, end_time, "00:00", start_time, "00:00"