fix: follow Home Assistant Area marker moves

Issue: #126
User-Visible: yes
This commit is contained in:
Matysh
2026-08-31 09:45:53 +03:00
parent c8ef4f19e4
commit 633cb20e59
45 changed files with 1622 additions and 589 deletions
+5
View File
@@ -106,6 +106,11 @@ the same profiler available between stable promotions.
event subscription is unavailable.
4. **Reactivity.** Every state change in HA leads to set hass → re-render.
Temperatures/LQI/on-off are live by definition (verified by substituting state).
Authoritative device/entity registry rebuilds also run the pure
`device-area-relocation` resolver. Its pending ids override stale layout in
both interactive and hosted-static projections immediately; a writer then
deletes those layout entries before advancing bounded Area provenance in
config. Limited registry snapshots are read-only and never infer movement.
5. **One modal contract.** Card modals render through `hp-dialog`. In Home
Assistant it delegates surface semantics and trapping to `ha-dialog`; the
standalone demo falls back to native `<dialog>`. The wrapper owns the title,
+6
View File
@@ -2,6 +2,12 @@
## Unreleased
- Moving a device or a directly placed entity to another Home Assistant Area
now moves its marker to that Area's House Plan room too, even after the marker
was dragged manually. The new position uses the normal room grid and is
marked for attention; an explicit House Plan room still wins
([#126](https://github.com/Matysh/houseplan-card/issues/126)).
- Small furniture is easier to resize proportionally: the corner handle now
wins the tap over the side handle when the two overlap, which they do on
anything narrower than about 80 cm
+6
View File
@@ -8,6 +8,12 @@
## Не выпущено
- Перенос устройства или отдельно размещённой сущности в другую HA-зону теперь
переносит и маркер в связанную комнату House Plan, даже если маркер раньше
двигали вручную. Новое место выбирает обычная сетка комнаты и отмечает его
для внимания; явный выбор комнаты в House Plan по-прежнему важнее
([#126](https://github.com/Matysh/houseplan-card/issues/126)).
- Мелкую мебель проще тянуть за угол: угловая ручка теперь выигрывает нажатие
у боковой там, где они перекрываются, — а перекрываются они на всём уже
примерно 80 см ([#400](https://github.com/Matysh/houseplan-card/issues/400)).
+16
View File
@@ -482,6 +482,22 @@ pair — all off bits are cleared rather than resurrected against unknown marker
lifecycle history. Older integrations safely ignore the separate Store on
downgrade.
## Marker Area provenance (#126)
`settings.marker_area_snapshot` is optional internal lifecycle metadata. Each
entry records one exact `device:*` or `entity:*` binding and its last accepted
non-empty HA Area. The map is capped at 20,000 entries and remains subject to
the 2 MiB config limit. Absence triggers a conservative one-time backfill:
positions move only when another Area-bound room or another space proves that
the saved point is stale; boundary, outside and ambiguous points are preserved.
Same-source full backups preserve the map. Full imports from another source
drop it together with discovery lifecycle lists, and space-only imports never
carry this global metadata. Old frontends ignore the field; defensive reads in
new frontends skip malformed entries independently. Rebinding and marker
deletion remove the obsolete entry, and provenance advances only after the
corresponding stale layout position has been deleted successfully.
## Wall junction limits (#329)
Junction limits (minimum 15° between neighbouring walls of one node, at most
+6
View File
@@ -95,6 +95,12 @@ the old behaviour until an editing client materialises it.
dialog still permits metadata edits, Open in HA and Delete. Opening,
searching, filtering and Find are read-only.
- Room LQI counts hidden devices (owner's decision).
- A direct device/entity marker without an explicit House Plan room follows an
authoritative HA Area change. A saved drag position is discarded only after
the target Area resolves to exactly one room; explicit placement, virtual
markers and automatic composite light groups never enter this lifecycle.
The move reuses `new_device_ids`, while limited registry access makes no
placement or metadata decision.
- Hidden devices are NOT content for the CONTENT FRAME (docs/CANVAS.md §4,
audit DEV-2C947-01). The frame is presentation: an object the plan does not
draw may not decide what the plan opens on. Hiding a marker that had once
+15
View File
@@ -556,6 +556,21 @@ the active-only state projection. The standalone demo exposes complete
- [ ] `houseplanDiagnostics()` reports only redacted registry access/age/error
and binding-status counts; it contains no names, states or marker data.
## HA Area marker relocation (#126)
- [ ] `test/device-area-relocation.test.mjs` covers direct-binding authority,
same/cross-space transitions, conservative legacy backfill, explicit and
composite exclusions, rebind, malformed metadata and delete-first
provenance.
- [ ] `test/space-geometry.test.mjs` proves both marker-position paths can
suppress one stale saved point without changing the stored layout input.
- [ ] `demo/smoke_area_relocation.mjs` changes an authoritative registry Area
against the production bundle, checks one serialized layout delete plus
config/attention persistence, and proves the read-only hosted card moves
immediately without writes.
- [ ] Backend validation and import/export tests cover the 20,000-entry bound,
exact entry schema, same-source preservation and cross-source removal.
## Device display preview and face parity
The behaviour matrix is defined in
+7
View File
@@ -498,6 +498,13 @@ a bound HA area receives an automatic marker. Service-only records, bridges and
other non-spatial records are filtered; a light group may replace its members.
Newly discovered devices get a red dot until first opened in Device.
When the Area of a direct HA device or a separately placed entity changes,
House Plan moves its automatic marker to the room bound to the new Area. A
previous manual drag is layout, not a room override: it is discarded, the
ordinary room grid chooses the new position and the red attention dot appears.
Selecting a room explicitly in the marker settings overrides HA Area placement.
Ambiguous or unbound Areas never make House Plan guess a destination.
### Bindings
| Binding | Use |
+8
View File
@@ -758,6 +758,14 @@ YAML-сущность без `unique_id` и строки в Entity Registry: п
House Plan читает реестры устройств, сущностей и зон Home Assistant. Устройства HA-зоны появляются в комнате, связанной с этой зоной. Позиция назначается автоматически, затем её можно изменить.
Если прямое HA-устройство или отдельно размещённую сущность перенести в другую
HA-зону, автоматический маркер переедет в связанную с ней комнату. Ручное
перетаскивание считается только раскладкой, а не закреплением комнаты: старая
позиция удаляется, новое место выбирает обычная сетка комнаты, и появляется
красная отметка внимания. Явно выбранная в настройках маркера комната важнее
HA-зоны. Если зона не связана ровно с одной комнатой, House Plan ничего не
угадывает и сохраняет прежнее положение.
Некоторые служебные и нефизические интеграции скрываются при первой материализации списка: например HACS, системные сущности, мосты, сцены и часть агрегатов. Лампочки, входящие в группу света, могут быть заменены одним групповым маркером.
После первичного заполнения новые устройства отмечаются красной точкой. Точка исчезает после первого открытия маркера в редакторе устройств.
+1 -1
View File
@@ -1,7 +1,7 @@
# ТЗ #126 — HA Area переносит marker в новую комнату
- **Issue:** https://github.com/Matysh/houseplan-card/issues/126
- **Статус документа:** актуализировано на `dev@6bf39ee9a7ecbc62dcc8b999af3c23b6d877c5a0`, готово к spec review
- **Статус документа:** принято на `dev@4683a493cca25a4a527f2b96d3d11723aa9da74c`, реализуется
- **Приоритет:** P1
- **Тип:** bug, полный трек
- **Пользовательское изменение:** да