Virtual Battery Controller is a sophisticated Home Assistant integration that transforms your climate-controlled rooms and smart appliances into a unified "Virtual Battery." By leveraging thermal mass and price forecasting, it automatically "charges" your home when energy is cheapest or when solar export is high, and "discharges" when prices peak.
- Dynamic Price Arbitrage: Automatically identifies the cheapest 25% of hours every day using 24-hour price forecasts from ENTSO-E, Enever, or Nord Pool.
- Solar Export Matching: Instantly forces "charging" if your solar panels are exporting more energy than your device's wattage, ensuring no green energy goes to waste.
- Thermal State of Charge (SoC): Provides a real-time percentage sensor showing how "full" your thermal battery is based on room temperature relative to your set limits.
- Unified Device Management: All sensors, binary sensors, and controls are grouped under a single "Virtual Battery" device for a clean, professional dashboard experience.
- Multi-Device Control: Synchronize a climate entity (Airco/Heat Pump) and an unlimited number of smart plugs or relays simultaneously.
- Native Options Menu: Change your target devices, temperature limits, or wattage on the fly without ever restarting Home Assistant.
The integration operates on the principle of Thermal Mass Storage.
The VBC monitors your configured price sensor. It calculates the 25% quantile (the "cheap" threshold) of the daily price data. If the current price is below that threshold, or if your solar panels are exporting enough power to cover the device's wattage, the "Charging" binary sensor flips to ON.
- Heating Mode: When charging, the VBC pushes your thermostat to the Max Temp. When discharging, it drops to the Min Temp.
- Cooling Mode: When charging, it pushes the thermostat to the Min Temp (storing cold). When discharging, it lets it rise to the Max Temp.
- Smart Plugs: Any connected relays or plugs (Boilers, Pool Pumps, EV chargers) are toggled to match the charging state.
The integration logs estimated savings to your Home Assistant logs in real-time, showing you exactly how much money you are saving by shifting your loads to the cheapest hours.
- Open HACS > Integrations.
- Click the three dots in the top right and select Custom repositories.
- Add
https://github.com/DonTranQuiL/virtual-battery-controllerwith Category:Integration. - Click Install.
- Restart Home Assistant.
- Download the
virtual_battery_controllerfolder. - Copy it into your
custom_componentsdirectory. - Restart Home Assistant.
- Go to Settings > Devices & Services.
- Click Add Integration and search for Virtual Battery Controller.
- Follow the UI prompts to select your sensors and set your temperature bounds.
Tip: You can click the Configure gear icon on the integration at any time to update your settings without a restart!
| Entity | Description |
|---|---|
binary_sensor.virtual_battery_arbitrage_charging |
High if energy is cheap or solar is available. |
sensor.virtual_battery_state_of_charge |
0–100% SoC based on thermal storage. |
Contributions are welcome! Whether it's adding support for more price providers or refining the SoC algorithm, feel free to open a PR.
Developed by @Malosaaa
Conventional batteries are expensive and have limited cycles. Your home already has "mass"—walls, floors, and furniture—that holds temperature. By "over-heating" or "over-cooling" your home by just 1 or 2 degrees when energy is free or cheap, you are effectively storing kilowatts of energy for later use, reducing your carbon footprint and your electricity bill simultaneously.