Add battery source
energy_add_battery_sourceAdd a home battery to the Energy Dashboard by linking charge and discharge energy sensors as one battery source.
Instructions
Add a battery source to the Energy Dashboard.
Reads the current preferences, appends a new {"type": "battery", ...}
entry combining stat_energy_from (discharge) and stat_energy_to
(charge) to the energy_sources list, and saves it via WS
energy/save_prefs. Calling it twice with the same arguments adds a
second, duplicate source.
Use when: registering a home battery's charge and discharge sensors as
one Energy Dashboard source.
Not for: grid or solar sources — use energy_add_grid_consumption/
energy_add_grid_return/energy_add_solar_source.
Returns: {"status": "added", "stat_energy_from": ..., "stat_energy_to": ..., "result": ...}.
Errors: {"error": str(e)} when either WS call raises.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stat_energy_to | Yes | Statistic/entity ID of the battery charge (energy in) sensor to add, e.g. 'sensor.battery_charge'. | |
| stat_energy_from | Yes | Statistic/entity ID of the battery discharge (energy out) sensor to add, e.g. 'sensor.battery_discharge'. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||