Replace energy dashboard source lists
energy_save_energy_prefsReplace the Energy Dashboard's full energy_sources or device_consumption lists in Home Assistant via the energy/save_prefs WebSocket call. Use when you already hold the complete desired list.
Instructions
Save Energy Dashboard preferences via WS energy/save_prefs.
Each of energy_sources/device_consumption you pass replaces the
entire corresponding saved list — it is not merged with what's already
there. Use energy_add_grid_consumption, energy_add_grid_return,
energy_add_solar_source, energy_add_battery_source or
energy_remove_energy_source for incremental edits instead of
hand-building the full list. currency/energy_per_unit are kept only
for backward compatibility and are rejected: HA's currency lives in core
config (homeassistant.currency), not this WS schema, and
energy_per_unit does not exist in it at all.
Use when: you already hold the full desired energy_sources/
device_consumption list, e.g. from energy_get_energy_prefs.
Not for: adding or removing one source — use the energy_add_*/
energy_remove_energy_source helpers, which read-modify-write for you.
Returns: {"status": "saved", "result": ..., "fields": [...]} on
success.
Errors: {"error": "no fields to save", ...} when both list parameters
are omitted; {"error": "currency and energy_per_unit are not fields of HA's energy/save_prefs WS schema...", ...} when either deprecated
parameter is passed; {"error": str(e), ...} when the WS call raises.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| currency | No | Deprecated and not part of this WS schema; passing anything other than None now returns an error instead of being silently ignored. Omit this parameter. | |
| energy_sources | No | Full replacement for the Energy Dashboard's energy_sources list; each dict is one grid/solar/battery/gas/water source. Omit to leave the currently saved sources untouched. | |
| energy_per_unit | No | Deprecated and not part of this WS schema; passing anything other than None now returns an error instead of being silently ignored. Omit this parameter. | |
| device_consumption | No | Full replacement for the Energy Dashboard's device_consumption list, one dict per tracked device. Omit to leave the currently saved device list untouched. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||