App Updates

This commit is contained in:
2026-07-21 11:19:17 -04:00
parent 87ffe648a5
commit 0ed1687503
180 changed files with 943 additions and 118 deletions
@@ -51,7 +51,14 @@ async def ws_battery_fleet_overview(hass: HomeAssistant, connection: websocket_a
)
@websocket_api.websocket_command({vol.Required("type"): f"{DOMAIN}/battery_fleet/setup"})
@websocket_api.websocket_command(
{
vol.Required("type"): f"{DOMAIN}/battery_fleet/setup",
# The caller's UI language (same contract as the template WS) —
# the created object/task/part names are localized through _T.
vol.Optional("language"): vol.All(str, vol.Length(max=10)),
}
)
@require_write
@websocket_api.async_response
async def ws_battery_fleet_setup(hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict[str, Any]) -> None:
@@ -59,7 +66,7 @@ async def ws_battery_fleet_setup(hass: HomeAssistant, connection: websocket_api.
if not has_batteries(hass):
connection.send_error(msg["id"], "not_available", "No battery devices found")
return
result = await async_setup_battery_fleet(hass)
result = await async_setup_battery_fleet(hass, language=msg.get("language"))
connection.send_result(msg["id"], result)
@@ -399,6 +399,15 @@ async def ws_update_task(
connection.send_error(msg["id"], "invalid_input", "Name must not be empty")
return
# Battery Fleet guard (issue #106): the single fleet task without its
# threshold trigger is definitionally broken — it never fires and never
# auto-completes. No fleet UI offers removing the trigger, so an incoming
# null can only be a client (possibly stale/cached bundle) failing to
# round-trip a trigger it did not hydrate. Ignore the null; every other
# field in the message still applies.
if task.get("battery_fleet_task") and "trigger_config" in msg and msg["trigger_config"] is None:
del msg["trigger_config"]
# Validate trigger_config if provided
tc_warnings: list[str] = []
if "trigger_config" in msg and msg["trigger_config"] is not None: