Skip to content

Commit 404bdce

Browse files
Antonio ...claude
andcommitted
fix: CRITICAL - Night Smart Charge time window validation (v1.4.1)
Fixed critical bug causing Night Smart Charge to start at incorrect times (e.g., 19:50) instead of waiting for configured time (e.g., 01:00). Problem: - Night Charge started at any time after configured hour on same day - Example: At 19:50, system checked "19:50 >= 01:00 TODAY" = TRUE - This caused immediate charging activation outside intended window Root Cause: - Line 336 used time_string_to_datetime() which returns time on current day - This didn't account for times that have already passed today Solution: - Changed to time_string_to_next_occurrence() which correctly handles: * If time passed today → returns tomorrow's occurrence * If time not passed → returns today's occurrence Changes: - night_smart_charge.py:336 - Use time_string_to_next_occurrence() - const.py - VERSION = "1.4.1" - manifest.json - version = "1.4.1" Impact: ✅ Night Charge now starts only at configured time ✅ No premature charging after sunset ✅ Reliable overnight scheduling 🔴 CRITICAL FIX - Makes Night Smart Charge reliable for scheduling 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1a34a7c commit 404bdce

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

custom_components/ev_smart_charger/const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# ========== INTEGRATION METADATA ==========
44
DOMAIN = "ev_smart_charger"
5-
VERSION = "1.4.0"
5+
VERSION = "1.4.1"
66
DEFAULT_NAME = "EV Smart Charger"
77

88
# ========== PLATFORMS ==========

custom_components/ev_smart_charger/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"domain": "ev_smart_charger",
33
"name": "EV Smart Charger",
4-
"version": "1.4.0",
4+
"version": "1.4.1",
55
"documentation": "https://github.com/antbald/ha-ev-smart-charger",
66
"issue_tracker": "https://github.com/antbald/ha-ev-smart-charger/issues",
77
"codeowners": ["@antbald"],

custom_components/ev_smart_charger/night_smart_charge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ async def _is_in_active_window(self, now: datetime) -> bool:
333333

334334
# Parse time string using TimeParsingService
335335
try:
336-
scheduled_time = TimeParsingService.time_string_to_datetime(time_state, now)
336+
scheduled_time = TimeParsingService.time_string_to_next_occurrence(time_state, now)
337337
except (ValueError, TypeError, IndexError) as e:
338338
self.logger.error(f"Invalid time configuration: {time_state} - {e}")
339339
return False

0 commit comments

Comments
 (0)