home-assistant/core · warning · ServiceValidationError
end_time_before_start_time
end_time_before_start_time
Error message
End time ({end_time}) must be after start time ({start_time}) What it means
Validation error raised while building a weekly hot-water schedule from an action call: each time slot must have an end_time strictly after its start_time, compared as datetime.time values. It is a ServiceValidationError with translation key `end_time_before_start_time` and HH:MM placeholders, so the user gets an immediate, non-retrying error in the UI instead of a rejected device write.
Source
Thrown at homeassistant/components/bsblan/services.py:91
becomes: DaySchedule with two TimeSlot objects
None returns None (don't modify this day).
Empty list returns DaySchedule with empty slots (clear this day).
"""
if slots is None:
return None
if not slots:
return DaySchedule(slots=[])
time_slots = []
for slot in slots:
start_time = slot["start_time"]
end_time = slot["end_time"]
# Validate that end time is after start time
if end_time <= start_time:
raise ServiceValidationError(
translation_domain=DOMAIN,
translation_key="end_time_before_start_time",
translation_placeholders={
"start_time": start_time.strftime("%H:%M"),
"end_time": end_time.strftime("%H:%M"),
},
)
time_slots.append(TimeSlot(start=start_time, end=end_time))
LOGGER.debug(
"Created time slot: %s-%s",
start_time.strftime("%H:%M"),
end_time.strftime("%H:%M"),
)
LOGGER.debug("Created DaySchedule with %d slots", len(time_slots))
return DaySchedule(slots=time_slots)
View on GitHub (pinned to 58a3fdb3ea)
Solutions
- Split the overnight window into two slots: 22:00–23:59 and 00:00–06:00.
- Double-check AM/PM in the time picker before submitting.
- Ensure each slot's end time is strictly greater than start; equal times are also rejected.
Example fix
// before (invalid)
slots: [{start_time: "22:00:00", end_time: "06:00:00"}]
// after (valid — split across midnight)
slots: [
{start_time: "22:00:00", end_time: "23:59:00"},
{start_time: "00:00:00", end_time: "06:00:00"},
] Defensive patterns
Strategy: validation
Validate before calling
def slot_is_valid(start: dt.time, end: dt.time) -> bool:
return end > start
assert all(slot_is_valid(s["start_time"], s["end_time"]) for s in slots) Prevention
- Validate slot ordering client-side before calling the action.
- Split overnight windows at midnight instead of wrap-around slots.
- Prefer 24-hour time pickers to avoid AM/PM confusion.
When it happens
Trigger: Calling `bsblan.set_hot_water_schedule` (or a YAML service call) with a slot where `end_time <= start_time`, e.g. start 22:00 end 06:00 intended as an overnight slot — cross-midnight ranges are not supported by this validator.
Common situations: Users modeling overnight heating windows as a single slot; AM/PM mixups in 12-hour input widgets; copying schedules from systems that allow wrap-around slots.
Related errors
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/00153ed667d59bba.
Report an issue: GitHub.