Intelligent solar energy orchestration for Home Assistant — maximize self-consumption, manage EV charging, and track energy costs automatically.
SEM monitors your solar production, battery, grid, and EV charger every 10 seconds and distributes surplus power across your devices by priority. No cloud, no subscription — everything runs locally inside Home Assistant.
- Smart EV charging — dynamic 6-32A current control based on real-time solar surplus
- Three charging modes — pure solar, Min+PV (guaranteed minimum + solar top-up), overnight grid charging
- Battery-aware — four-zone SOC strategy decides when battery helps the EV and when it charges first
- Night charging with battery protection — charges EV from grid overnight without draining home battery
- Multi-device surplus distribution — EV, heat pump, hot water, appliances — each gets surplus by priority
- Peak load management — automatic device shedding to stay under your grid limit
- Solar forecast integration — Solcast or Forecast.Solar for smart charging decisions
- Dynamic tariff support — Tibber, Nordpool, aWATTar price-responsive charging
- 70+ sensors — power, energy, flows, costs, performance, forecasts, and more
- Built-in dashboard — glassmorphism dark theme with animated system diagram, Sankey, and native HA energy cards
- PV performance analytics — specific yield, forecast accuracy, degradation tracking
- Smart recommendations — forecast-aware tips ("Best window for appliances: 11:00-14:00", "Low solar tomorrow — charge EV tonight")
- Consumption/solar predictor — learns hourly patterns (weekday/weekend), predicts next-hour power and daily consumption
- Push notifications — battery full, daily summary, forecast alerts, EV charging events (with Android channels and action buttons)
- Brand icons — native HA 2026.3+ brand support (no submission to home-assistant/brands needed)
New to custom integrations? See the Step-by-Step Setup Guide for a beginner-friendly walkthrough with checklist and FAQ.
- Open HACS > Integrations > Custom repositories
- Add
https://github.com/traktore-org/sem-communityas an Integration - Search for Solar Energy Management and click Download
- Restart Home Assistant
- Download the latest release
- Copy the
custom_components/solar_energy_management/folder to your Home Assistantconfig/custom_components/directory - Restart Home Assistant
Before setting up SEM, make sure you have:
- Home Assistant 2024.1.0 or newer
- Energy Dashboard configured — SEM reads your solar and grid sensors from the HA Energy Dashboard (Settings > Energy). You need at least:
- A solar production sensor (W)
- A grid consumption sensor (W)
- Optional but recommended:
- Battery SOC (%) and power (W) sensors
- An EV charger controllable via HA (KEBA, Wallbox, go-eCharger, Easee, etc.)
- Solcast PV Solar or Forecast.Solar for solar forecasts
- Tibber, Nordpool, or aWATTar integration for dynamic tariffs
- Go to Settings > Devices & Services > Add Integration
- Search for Solar Energy Management
- Follow the setup wizard
SEM auto-detects your solar, grid, and battery sensors from the HA Energy Dashboard. If they are not configured yet, the wizard will ask you to set up the Energy Dashboard first.
SEM also uses the Energy Dashboard's import/export energy counters to automatically detect your grid power sensor's sign convention — no manual configuration needed. This works with all inverter brands (Huawei, SolarEdge, Fronius, etc.).
Select the sensors for your EV charger:
| Setting | Description |
|---|---|
| Connected sensor | Binary sensor showing if the EV is plugged in |
| Charging sensor | Binary sensor showing if charging is active |
| Charging power sensor | Power sensor (W) for current charging power |
| Charger service | Service to set charging current (e.g., keba.set_current) |
| Total energy sensor | Cumulative energy sensor (kWh) — optional |
SEM supports any charger that exposes these sensors in HA: KEBA, Wallbox Pulsar, go-eCharger, Easee, Tesla Wall Connector, Zaptec, OpenWB, Myenergi Zappi, ChargePoint, Heidelberg.
- KEBA display messages — show charging status on the charger's built-in display
- Mobile notifications — push notifications via HA Companion App
Key settings you can adjust (all have sensible defaults):
| Setting | Default | Description |
|---|---|---|
| Update interval | 10s | How often SEM reads sensors and adjusts |
| Daily EV target | 10 kWh | How much energy to charge overnight |
| Battery priority SOC | 30% | Below this, all solar goes to battery first |
| Battery buffer SOC | 70% | Above this, battery can help charge the EV |
| Battery auto-start SOC | 90% | Above this, EV starts even without solar surplus |
| Min solar power | 500W | Minimum surplus before solar EV charging starts |
| Observer mode | Off | Read-only mode for test systems (no hardware control) |
For detailed explanations of all settings, see the User Guide.
Enable peak load management if your utility bills based on peak demand:
| Setting | Default | Description |
|---|---|---|
| Target peak limit | 5 kW | SEM sheds loads above this threshold |
| Warning level | — | Early warning threshold |
| Emergency level | — | All non-critical loads shed |
SEM is designed to be mostly automatic. There are only 3 switches to manage:
| Switch | Default | What it does |
|---|---|---|
switch.sem_night_charging |
ON | Enable/disable overnight grid charging |
switch.sem_observer_mode |
OFF | Read-only mode — SEM monitors but doesn't control hardware |
switch.sem_forecast_night_reduction |
OFF | Reduce night charging target based on tomorrow's solar forecast |
Everything else — solar charging, surplus distribution, battery protection, peak management — is fully automatic.
During the day, SEM dynamically adjusts the EV charging current (6-32A) to match real-time solar surplus. If surplus drops below the minimum threshold, charging pauses until surplus returns. The battery's SOC determines how aggressively SEM uses stored energy to help the EV (see User Guide — SOC Zones).
Guarantees a minimum charging current (6A) from the grid and adds solar surplus on top. Use this when you need the car charged by a deadline but still want to maximize solar usage.
Set via integration options: ev_charging_mode = "minpv".
Overnight grid charging starts automatically after sunset. SEM charges at a peak-managed rate to avoid demand spikes and stops when the daily EV target is reached. Battery discharge protection prevents the home battery from powering the EV overnight.
Enable/disable with switch.sem_night_charging.
When the battery SOC is above the buffer threshold (default 70%), SEM supplements solar with battery power to maintain EV charging during cloudy moments. This is automatic — no switch needed.
SEM includes a built-in dashboard with 7 views and a unified glassmorphism dark theme:
| View | Description |
|---|---|
| Home | Animated system diagram with device nodes, solar summary card, 7-day chart, weather, smart recommendations |
| Energy | Sankey diagram, self-consumption/autarky gauges, donut chart, 24h power, CO2 avoided, trees saved |
| Battery | SOC radial gauge, 24h charge/discharge chart, zone configuration |
| EV | Charging status, session stats, solar share gauge, lifetime totals |
| Control | Load priority drag-and-drop, surplus allocation, battery/EV/tariff settings |
| Costs | Today/month/year KPIs, period selector, cost & savings charts, demand charge, tariff rates |
| System | Health diagnostics, sensor status, charging state, peak management |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
- Glassmorphism styling — frosted glass cards with dot grid backgrounds, radial gradients, hover effects
- Animated energy flow — sem-flow-card with real-time power flows, daily energy totals, autarky gauge, config editor, tap/hold/double-tap actions
- Custom SEM cards — flow card, solar summary (glow ring), weather (clock + forecast), chart card (Chart.js), period selector
- Drag-and-drop load priority — reorder device shedding priorities visually
- Environmental impact — CO2 avoided and trees-equivalent with growing icon (sprout/tree/pine/forest)
- Yearly KPIs — year-to-date costs, savings, revenue on the Costs tab (auto-seeded from HA recorder on mid-year install)
For dashboard setup instructions, see the Dashboard Guide.
SEM creates 60+ sensors organized by category:
| Category | Examples |
|---|---|
| Power | Solar, grid, battery, EV, home consumption (W) |
| Energy | Daily/monthly totals for all sources (kWh) |
| Flows | Solar-to-home, solar-to-EV, grid-to-EV, battery-to-home (W and kWh) |
| Costs | Daily/monthly import costs, export revenue, savings |
| Performance | Self-consumption rate, autarky rate, solar efficiency (%) |
| Charging | State, strategy, available power, calculated current |
| Surplus | Total, distributable, allocated, active devices |
| Forecast | Today/tomorrow kWh, remaining today, peak time, next hour, surplus window |
| Tariff | Current import/export rate, price level, next cheap window |
| PV Analytics | Specific yield, forecast accuracy, degradation trend |
| Smart Tips | Optimization score, forecast-aware recommendations, best surplus window |
| Load Mgmt | Peak margin, 15-min average, devices shed, trend |
| Notifications | Battery full, high grid import, daily summary, forecast alerts |
Solar Inverters: Huawei Solar, SolAX, DEYE, Sunsynk, SolArk, Growatt, Sofar, Solis, KSTAR, Fronius, SMA, SolarEdge, Enphase, or any inverter with HA sensors
Battery discharge control auto-detected for: Huawei Solar, SolAX (solax-modbus), DEYE/Sunsynk (ha-solarman), Growatt, Sofar, Solis
Batteries: Huawei LUNA2000, Tesla Powerwall, LG Chem, BYD, Sonnen
EV Chargers: KEBA P30, Wallbox Pulsar, go-eCharger, Easee, Tesla Wall Connector, Zaptec, OpenWB, Myenergi Zappi, ChargePoint, Heidelberg
Heat Pumps: Any SG-Ready compatible heat pump controllable via HA
Smart Meters: Shelly EM/Pro, Discovergy, or any HA-compatible meter
automation:
- alias: "SEM: Daily solar target reached"
trigger:
- platform: numeric_state
entity_id: sensor.sem_daily_solar_energy
above: 30 # kWh
action:
- service: notify.mobile_app
data:
title: "Solar Target Reached"
message: >
Daily solar production exceeded 30 kWh
({{ states('sensor.sem_daily_solar_energy') }} kWh)automation:
- alias: "SEM: Cheap price EV charging"
trigger:
- platform: state
entity_id: sensor.sem_tariff_price_level
to: "cheap"
condition:
- condition: state
entity_id: binary_sensor.sem_ev_connected
state: "on"
action:
- service: switch.turn_on
target:
entity_id: switch.sem_night_chargingautomation:
- alias: "SEM: Peak alert"
trigger:
- platform: numeric_state
entity_id: sensor.sem_peak_margin
below: 0.5 # kW remaining before target
action:
- service: notify.mobile_app
data:
title: "Peak Protection"
message: >
Grid peak approaching limit
({{ states('sensor.sem_peak_margin') }} kW margin)Maximize solar self-consumption for EV charging — Plug in during the day and SEM adjusts current to match surplus. Battery priority ensures the home battery charges first, then the EV gets the rest.
Reduce peak load charges — SEM monitors rolling 15-minute averages and sheds non-critical loads to stay under your target peak limit.
Battery-assisted EV charging on cloudy days — When forecast shows insufficient production but battery SOC is above the buffer, SEM supplements solar with battery discharge.
Price-optimized night charging — With dynamic tariff integration, SEM charges the EV during the cheapest overnight hours while protecting the home battery.
| Guide | Description |
|---|---|
| Quick Start | 5-minute setup guide |
| User Guide | Complete feature reference |
| Dashboard Guide | Dashboard setup & customization |
| Architecture | Developer documentation |
| Troubleshooting | Common issues & fixes |
| Known Limitations | Platform constraints |
- Go to Settings > Devices & Services > Solar Energy Management
- Click the three-dot menu and select Delete
- Restart Home Assistant
- If installed via HACS: open HACS > Integrations, find SEM, click Remove
- If installed manually: delete the
custom_components/solar_energy_management/directory
All SEM entities are removed automatically. Your Energy Dashboard and hardware sensors are not affected.
- Lumina tab headers on all 7 tabs — SVG glow icons, live stats, dot-grid background
- Battery hero card — SOC arc ring with charge/discharge pulse animation, health metrics
- EV status card — three visual states (disconnected/connected/charging) with animated lightning bolt
- Section title styling — transparent backgrounds with gradient divider lines
- Consistent precision — kWh=1dp, W=0dp, CHF=2dp across all dashboard values
- Card JS files auto-installed to
/config/www/on every restart (if dashboard exists) - No more manual
generate_dashboardcall needed after HACS updates - Self-healing: recreates card directory if deleted
- Every device has a control mode:
off,peak_only(default),surplus - SEM never turns on devices unless explicitly set to
surplusmode - Mode selector dropdown on Control tab, persists across restarts
- User-defined HT/NT time windows with Swiss provider presets (EKZ, BKW, CKW, ewz)
- Schedule dashboard card showing 24h timeline (tariff, night, surplus, EV)
- Cached forecast source detection and surplus window estimation — reduced CPU overhead per update cycle
- Dashboard cards: debounced flow updates (100ms), reduced DOM thrashing with incremental updates
- Exponential backoff for EV device retry (replaces linear 30-retry loop)
- Error recovery for battery protection — resets state on service call failure instead of leaving stale limits
- Storage validation on restore — detects corrupted data before it propagates to sensors
- Migration rollback safety — keeps original config intact on migration failure
- Narrowed exception handling throughout coordinator (specific types instead of bare
except Exception) - Fixed availability logging spam in binary sensors and sensors
- Config flow validates entity IDs exist before accepting
- Notification flap suppression — solar charging states must be stable 60s before notifying
- KEBA service validated once on startup (no repeated exception noise if not installed)
- Dashboard cards show entity availability indicator when sensors are unavailable
- Shared color palette and power formatting utilities across all dashboard cards
- Dashboard cards: ARIA labels, role attributes, keyboard-friendly button semantics
- Coordinator update method reduced from ~440 to ~260 lines (analytics and notifications extracted)
- Hardcoded entity IDs replaced with named constants
- Shared JS constants (sem-shared.js) for color palette and formatters
- Load management: preserves user-set device priorities across discovery cycles
Contributions are welcome! Please fork the repository, create a feature branch, and submit a pull request.
MIT License — see LICENSE for details.








