🔋 [Share] Virtual Battery for Home Assistant (YAML-based, fully functional)

Hi everyone :waving_hand:

I’d like to share a personal project I’ve been using daily:
a virtual battery system built entirely within Home Assistant , using only YAML.

:france: Small disclaimer: I’m French, and this post has been “assisted” by a translation tool… so if something sounds slightly odd, please blame the baguette, not the concept :baguette_bread::grinning_face_with_smiling_eyes:


:high_voltage: Goal

The idea is to simulate a virtual energy storage system based on real data:

  • track energy flows
  • simulate charge / discharge behavior
  • compute realistic energy costs

All with full transparency and no dependency on external services.


:brain: How it works

The project relies only on native Home Assistant features:

  • integration (Riemann) for power → energy conversion
  • template sensors for all logic
  • utility_meter for energy tracking
  • recorder + SQL for drift correction

:backhand_index_pointing_right: It also requires HA Linky as the main data source for consumption.
:backhand_index_pointing_right: The project can work with other data sources, but it is currently designed and validated with HA Linky.


:bar_chart: What it provides

  • A realistic virtual battery level
  • Energy cost estimation aligned with real usage
  • Ability to compare with virtual storage providers
  • Better understanding of self-consumption

:chart_decreasing: About drift

One of the main challenges with this kind of system is measurement drift.

:backhand_index_pointing_right: In this project, drift is automatically corrected , ensuring long-term reliability.


:package: Repository

GitHub

The repo includes:

  • full YAML logic
  • sensors and configuration
  • documentation to get started

:gear: Setup

The project is fully usable as-is , but requires:

  • adapting entities to your setup
  • a working HA Linky integration
  • some familiarity with Home Assistant

:backhand_index_pointing_right: Not plug & play, but fully customizable.


:bullseye: Philosophy

The goal is not to build a ready-made integration, but to provide:

  • a solid and transparent foundation
  • a system you fully control
  • something you can adapt to your own needs

:handshake: Feedback

If you try it, I’d be happy to hear your feedback or ideas :slightly_smiling_face:

Thanks!