Skip to content

About

Home Assistant solar charger uses surplus solar to charge your EV and home. ☀️

Topics

Resources

Stars

21 stars

Watchers

1 watching

Forks

Repository files navigation

SolarCharger SolarCharger for Home Assistant

Stable HACS Badge Project Maintenance GitHub Activity License Status

Stop selling your sunshine to the grid for cents. Heat your water and charge your car with it instead. ☀️🚿🚗

EV and hot water are often the two biggest electricity users in a home, and both are perfect for soaking up surplus solar. SolarCharger watches how much power your home is exporting to or importing from the grid, and shares the surplus between them in the order you choose. For example, it can heat the hot water tank first and then send whatever's left to the car. When clouds roll in, it throttles back or pauses. When the sun returns, it picks up again. Need the car full by 7am tomorrow? It can plan for that too, topping up from the grid only as much as it has to.

It works with Tesla, OCPP chargers and a growing list of other EVs, hot water systems, and with anything else you can switch on and off, like heaters.

Quick start · Hot water first · Features · Supported integrations · Installation · Wiki

How it works

%%{init: {"flowchart": {"diagramPadding": 150}}}%%
flowchart LR
  Sun["☀️ Solar panels"] --> Net["Net power sensor<br/>(− export / + import)"]
  Net --> Alloc["SolarCharger<br/>shares surplus by priority"]
  Alloc -->|"1st priority"| HW["🚿 Hot water system"]
  Alloc -->|"2nd: whatever is left"| Car["🚗 EV"]
  Alloc -.->|"more devices"| Other["🔌 Other loads"]
Loading

A single "Net power" sensor is the feedback loop. Negative watts means you're exporting, so SolarCharger hands out more power. Positive watts means you're importing, so it pulls power back, starting with the lowest-priority device. If there isn't enough surplus for a device over the whole power monitor duration, that device is paused until there is.

🚿 Hot water first, car second

A resistive hot water element can draw around 3.6 kW. Heating water is one of the cheapest ways to store your own solar: a hot tank is a battery you already own.

Here's how SolarCharger handles it when the hot water system has the higher priority:

  1. Morning: once surplus solar is big enough to run the element, the hot water system gets it first.
  2. Spare power goes to the car. Anything left over, beyond what the element draws, goes to the EV, whose charge current is adjusted up and down to match.
  3. Tank is hot: when the thermostat switches the element off, SolarCharger stops reserving power for it and the car gets the full surplus.
  4. Clouds: the car is throttled back first, so the hot water keeps heating for as long as possible.

Because a hot water element can only be switched on or off, not throttled, it only turns on when there's enough surplus to run it at full power.

What you need:

  • An on/off switch for the element, e.g. a smart relay or contactor.
  • A current sensor that measures the element's actual current draw in amps, e.g. from an energy-monitoring relay or a clamp meter. This is how SolarCharger knows whether the thermostat has switched the element off, so it can pass that power on to the car.

Setup: add the hot water system with Add custom device. Select the switch, and select the current sensor as "Charger get charge current (AMP)". Then give it a higher priority than the car. See priority and weighting.

Allocation and control

Follow the sun

Quick start

  1. Install SolarCharger via HACS (details) and restart Home Assistant.
  2. Create a "Net power" sensor that reads negative when exporting and positive when importing (example).
  3. Add the integration: Settings > Devices & services > Add integration > "SolarCharger", then click Add charger device.
  4. Set two values: charger effective voltage and maximum current (where).
  5. Plug in the car. That's it. SolarCharger takes over within about a minute.

Features

☀️ Solar tracking

  • Charge on surplus solar only. Charge current follows your "Net power" sensor up and down throughout the day.
  • Charge across multiple days. Sun elevation triggers start and stop charging automatically, morning and evening.
  • Smart pause and resume. Power monitor duration decides when there's too little sun. The charger is switched off while paused.
  • Match your charger's steps. Configurable step current for chargers that only accept certain amp values.
  • Cap your supply. Power source support - draw up to a set power offset from a home battery when solar falls short, including at night.

📅 Scheduling

🚿🚗 Hot water, cars and other loads

  • Hot water first. Run your hot water system on surplus solar, ahead of the car or after it: you choose the order.
  • Share the sun. Power multiple cars and other loads at the same time. Higher-priority devices are served first, and devices with equal priority split the surplus by weighting.
  • On/off devices welcome. Devices that can't adjust their current, like hot water elements and heaters, are switched on only when there's enough surplus to run them. A current sensor tells SolarCharger what they're actually drawing.

🔌 Hardware support

  • Car API, charger, or both. Control the EV through its own API, and/or drive an OCPP-compliant charger. OCPP has been tested with the OCPP simulator. OCPP and Tesla Fleet API support are in beta.
  • Wake up and find the car. Ping (ICMP) detects the car and keeps refreshing Home Assistant for up to 15 minutes until it's connected.
  • Bring your own device. Configurable return codes map your car's or charger's states to SolarCharger's connect, connected and charging stages.

🎛️ You stay in control

🗺️ Roadmap

  • Charge more before the rain. Automatically raise to the highest charge limit set within a rainy forecast period, taking the bad-weather charge limit setting into account. Disabled by default.
  • Gentler on your battery. Keep a daily limit of 60% and only charge higher before a rainy period, which may prolong battery life.
  • Fine-tune the curve. Skew the export/import curve left or right to minimise grid import.

Supported integrations

Chargers from these integrations are pre-configured, so you can add them with the Add charger device button.

Integration Status Charge current adjusted by
Tesla Custom Integration v3.20.4+ * ✅ Used by the author Car
Tesla BLE MQTT docker (local, Bluetooth) 👥 Community tested Car
ESPHome Tesla BLE v2026.2.1+ (local, Bluetooth) 👥 Community tested Car
OCPP (local) 👥 Community tested Charger
Tesla Fleet * 👥 Community tested Car
Tessie * 👥 Community tested Car
Teslemetry * 🧪 Beta Car
MySkoda 🧪 Beta Charger only
BYD vehicle 🧪 Beta Charger only
GWM Ora 🧪 Beta Charger only
Hyundai Kia Connect 🧪 Beta Charger only
Geely Connect 🧪 Beta Charger only
Volvo 🧪 Beta Charger only
MG SAIC 🧪 Beta Charger only

* API requires a paid subscription in most countries. See charger current update period for how API polling interval affects control.

I only use the Tesla Custom Integration myself, so the others have been tested by users. Please ask in GitHub discussions if you get stuck.

Car can't adjust its own current? See the work-around.

Integration not listed? Use Add custom device and pick your own control entities. An on/off switch is the minimum: Settings > Devices & services > SolarCharger > Settings (cog wheel) > Select your custom device > Select your charge control entities > Submit

Got it working? Please add your setup to the poll and config threads to help the next person. Thanks!

Tested with (author's setup)

  • Home Assistant
  • Enphase Envoy with a 20-second update interval
  • Tesla Custom Integration, controlling the car via the Tesla cloud
  • Tesla UMC charger, 230V, max 15A
  • Tesla Model 3
  • Hot water system with a resistive element (about 3.6 kW, 15A), switched on and off by SolarCharger via contactor with higher priority than the car, and a sensor reading its current draw

Installation

Install via HACS (recommended)

The Home Assistant Community Store (HACS) gives you a UI to manage custom integrations like SolarCharger. Install and configure HACS first, then:

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

  1. Go to HACS > Integrations in Home Assistant.
  2. Search for and install the SolarCharger integration.
  3. Restart Home Assistant.

Manual install

  1. Copy the solarcharger directory to your Home Assistant machine:
    From:  <Your git clone directory>\SolarCharger\custom_components\solarcharger
    To:    \\homeassistant.local\config\custom_components\solarcharger
    
  2. Restart Home Assistant.

Configuration

  1. Add the integration: Settings > Devices & services > Add integration > search for "SolarCharger".

  2. Create a net power sensor. It must read negative watts when exporting to the grid and positive watts when importing. Enphase already works this way. For other inverter brands, adjust the template so it matches. Example for Enphase:

    Settings > Devices & services > Helpers > Create helper > Template > Template a sensor >
    
    Name: Net power
    State template: {{ states('sensor.envoy_[YourEnvoyId]_current_net_power_consumption')|int }}
    Unit of measurement: W
    Device class: Power
    State class: Measurement
    Device: Envoy [YourEnvoyId]
    
  3. Add a charger device, e.g. Tesla, OCPP, etc.

  4. Set these after adding the charger:

    Where Setting
    SolarCharger > Global defaults > Configuration Charger effective voltage
    SolarCharger > Local device > Configuration Maximum current

    See required configs after installation for more.

BLE and OCPP users: see the matching section in the FAQ for a few extra steps.

How to use

Set your car's charge limit and plug in. Normal constant-current charging starts immediately (unless schedule charging is enabled), and SolarCharger takes over shortly after to manage the current during daylight hours. If nothing happens, see automation cannot be triggered.

Then pick a mode:

☀️ Solar only (default)

Just plug in. Charging starts at 6A, and after about a minute the current adjusts to match how much power you're exporting to the grid.

⚡ Fast charge

Toggle on "Fast charge mode" to charge at full speed from solar plus your secondary power source.

Charging stops when the car reaches its charge limit or the charger is turned off. To abort, toggle off the "Charge" switch.

There's much more in the wiki.

Support the project

If SolarCharger saves you money, please ⭐ the repo, and maybe buy me a coffee!

ko-fi

Disclaimer

This custom integration has been created with care, but the author cannot be held responsible for any damage it causes. Use at your own risk.

About

Home Assistant solar charger uses surplus solar to charge your EV and home. ☀️

Topics

Resources

Stars

21 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages