fix: batch ha metadata and improve mobile dashboard
Some checks failed
quality / test (3.11) (push) Has been cancelled
quality / test (3.13) (push) Has been cancelled

This commit is contained in:
2026-06-14 22:52:42 +02:00
parent 2ae5576b8f
commit d87d3abc00
9 changed files with 170 additions and 32 deletions

View File

@@ -3,6 +3,7 @@ from __future__ import annotations
from datetime import datetime, timezone
from app.ha.client import HaClient, HaClientSettings
from app.ha.exceptions import HaHttpError
from app.ha.reader import HaReader
@@ -150,3 +151,23 @@ def test_ha_reader_finds_automation_that_targets_entity() -> None:
assert len(matches) == 1
assert matches[0].entity_id == "automation.storage_light"
assert matches[0].enabled is True
def test_ha_reader_ignores_automation_configs_not_exposed_by_ha() -> None:
client = FakeHaClient()
client.list_entities = lambda: [ # type: ignore[method-assign]
{
"entity_id": "automation.storage_light",
"state": "on",
"attributes": {
"id": "123",
"friendly_name": "Storage light",
},
}
]
client.get_automation_config = lambda automation_id: (_ for _ in ()).throw( # type: ignore[method-assign]
HaHttpError(404, "Resource not found")
)
reader = HaReader(client)
assert reader.find_automations_for_entity("light.storage") == []