Commit f68ea61
Stable identity and readable labels for vehicle position markers
get_rt_vehicle_positions built properties.id and properties.title from
the raw route_id, the direction and the last 3 digits of the crc32 of
the trip_id. Two problems:
- geo_json_events registers each marker with unique_id
<config_entry_id>_<properties.id>. The crc32 of the trip_id changes
on every trip, so every vehicle came back as a brand-new entity on
each run and the entity registry grew without bound.
- the title becomes the entity name on the map card, and labels like
"ORLEANS:Line:40(0)156_bus" are unreadable there.
Use the feed's vehicle id as the stable part of the identity
(line_direction_vehicle) so a vehicle keeps the same entity across
trips and days, and build the title from the line, the configured
destination and the vehicle id ("40 -> Gaston Galloux 7015"). Fall back
on the original crc-based id/label when the feed has no vehicle id or
the config entry has no usable destination (local-stop sensors).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent b7e7e3b commit f68ea61
1 file changed
Lines changed: 22 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
347 | | - | |
348 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
349 | 369 | | |
350 | 370 | | |
351 | 371 | | |
| |||
0 commit comments