You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cd622f6
Browse filesBrowse the repository at this point in the historyBrowse files
#57 — Solar Surplus had zero behaviour difference between "grid present" and
"grid confirmed lost", so on an islanded hybrid inverter it kept sizing
amperage from PV surplus alone until the inverter tripped an AC over-current
fault. New opt-in number `evsc_offgrid_max_amperage` (default 32 = off) is a
second, stricter ceiling applied ONLY while the optional `grid_available`
sensor reads explicitly off, so full amperage stays available every day the
grid is up. Gated on the fail-safe `is_grid_available()` (None when unmapped or
unavailable), snapped down to a valid amp level, composed with the existing
solar-max cap (stricter wins), plus a hard single-step clamp of a session
already running over the ceiling, evaluated before every other gate.
Entity counts 73/59 -> 74/60.
#59 — The daily file-logging handler is attached to the package logger, but
nothing set that logger's level, so installs with `logger: default: warning`
dropped every EVSC record before it reached the handler: the toggle created the
file and wrote nothing. Enabling file logging now lowers the package logger to
INFO (idempotent, rotation-safe, never narrows an explicit DEBUG) and restores
the previous level on disable. `evsc_log_file_path` exposes
`file_logging_active` and `effective_log_level`.
#58 — The SOC fields were sensor-only selectors, forcing users whose EV exposes
no SOC to wrap an `input_number` in a template sensor. They now accept
sensor/number/input_number; every reader already goes through the
domain-agnostic state_helper.
Full suite green: 359 passed / 0 failed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+126-1Lines changed: 126 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
7
7
This is a **Home Assistant custom integration** for intelligent EV charging control. It manages EV charger automation based on solar production, time of day, battery levels, grid import protection, and intelligent priority balancing between EV and home battery charging.
8
8
9
9
**Domain:**`ev_smart_charger`
10
-
**Current Version:** 2.12.1
10
+
**Current Version:** 2.13.0
11
11
**Installation:** HACS custom repository or manual installation to `custom_components/ev_smart_charger`
Copy file name to clipboardExpand all lines: README.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -434,6 +434,8 @@ The charger switch entity is used as the unique ID for the config entry. Adding
434
434
| EV charging power (v2.2.0) | No |`W`|
435
435
| Grid available (v2.6.0) | No |`binary_sensor`|
436
436
437
+
**EV battery SOC (v2.13.0 — [issue #58](https://github.com/antbald/ha-ev-smart-charger/issues/58)):** the two SOC fields accept a `sensor`, a `number`**or an `input_number`**. EV SOC is architecturally required — the Priority Balancer's daily targets, Night Smart Charge's stop conditions and Boost's target all key off it — but many EVs expose no SOC at all over any Home Assistant integration. Those owners can create an `input_number` helper, map it directly here, and keep it up to date manually or from their own automation. Before v2.13.0 the field was a sensor-only selector, forcing a template-sensor wrapper around the helper.
438
+
437
439
**EV charging power (v2.2.0):** the most reliable signal for whether the car is actually drawing current — when mapped it becomes the single source of truth for charging detection (and the dashboard's green "EV charging" banner), overriding the status string. In three-phase mode map all three per-phase sensors (they are summed) or leave all blank. The sensor must report positive watts while charging; if yours reports negative, wrap it in a template sensor (`{{ states('sensor.your_power') | float(0) | abs }}`) — the diagnostic sensor's `charging_power_w` will read a flat 0 W if the sign is reversed.
438
440
439
441
**Battery power (v2.1.0):** optional signed power sensor for the home battery, used by Hybrid Inverter Mode and Night Smart Charge grid mode to tell real solar headroom apart from the home battery silently covering the EV. **Sign convention: NEGATIVE = discharging, POSITIVE = charging.** If your sensor reports the opposite sign, invert it with a template sensor that negates the value, e.g. `{{ states('sensor.your_battery_power') | float(0) * -1 }}` — the diagnostic sensor's `battery_discharge_w` will read a flat 0 W if the sign is reversed.
@@ -567,6 +569,7 @@ When a day's flag is **ON** and the EV target is not yet reached at sunrise, Nig
567
569
|`evsc_surplus_drop_delay`|`30`|`0–120`| s | How long surplus must be insufficient before stopping the charger. |
568
570
|`evsc_spike_response_delay`|`10`|`0–60`| s | Consumption-spike fast response (v2.8.0): with stable PV, after this many seconds of grid import the charger steps down in one operation to the level that zeroes the import. `0` disables (legacy slow ramp). |
569
571
|`evsc_solar_max_amperage`|`32`|`6–32`| A | Hard ceiling on Solar Surplus amperage. Lower this if your wallbox rejects currents above a certain value (e.g. set to `16` for wallboxes limited to 16 A). |
572
+
|`evsc_offgrid_max_amperage`|`32`|`6–32`| A | Stricter ceiling applied **only while the optional `grid_available` sensor reads off** (hybrid inverter islanded). `32` = disabled. Requires `grid_available` to be mapped; see [Off-grid amperage ceiling](#off-grid-amperage-ceiling). |
570
573
|`evsc_home_battery_min_soc`|`20`|`0–100`| % | Home battery must be above this SOC before battery support activates. |
571
574
|`evsc_battery_support_amperage`|`16`|`6–32`| A | Amperage used when the home battery supplements solar charging. |
572
575
|`evsc_battery_support_sunset_buffer`|`60`|`0–240`| min | Block home battery support when sunset is closer than this. Prevents draining the home battery in the last minutes of fading solar (e.g. plug-in at 18:00 with sunset at 19:15). Set to `0` to disable the guard. |
@@ -761,6 +764,32 @@ Battery support is also blocked when sunset is within `evsc_battery_support_suns
761
764
762
765
`evsc_solar_max_amperage` (default `32 A`) sets a hard ceiling so Solar Surplus never exceeds what your wallbox accepts. Set this to `16` if your wallbox rejects `20 A` or higher commands.
763
766
767
+
#### Off-grid amperage ceiling
768
+
769
+
On a hybrid inverter running **islanded** (grid lost), the real per-phase AC
770
+
output capacity can be far below what abundant PV plus a full home battery
771
+
would otherwise supply. Solar Surplus sizes amperage from surplus alone, so EV
772
+
charging plus house load could exceed the inverter's AC-output protection and
773
+
trip an over-current fault.
774
+
775
+
`evsc_offgrid_max_amperage` (default `32 A` = **off**) is a second, stricter
776
+
ceiling that applies **only** while the optional `grid_available` binary sensor
777
+
reads explicitly `off`:
778
+
779
+
-**Grid present, or the sensor unmapped / `unavailable` / `unknown` → the
780
+
ceiling never applies.** This is deliberate and fail-safe: a boot-time or
781
+
inverter-restart flap can never throttle your charging.
782
+
- Both ceilings run in sequence on the same target, so whichever is stricter
783
+
wins — you keep full amperage every day the grid is up and only give up
784
+
capacity while genuinely islanded.
785
+
- A session already running above the ceiling is clamped **immediately, in one
786
+
step**, before any other gate — protecting the inverter now rather than
787
+
walking down over several minutes.
788
+
789
+
Set it to the highest current your inverter can sustain per phase while
790
+
islanded (e.g. a 12 kW three-phase unit ÷ 3 ≈ 4 kW/phase ≈ 17 A, de-rated in
791
+
practice). Leave it at `32 A` to keep v2.12.x behaviour exactly.
792
+
764
793
---
765
794
766
795
### Priority Balancer
@@ -1210,6 +1239,18 @@ A new file is created automatically at midnight. Previous days are kept indefini
1210
1239
1211
1240
When troubleshooting is complete, disable the toggle to stop writing. Existing log files are preserved.
1212
1241
1242
+
Turning the toggle ON also lowers the integration's own log level to `INFO` for
1243
+
as long as file logging is active, and restores your previous level when you
1244
+
turn it off. Before v2.13.0 an install whose `logger:` block set
1245
+
`default: warning` (or stricter) dropped every EVSC record *before* it reached
1246
+
the file handler, so the daily file was created and then stayed empty. If you
1247
+
need `DEBUG` in the file, set it in the `logger:` block (see below) — the file
1248
+
handler records whatever the logger passes.
1249
+
1250
+
The `evsc_log_file_path` sensor exposes `file_logging_active` and
1251
+
`effective_log_level`as attributes, so an empty log file is diagnosable at a
1252
+
glance.
1253
+
1213
1254
### Trace Logging
1214
1255
1215
1256
Enable `evsc_trace_logging_enabled` for verbose output including every sensor read, every calculation step, and every state transition. Intended for short diagnostic sessions — disable immediately after use to avoid performance impact.
0 commit comments