Remove energy source
energy_remove_energy_sourceRemove a specific energy source from Home Assistant energy preferences by its statistic ID. Useful for undoing an add call or cleaning up a source that no longer exists.
Instructions
Remove an energy source identified by its stat_energy_from.
Reads the current preferences, drops any solar/battery/gas/water source
whose stat_energy_from matches, also strips matching flow_from
entries from the grid source, and saves the resulting list via WS
energy/save_prefs. This replaces the whole energy_sources list with
one that has the matching entries removed — anything else in the list
is preserved as-is.
Use when: undoing an energy_add_solar_source/energy_add_battery_source/
energy_add_grid_consumption call, or dropping a source that no longer
exists.
Not for: replacing the whole source list at once — use
energy_save_energy_prefs.
Returns: {"status": "removed", "removed": <count>, "stat_energy_from": ..., "result": ...} on success, or {"status": "not_found", "stat_energy_from": ...} when nothing matched.
Errors: {"error": str(e), "stat_energy_from": ...} when either WS call
raises.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stat_energy_from | Yes | Statistic/entity ID identifying the source to remove, as originally passed to one of the `energy_add_*` tools, e.g. 'sensor.solar_production'. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||