Skip to content

Commit a9f6940

Browse files
Antonio ...claude
andcommitted
fix: EV_FREE priority now allows solar surplus charging when charger is OFF (v0.9.9)
Fixed critical bug where Priority Balancer's EV_FREE mode prevented charger from starting when it was OFF, even with abundant solar surplus available. PROBLEM: - Fresh v0.9.8 installations with Priority Balancer enabled and targets already met - Charger was OFF, priority was EV_FREE, 6000W solar surplus available - Charger never started because EV_FREE logic returned early after checking charger state - Solar surplus logic never executed, wasting available solar energy ROOT CAUSE: In solar_surplus.py lines 479-496, the EV_FREE priority check: 1. Stopped charger if it was ON (correct) 2. Returned early in ALL cases (incorrect) 3. Never allowed fall-through to solar surplus calculation when charger was OFF FIX: Modified solar_surplus.py EV_FREE priority logic: - If charger is ON: stop it and return early (prevents unnecessary charging) - If charger is OFF: log informational message and fall through to solar surplus logic - Solar surplus logic can now start charger if sufficient excess solar available IMPACT: - Maximizes solar energy utilization by charging EV with excess solar even after daily targets met - Fresh installations now work correctly: charger starts automatically with solar surplus - Resolves user-reported issue where 6000W solar surplus was ignored in EV_FREE mode - Users with Priority Balancer enabled will see improved solar energy usage Files Changed: - custom_components/ev_smart_charger/solar_surplus.py (lines 479-503) - custom_components/ev_smart_charger/manifest.json (version 0.9.8 → 0.9.9) - README.md (version + changelog) Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e34a498 commit a9f6940

3 files changed

Lines changed: 33 additions & 3 deletions

File tree

‎README.md‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A Home Assistant integration for intelligent EV charging control based on solar production, time of day, and battery levels.
44

5-
## Current Version: 0.9.8
5+
## Current Version: 0.9.9
66

77
[![GitHub Release](https://img.shields.io/github/v/release/antbald/ha-ev-smart-charger)](https://github.com/antbald/ha-ev-smart-charger/releases)
88
[![hacs_badge](https://img.shields.io/badge/HACS-Custom-orange.svg)](https://github.com/custom-components/hacs)
@@ -729,7 +729,30 @@ Then restart Home Assistant.
729729

730730
## Changelog
731731

732-
### v0.9.8 (2025-10-29) - Current - Critical Automation Conflict Resolution
732+
### v0.9.9 (2025-10-29) - Current - EV_FREE Solar Surplus Charging Fix
733+
- **FIX: EV_FREE priority now allows solar surplus charging when charger is OFF**
734+
- Previously, when Priority Balancer set priority to EV_FREE (both EV and home battery targets met), the automation would stop charging if charger was ON and then exit early
735+
- This prevented the charger from starting when it was OFF, even with abundant solar surplus available
736+
- Now, when charger is OFF in EV_FREE mode, the solar surplus logic continues to evaluate whether to start charging
737+
- Allows excess solar energy to charge EV even after daily targets are met (maximizing solar usage)
738+
- Fixed fresh installation scenario where charger was OFF, targets met, but 6000W solar surplus was not being used
739+
740+
- **Technical Details:**
741+
- Modified `solar_surplus.py` EV_FREE priority check (lines 479-503)
742+
- Added else clause to allow fall-through when charger is OFF
743+
- Only returns early (exits automation) when charger is ON and successfully stopped
744+
- When charger is OFF, logs informational message and continues to solar surplus calculation logic
745+
746+
- **Impact:**
747+
- Users with Priority Balancer enabled will now see charger start automatically with solar surplus, even after daily targets met
748+
- Maximizes solar energy utilization by using excess production
749+
- Resolves reported issue where fresh v0.9.8 installation wasn't starting charger despite 6000W available solar
750+
751+
- **Files Modified:**
752+
- `solar_surplus.py` - EV_FREE priority logic
753+
- `manifest.json` - Version 0.9.9
754+
755+
### v0.9.8 (2025-10-29) - Critical Automation Conflict Resolution
733756
- **NEW: Automation Coordinator system with priority-based control**
734757
- Centralized coordinator prevents conflicts between automations
735758
- Priority hierarchy: Override (1) > Smart Blocker (2) > Night Charge (3) > Priority Balancer (4) > Solar Surplus (5)

‎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": "0.9.8",
4+
"version": "0.9.9",
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/solar_surplus.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ async def _async_periodic_check(self, now=None) -> None:
477477
return
478478

479479
# If priority is EV_FREE (both targets met), stop charging if running
480+
# But allow solar surplus logic to continue if charger is OFF (may start charging with excess solar)
480481
if priority == PRIORITY_EV_FREE:
481482
charger_state = self.hass.states.get(self._charger_switch)
482483
if charger_state and charger_state.state == "on":
@@ -494,6 +495,12 @@ async def _async_periodic_check(self, now=None) -> None:
494495
_LOGGER.info(" ✅ EV charger STOPPED (targets maintained)")
495496
_LOGGER.info("=" * 80)
496497
return
498+
else:
499+
# Charger is OFF - allow solar surplus logic to potentially start it
500+
_LOGGER.info(f"✅ [Priority Balancer] Priority = EV_FREE (targets met)")
501+
_LOGGER.info(f" Charger is OFF - will check solar surplus to potentially start charging")
502+
_LOGGER.info(f" EV: {priority_attrs.get('current_ev_soc', 'N/A')}% >= {priority_attrs.get('target_ev_soc', 'N/A')}%")
503+
_LOGGER.info(f" Home: {priority_attrs.get('current_home_soc', 'N/A')}% >= {priority_attrs.get('target_home_soc', 'N/A')}%")
497504

498505
# Get all sensor and configuration values
499506
fv_state = self.hass.states.get(self._fv_production)

0 commit comments

Comments
 (0)