Fix Teslemetry tariff periods ending on Monday (#183465)

This commit is contained in:
Brett Adams
2026-09-30 13:11:15 +03:00
committed by GitHub
parent c3e16e9ead
commit 49b775fe38
2 changed files with 4 additions and 10 deletions
@@ -65,9 +65,9 @@ def _parse_period_times(
Returns None if the base_day's weekday doesn't match the period's day range.
For periods crossing midnight, end_time will be on the following day.
"""
# DaysOfWeek are from 0-6 (Monday-Sunday)
# DaysOfWeek are from 0-6 (Monday-Sunday); Tesla omits zero values
from_day = period_def.get("fromDayOfWeek", 0)
to_day = period_def.get("toDayOfWeek", 6)
to_day = period_def.get("toDayOfWeek", 0)
if not _is_day_in_range(base_day.weekday(), from_day, to_day):
return None
@@ -123,10 +123,7 @@
"WEEKEND": {
"periods": [
{
"fromDayOfWeek": 4,
"toDayOfWeek": 0,
"fromHour": 0,
"toHour": 0
"fromDayOfWeek": 4
}
]
}
@@ -166,10 +163,7 @@
"WEEKEND": {
"periods": [
{
"fromDayOfWeek": 4,
"toDayOfWeek": 0,
"fromHour": 0,
"toHour": 0
"fromDayOfWeek": 4
}
]
}