Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions packages/control/ev/charge_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,12 @@ def scheduled_charging_calc_current(self,
if plan.limit.selected != "soc":
soc_request_interval_offset = 0
log.debug("Verwendeter Plan: "+str(plan.name))
if limit.selected == "soc" and soc >= limit.soc_limit and soc >= limit.soc_scheduled:
if (limit.selected == "soc" and
(soc > limit.soc_limit if (plan.bidi_charging_enabled and bidi_state == BidiState.BIDI_CAPABLE)
else soc >= limit.soc_limit) and
soc >= limit.soc_scheduled):
Comment on lines +553 to +556
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (limit.selected == "soc" and
(soc > limit.soc_limit if (plan.bidi_charging_enabled and bidi_state == BidiState.BIDI_CAPABLE)
else soc >= limit.soc_limit) and
soc >= limit.soc_scheduled):
def is_below(soc: int, soc_limit: int) -> bool:
if plan.bidi_charging_enabled and bidi_state == BidiState.BIDI_CAPABLE:
return soc > soc_limit
else
return soc >= soc_limit
if all(limit.selected == "soc"
soc >= limit.soc_scheduled
is_below(soc, limit.soc_limit)):

message = self.SCHEDULED_CHARGING_REACHED_LIMIT_SOC
elif limit.selected == "soc" and limit.soc_scheduled <= soc < limit.soc_limit:
elif limit.selected == "soc" and limit.soc_scheduled <= soc <= limit.soc_limit:
if plan.bidi_charging_enabled and bidi_state == BidiState.BIDI_CAPABLE:
message = self.SCHEDULED_CHARGING_BIDI
current = min_current
Expand Down Expand Up @@ -634,7 +637,7 @@ def stop(self) -> Tuple[int, str, str]:
return 0, "stop", "Keine Ladung, da der Lademodus Stop aktiv ist."

def bidi_charging_allowed(self, selected_plan: int, soc: float):
# Wenn zu über den Limit-SoC geladen wurde, darf nur noch bidirektional entladen werden.
# Wenn über den Limit-SoC geladen wurde, darf nur noch bidirektional entladen werden.
for plan in self.data.chargemode.scheduled_charging.plans:
if plan.id == selected_plan:
return soc <= plan.limit.soc_limit
return soc < plan.limit.soc_limit
2 changes: 1 addition & 1 deletion packages/helpermodules/setdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def process_chargepoint_get_topics(self, msg):
elif ("/get/evse_current" in msg.topic or
"/get/max_evse_current" in msg.topic):
# AC-EVSE: 0, 6-32, 600-3200, DC-EVSE 0-500
self._validate_value(msg, float, [(0, 3200)])
self._validate_value(msg, float, [(-3200, 3200)])
elif ("/get/version" in msg.topic or
"/get/current_branch" in msg.topic or
"/get/current_commit" in msg.topic):
Expand Down