Simulating a Solar Panel & Battery in Home Assistant Before Buying One · VirtuallyTD↓Skip to main content<br>Table of Contents
I’ve been thinking about installing a balcony solar panel and battery storage system at home. Before spending the money, I wanted to answer a simple question: given my actual house’s light levels and electricity consumption, would it be worth it?<br>Rather than guessing, I built a simulation directly in Home Assistant using sensors I already had. It started as a pile of template sensors, helpers and a 5-minute automation. Eventually I packaged the whole thing into a custom integration: ha-virtual-solar . Install it from HACS, point it at two sensors, and you get a live dashboard estimating solar output and a virtual battery charging and discharging in real time.<br>Why I Built It #<br>Balcony solar in Germany has become genuinely attractive in the last couple of years. The legal cap on plug-in inverter output has risen to 800 W, panels keep getting cheaper, and a complete kit with a small battery now lands somewhere in the €700-€1,500 range. That’s no longer a small spend for “let’s see what happens”, but it’s not enough that anyone is going to hand-design a system around your specific apartment.<br>The vendor calculators all give you average numbers for “Berlin” or “Munich”. Useful, but my balcony faces a specific direction, has a specific amount of obscuration from the building opposite, and my household’s evening cooking and washing consumption pattern looks nothing like the textbook curve. The difference between “this pays back in 4 years” and “this never pays back” can hinge on whether the battery fills up on an average Tuesday in March.<br>The thing I already had in Home Assistant: a Zigbee lux sensor mounted outdoors on a windowsill, and a smart meter reporting instantaneous household power draw. That’s exactly the two inputs you need to roughly estimate what a panel + battery would do at my house, every minute, all year round, with real data.<br>The hack version was straightforward: a template sensor turning lux into estimated W, an input_number helper acting as a virtual battery level, and a 5 minute automation nudging the helper up or down by (solar − house consumption). It worked. But it kept growing. Battery percentage, charge rate, time to full, panel configuration helpers, status logic, a dashboard. By the time I’d added the seventh template sensor, it was easier to package the whole thing as a proper integration than to maintain a sprawl of YAML.<br>That’s ha-virtual-solar. The rest of this post is how to set it up and what it does.<br>The Hardware I’m Considering #<br>Solar panels : configurable from 1 to 20 panels, 100 to 800 W each. The Anker supports up to 4 panels across its MPPT inputs (3,600 W total), but the integration ships profiles for other kits too.<br>Battery : Anker SOLIX Solarbank 3 E2700 Pro (2.68 kWh capacity, 1200 W max charge/discharge rate). The integration also has profiles for the EcoFlow DELTA 2, generic 800 W balcony kits, and 5 kW residential rooftops.<br>The goal isn’t pinpoint accuracy. It just needs to be realistic enough to answer: on a typical day, would the battery fill up? Would it cover my evening consumption?<br>Sensors Used #<br>SensorWhat it providessensor.sensor_light_illuminanceAmbient light in lux (Zigbee sensor via Zigbee2MQTT)sensor.esphome_glow_power_consumptionReal-time household power draw in Watts (Hildebrand Glow smart meter IHD via ESPHome)Any pair of sensors with device_class: illuminance and device_class: power will work. Sensor placement matters more than anything else: an indoor lux sensor will dramatically understate output. The Zigbee sensor I’m using is mounted outdoors, unobstructed, at roughly the same angle the panel would be.<br>The Theory: Lux to Watts #<br>Sunlight has a well-known relationship between illuminance (lux) and irradiance (W/m²):<br>1 W/m² ≈ 120 lux for sunlight
Solar panels are rated at Standard Test Conditions (STC) of 1000 W/m². The general formula for any number of panels:<br>estimated_watts = (lux / 120) × ((panel_wattage × panel_count) / 1000) × system_efficiency<br>system_efficiency is a single multiplier that wraps inverter losses, wiring losses, and thermal derating into one value (defaults to 95 %).<br>Some example values to calibrate expectations (1× 500 W panel at 95 % efficiency):<br>ConditionLuxEstimated OutputOvercast1,000 lx~4 WPartly cloudy20,000 lx~79 WBright sun80,000 lx~317 WFull sun100,000 lx~396 WCaveat : Accuracy depends heavily on sensor placement. Ideally the light sensor should be outdoors, unobstructed, and angled the same way as the panel. Expect ±20 % in practice.
Installing the Integration #<br>ha-virtual-solar is distributed via HACS as a custom repository. You need HACS already installed; if you don’t have it yet, the HACS install guide takes about five minutes.<br>Open HACS in the Home...