Battery section¶
Battery Section is a raw model element that provides direct access to the model layer Battery element. Unlike the standard Battery element which creates multiple sections and an internal node, this element creates a single battery section that must be connected manually via Connection elements.
Raw model element
Battery Section is only available when Expose raw model elements is enabled on your hub. This element is for direct control over battery modeling when you are building the model yourself. Most users should use the standard Battery element instead.
Two connections required
Connections carry power in one direction only, from source to target. A Battery Section needs one connection with the section as its target to charge, and a second connection with the section as its source to discharge. With only one connection, the section can only charge or only discharge.
For mathematical details, see Battery Section Modeling.
Configuration¶
Overview¶
A Battery Section element represents:
- Single battery section with capacity and initial charge
- No implicit connections - must be connected explicitly via Connection elements
- Direct model access - maps directly to the model layer Battery element without additional composition
Unlike the standard Battery element, Battery Section does not create:
- Min and max charge limits
- Internal node for power routing
- Implicit connections to other elements
You must manually create Connection elements to connect the Battery Section to your network: one for each direction power should flow. Put the charge and discharge efficiencies and power limits on those connections, since the section itself has none.
Configuration fields¶
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| Name | String | Yes | - | Unique identifier (e.g., "Battery Section 1") |
| Capacity | sensor | Yes | - | Battery capacity in kWh (can vary over time) |
| Initial charge | sensor | Yes | - | Initial energy stored in battery (kWh) |
See Where values are measured for the convention HAEO uses for where limits, prices, and reported power apply.
Name¶
Choose a descriptive, friendly name. Home Assistant uses it for sensor names, so avoid symbols or abbreviations you would not want to see in the UI.
Capacity¶
Select a Home Assistant sensor that reports the battery capacity in kWh. The sensor can provide a constant value or a forecast with time-varying capacity.
The optimizer uses this value to enforce state of charge constraints.
Initial charge¶
Select a Home Assistant sensor that reports the initial energy stored in the battery in kWh. This represents the battery's state of charge at the start of the optimization window.
HAEO reads the sensor's current value. Forecast attributes are ignored, because only the energy at the start of the window is used.
Configuration example¶
Basic battery section configuration:
| Field | Value |
|---|---|
| Name | Battery Section 1 |
| Capacity | sensor.battery_capacity |
| Initial charge | sensor.battery_energy |
After creating the Battery Section element, create two Connection elements between it and an endpoint:
| Connection | Source | Target | Purpose |
|---|---|---|---|
| Battery Section charge | Switchboard | Battery Section 1 | Charging |
| Battery Section discharge | Battery Section 1 | Switchboard | Discharging |
Input entities¶
Each field creates an input entity on the battery section's device.
Input entities appear as Number entities with the config entity category.
Their IDs combine the section's name with the entity's name.
| Input | Unit | Description |
|---|---|---|
number.{name}_capacity |
kWh | Section capacity |
number.{name}_initial_charge |
kWh | Initial energy stored |
Input entities include a forecast attribute showing values for each optimization period.
See How data updates work for how input entities receive their values.
Sensors created¶
A Battery Section element creates 1 device in Home Assistant with the following sensors.
| Sensor | Unit | Description |
|---|---|---|
sensor.{name}_charge_power |
kW | Power being charged into the battery |
sensor.{name}_discharge_power |
kW | Power being discharged from the battery |
sensor.{name}_active_power |
kW | Net active power (discharge - charge) |
sensor.{name}_energy_stored |
kWh | Current energy stored in the battery |
sensor.{name}_power_balance_shadow_price |
$/kWh | Shadow price of energy at the section |
sensor.{name}_energy_in_flow_shadow_price |
$/kWh | Shadow price of charging constraint |
sensor.{name}_energy_out_flow_shadow_price |
$/kWh | Shadow price of discharging constraint |
sensor.{name}_soc_max_shadow_price |
$/kWh | Shadow price of maximum capacity constraint |
sensor.{name}_soc_min_shadow_price |
$/kWh | Shadow price of minimum capacity constraint |
Charge power¶
The optimal power being charged into the battery at each time period. Values are always positive or zero. This is the rate the stored energy rises, after any efficiency on the connection that feeds the section.
Example: A value of 3.5 kW means the battery is charging at 3.5 kW at this time period.
Discharge power¶
The optimal power being discharged from the battery at each time period. Values are always positive or zero. This is the rate the stored energy falls, before any efficiency on the connection that carries it away.
Example: A value of 2.0 kW means the battery is discharging at 2.0 kW at this time period.
Active power¶
The net active power (discharge - charge) at each time period. Positive values indicate net discharge, negative values indicate net charge.
Example: A value of -1.5 kW means the battery is charging at 1.5 kW net (discharge is less than charge).
Energy stored¶
The current energy stored in the battery at each time boundary. Values range from 0 to the configured capacity.
Example: A value of 7.5 kWh means the battery currently stores 7.5 kWh of energy.
Power balance shadow price¶
The marginal value of energy at the battery section, on the storage side of any connection efficiency. See the Shadow Prices modeling guide for general shadow price concepts.
It shows how much the total system cost would change if one more kWh were held in the section at that time.
Interpretation:
- Positive value: Power at the battery is valuable (system would benefit from more charging capacity)
- Negative value: Power at the battery is costly (system would benefit from more discharging capacity)
- Zero value: Battery power balance is not constraining the optimization
Example: A value of 0.15 means one more kWh held in the section at that time would save $0.15.
Energy in flow shadow price¶
The marginal value of relaxing the charging constraint. See the Shadow Prices modeling guide for general shadow price concepts.
This shadow price shows how much the total system cost would change if the battery could charge more energy.
Interpretation:
- Zero value: Charging constraint is not limiting
- Nonzero value: Battery charging is constrained and relaxing the constraint would reduce costs
Example: A value of 0.05 means that if the battery could charge 1 kWh more, the total system cost would decrease by $0.05 at this time period.
Energy out flow shadow price¶
The marginal value of relaxing the discharging constraint. See the Shadow Prices modeling guide for general shadow price concepts.
This shadow price shows how much the total system cost would change if the battery could discharge more energy.
Interpretation:
- Zero value: Discharging constraint is not limiting
- Nonzero value: Battery discharging is constrained and relaxing the constraint would reduce costs
Example: A value of 0.08 means that if the battery could discharge 1 kWh more, the total system cost would decrease by $0.08 at this time period.
SOC max shadow price¶
The marginal value of additional storage capacity. See the Shadow Prices modeling guide for general shadow price concepts.
This shadow price shows how much the total system cost would decrease if the battery had 1 kWh more capacity.
Interpretation:
- Zero value: Battery is not at maximum capacity
- Negative value: Battery is full and more capacity would reduce costs
- Positive value: Battery capacity constraint is not binding
Example: A value of -0.12 means that if the battery had 1 kWh more capacity, the total system cost would decrease by $0.12 at this time period.
SOC min shadow price¶
The marginal value of deeper discharge capability. See the Shadow Prices modeling guide for general shadow price concepts.
This shadow price shows how much the total system cost would decrease if the battery could discharge 1 kWh deeper (below current minimum).
Interpretation:
- Zero value: Battery is not at minimum capacity
- Positive value: Battery is empty and the ability to extract more energy would reduce costs
- Negative value: Battery minimum capacity constraint is not binding
Example: A value of 0.10 means that if the battery could discharge 1 kWh deeper, the total system cost would decrease by $0.10 at this time period.
All sensors include a forecast attribute containing future optimized values for upcoming periods.
Troubleshooting¶
Battery section not visible¶
Problem: The Battery Section element type does not appear in the element selection list.
Solution: Enable Expose raw model elements in your hub configuration. Battery Section is only available when that setting is enabled.
No power flow¶
Problem: Battery Section shows zero power even when connected.
Solution: Verify that Connection elements connect the Battery Section to an endpoint in both directions. Battery Section does not create implicit connections like the standard Battery element. If the section only charges or only discharges, the connection for the other direction is missing.
Connection errors¶
Problem: Cannot create connections to or from the Battery Section.
Solution: Ensure the Battery Section name matches exactly in both the Connection source and target fields. Check that the Battery Section element exists before creating connections.
Next steps¶
-
Connect to network
Learn how to connect Battery Section to other elements using Connection elements.
-
Standard Battery element
Consider using the standard Battery element for most use cases with automatic connections.
-
Battery Section modeling
Understand how Battery Section maps to the model layer Battery element.
-
Expose raw model elements
Learn when to expose raw model elements.