Skip to content

Commit

Permalink
It is possible to have multiple charge schedules active
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet committed Jan 25, 2021
1 parent 9edd6b7 commit bd84a28
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/renault_api/kamereon/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ def validate_charge_schedules(schedules: List[models.ChargeSchedule]) -> None:
for schedule in schedules:
validate_charge_schedule(schedule)

# Is this really forbidden?
# or can multiple schedules be activated as long as there is no overlap?
if sum(1 for schedule in schedules if schedule.activated) > 1:
raise ModelValidationException("Found multiple activated schedules.")


def validate_charge_schedule(schedule: models.ChargeSchedule) -> None:
"""Validate a ChargeSchedule."""
Expand Down Expand Up @@ -136,7 +131,7 @@ def prevent_overlap(
end_time = end_time % MINUTES_PER_DAY
if isinstance(next_start_time, models.ChargeDaySchedule): # pragma: no branch
next_start_time = get_total_minutes(next_start_time.startTime)
if end_time >= next_start_time:
if end_time >= next_start_time: # pragma: no branch
raise ModelValidationException(
f"`{format_time(end_time)}` end time overlaps with next day schedule."
)
Expand Down

0 comments on commit bd84a28

Please sign in to comment.