Virtual Solar

Table of Contents
A Home Assistant custom integration that simulates a solar panel and battery system from sensors you already own. Point it at an ambient light (lux) sensor and a whole-house power meter, and it produces live estimated output, a virtual battery that charges and discharges over time, and a dashboard you can paste in with one service call. Built to answer “would a balcony solar setup actually be worth it?” before spending any money.
Requires Home Assistant 2024.1.0 or later. Distributed as a HACS custom repository.
Features #
- Lux-to-Watts estimation: solar output computed live from
(lux / 120) × panel_wattage × panel_count × system_efficiency. - Integration-owned virtual battery: a
numberentity that ticks every minute applying(solar − house)capped at the configured charge/discharge rates, clamped to capacity, and survives HA restarts. - Live-editable sliders for panel count, panel wattage, battery capacity, and system efficiency, so you can play “what if I had two panels?” from the dashboard in real time.
- Five derived sensors: estimated output, battery status (Charging / Discharging / Full / Empty with action-over-condition priority), charge rate (signed, with directional icon), percentage, and human-readable time-to-full.
- Profiles: preset configurations for Anker SOLIX SOLARBANK 3 E2700 Pro, EcoFlow DELTA 2, generic 800 W balcony kits, and generic 5 kW rooftop systems. Contributors can add more via a one-block YAML PR.
- Asymmetric charge/discharge rates for kits like the EcoFlow DELTA 2 with separate input and output limits.
- Auto-generated dashboard via the
virtual_solar.get_dashboardservice. Copy the response, paste into a new dashboard’s Raw configuration editor, done. - HACS-installable with full UI configuration, no YAML editing required.

Installation #
HACS (recommended) #
- In HACS → Integrations → menu → Custom repositories.
- Add
https://github.com/virtuallytd/ha-virtual-solarwith category Integration. - Find “Virtual Solar” in the HACS list, install it, restart Home Assistant.
- Settings → Devices & Services → Add Integration, search for “Virtual Solar”.
Manual #
Copy custom_components/virtual_solar/ from the latest release into your Home Assistant config/custom_components/ directory, restart HA, then add the integration via the UI.
Quick Start #
The setup wizard has four steps:
- Profile: pick a preset for a known kit, or “Custom” to fill everything in manually.
- Sensors: choose your lux sensor (
device_class: illuminance) and house power sensor (device_class: power). - Solar panels: initial values for panel count and wattage. Edit live via the dashboard later.
- Virtual battery: capacity (kWh), max charge rate (W), max discharge rate (W), system efficiency (%).
After install, call Developer Tools → Actions → Virtual Solar: Get dashboard YAML, copy the entire response, and paste it into a new dashboard’s Raw configuration editor.
Under the Hood #
Pure Python, no external runtime dependencies. The integration creates one logical device with sensors driven reactively off state changes (no polling), one minute-interval timer for the battery ticker, and a single service that returns a pre-populated Lovelace YAML. State persists across HA restarts via RestoreEntity. Source is around 700 lines of straightforward HA platform code: no clever tricks, contribute-friendly.
Links #
Blog Posts #
License #
MIT.