Skip to content

Commit 3cf7a0e

Browse files
committed
Added a MAX_TARGET_SOC constant to limit the required state of charge to 97%.
1 parent dcc9677 commit 3cf7a0e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

source/inverter_charge_controller.py

+7
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717

1818
class InverterChargeController(LoggerMixin):
19+
MAX_TARGET_SOC = 97
20+
1921
def __init__(self):
2022
super().__init__()
2123

@@ -193,6 +195,11 @@ def _do_iteration(self) -> tuple[datetime, bool]: # FIXME: Find better name
193195
self.log.info(
194196
f"Need to charge to {required_state_of_charge} % in order to reach the next minimum with {target_min_state_of_charge} % left"
195197
)
198+
if required_state_of_charge > InverterChargeController.MAX_TARGET_SOC:
199+
self.log.info(
200+
f"The target state of charge is (nearly) 100 %. Setting it to {InverterChargeController.MAX_TARGET_SOC} since charging the battery this full takes hours for the last few percent."
201+
)
202+
required_state_of_charge = InverterChargeController.MAX_TARGET_SOC
196203

197204
energy_bought_before_charging = self.sems_portal_api_handler.get_energy_buy()
198205
timestamp_starting_to_charge = datetime.now(tz=self.timezone)

0 commit comments

Comments
 (0)