Server-side trails: the current run and one previous

The integration now records the path itself (trails.py): it watches the
source entity's state changes, so recording needs no open card, has no
multi-tab write races, and every screen sees the same line — reloads
included, which retires the localStorage snapshot after one day of
life. Stored per marker: the current run plus exactly one previous
(owner call — users want cleaned-vs-uncleaned at a glance). The
previous run renders at 40% opacity; the current one still trims its
live tail so it never outruns the puck. Runs rotate on start or map
switch, points cap at 2000 with decimation, store writes debounce 10 s,
and houseplan_trail_updated pushes live cards. TrailBook is pure under
5 backend tests; the WS command degrades silently on older backends.
This commit is contained in:
Matysh
2026-07-31 11:03:47 +03:00
parent d063453670
commit 23daa28cf4
11 changed files with 394 additions and 124 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ marker is edited as usual.
Douglas-Peucker thinning, one SVG polyline.
- Style fixed, no options: cartography casing — a dark translucent halo under a light core. Neutral (pure black/white alphas) and readable over any room fill; blend modes were rejected: each has a blind luminance where the line vanishes, and mix-blend-mode is costly on old kiosk WebViews. Lifecycle:
appears on cleaning start, lives until dock + 10 min, dissolves;
`docked → cleaning` clears the old trail. Ephemeral on the server; the raw points snapshot into localStorage per marker so a page reload mid-run keeps the whole trail (freshness-gated by the same linger window; a new run or another map discards the snapshot).
`docked → cleaning` clears the old trail. Recorded SERVER-SIDE by the integration itself (trails.py): it watches the source entity, so the path records with zero cards open and every screen sees the same line. Stored per marker: the current run and ONE previous run (owner call — users compare cleaned vs uncleaned). The previous run renders at 40% opacity even at rest; the current run trims its live tail while moving. Rotation on run start or map switch; 2000-point cap with decimation; store writes debounced 10 s; houseplan_trail_updated notifies live cards.
- Marker option «Показывать след уборки», on by default where data
exists.