189 files

This commit is contained in:
Home Assistant Version Control committed 2026-09-08 18:05:32 +00:00
1 parent 79fefc0a7c
commit 303886f212
189 files changed
+21402 -3514

No files matched your search

@@ -17,6 +17,7 @@ from ..const import DOMAIN, MAX_ENTITY_ID_LENGTH
from ..helpers.battery_fleet import (
async_compute_overview,
async_level_history,
fleet_due_without_sensor,
fleet_excluded_entities,
fleet_track_self_charging,
has_batteries,
@@ -30,6 +31,7 @@ from ..helpers.battery_fleet_setup import (
fleet_task_trigger_ok,
set_battery_excluded,
set_battery_included,
set_due_without_sensor,
set_track_self_charging,
)
from ..helpers.permissions import require_write
@@ -70,6 +72,9 @@ async def ws_battery_fleet_overview(hass: HomeAssistant, connection: websocket_a
"types": ov.types,
# #135 follow-up: the roster's track-self-charging toggle state.
"track_self_charging": fleet_track_self_charging(hass),
# D#162: whether a passed forecast on a sensorless note counts as
# due (the roster's second toggle; default on).
"due_without_sensor": fleet_due_without_sensor(hass),
# Manually excluded batteries (issue #107) — names enriched where
# the entity still exists, so the restore list stays readable.
"excluded": [
@@ -196,6 +201,24 @@ async def ws_battery_fleet_set_track_self_charging(
connection.send_result(msg["id"], {"success": True})
@websocket_api.websocket_command(
{
vol.Required("type"): f"{DOMAIN}/battery_fleet/set_due_without_sensor",
vol.Required("enabled"): bool,
}
)
@require_write
@websocket_api.async_response
async def ws_battery_fleet_set_due_without_sensor(
hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict[str, Any]
) -> None:
"""Fleet-wide option: a passed forecast on a sensorless note is due (D#162)."""
if not set_due_without_sensor(hass, msg["enabled"]):
connection.send_error(msg["id"], "not_configured", "Battery Fleet is not set up")
return
connection.send_result(msg["id"], {"success": True})
@websocket_api.websocket_command(
{
vol.Required("type"): f"{DOMAIN}/battery_fleet/mark_replaced",