Technical article · Energy management

Controlling a home battery with Home Assistant

Most comparisons answer which battery can be integrated. That is the easy question. The hard one is what it actually earns under a dynamic tariff – and whether it is even allowed to do what the calculation asks of it.

First question
Self-consumption or arbitrage – the device follows from it
Purchase criterion
local and documented, local and tolerated, or cloud only
Control conflict
zero-export and price optimisation are mutually exclusive
Worth knowing
German Section 14a limits charging, not discharging
Status
September 2026, Marstek added on 13 October 2026 · market state with caveats, date checked per item
Author
Julian Haag, state-certified electrical engineering technician

The question that comes before the purchase

„Which battery can I integrate into Home Assistant?“ is the wrong first question. It can be answered yes for almost any device, and it skips the decision that actually matters: what is the battery for?

The second case is where many devices fail – not at integration but at permission: a battery whose controller only knows zero-export will not charge from the grid, however well it can be read. That is the property to ask about before buying.

What arbitrage actually yields

The calculation has three terms, and it is unforgiving:

Only when the spread exceeds both does the cycle earn anything. And because cycle cost is fixed, viability is decided not by the average spread but by the number of days on which it is high enough.

The full calculation with figures from a real installation is in the deep-dive article battery arbitrage: the calculation with real data. Anyone considering the purchase should have seen it first – not least because it states honestly when the result is negative.

Controllability as a purchase criterion

Three levels, and only the first carries a control loop for the long run:

On the state of the market, with the necessary caveat: Victron documents Modbus TCP and its register list officially and maintains both – that is the first level. On widespread balcony batteries such as the Marstek Venus range, a native Modbus TCP service on port 502 appeared with a firmware release rolled out without official announcement; integration runs through community work. That is the second level – functioning, but without any commitment. Marstek now also documents its own local interface for the newer Venus models, the Open API (revision 3.1 of September 2026). Which model has which route is covered in the article Marstek in Home Assistant.

This section ages faster than the rest of the page. Firmware levels and access routes change; what stands here is the state at the date checked. Before buying, look up the current state with the manufacturer – and ask whether local access is promised or merely present.

The mistake that distorts the whole selection

In a modular build the battery is never the controllable component. A battery module such as the widely used Pylontech US2000C talks to the inverter over RS-485 or CAN and tells it what it permits – but it accepts no commands from an energy manager. To find out whether such a battery can be charged on price signals, examine the inverter, not the battery.

This is why „which battery has a local API“ misleads on modular systems: two houses with identical battery modules can behave completely differently, because one has an inverter with a documented Modbus interface and the other one that only knows zero-export. On all-in-one units with a built-in inverter the two questions coincide – on modular systems they do not.

The installation the examples in this series come from has exactly this configuration: Pylontech modules on a Victron system with a GX device. What is controllable there is the Victron system – with a documented register list, see charging Victron ESS on spot prices.

Modular storage: who accepts commands Three levels stacked. Home Assistant as the energy management talks Modbus TCP with a documented register list to the inverter, for example a Victron system with a GX device. The inverter exchanges data over RS-485 or CAN with the battery module, for example a Pylontech US2000C, which reports what it allows. A direct path from energy management to the battery is crossed out: the battery takes no commands. Conclusion: what you control is the inverter, not the battery. Home Assistant energy management Inverter e.g. Victron with GX Battery module e.g. Pylontech US2000C Modbus TCP register list documented RS-485 / CAN reports what it allows battery takes no commands What you control is the inverter, not the battery. Example from this series: Pylontech modules on Victron with GX
In modular systems the inverter determines controllability. Two houses with identical battery modules can therefore behave completely differently. In all-in-one units with a built-in inverter both questions coincide.

Control: why you cannot have both at once

Zero-export and price optimisation are two controllers sharing one actuator with opposing goals. One wants grid draw held at zero right now; the other wants to charge from the grid right now because the hour is cheap. Run both and whichever wrote last wins – and the battery oscillates.

The clean solution is mode switching: exactly one mode is active at any time, and a higher layer decides which. Typically self-consumption during PV hours, arbitrage at night when the spread justifies it, arbitrage predominantly in winter.

Anyone not wanting to build that switching themselves ends up with an optimiser that merges both goals into one calculation – see setting up EMHASS.

Section 14a and the battery

Batteries fall under the German rules for controllable consumption devices with respect to what they draw. During an intervention the charging power is limited, not the discharge – the battery may keep supplying the house. That matters for arbitrage, which depends on charging from the grid: if an intervention falls into exactly the cheap hour, the planned cycle does not happen.

What curtailment does in detail, and what the grid fee modules offset, is covered in Section 14a in practice.

Recommendation by use case

Sources

Statements on controllability come from manufacturer documentation where it exists and are otherwise explicitly marked as community findings. Firmware and access routes change – check the current state before buying.

Statements about firmware levels and local access are snapshots, not manufacturer commitments. Before buying, check whether local access is documented and promised – not merely whether it currently works.

Links marked with an asterisk are affiliate links. As an Amazon Associate I earn from qualifying purchases; the price is unchanged for you. What I recommend does not depend on it.

Facing the battery decision and want to know what the installation really earns first? Write to me – the first conversation is free.