mirror of
https://github.com/home-assistant/core.git
synced 2026-10-06 22:38:02 -04:00
Fix Teslemetry tariff periods ending on Monday (#183465)
This commit is contained in:
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user