Skip to content

fix(drone): self-consistent detection notify + durable detection log#50

Merged
ifnull merged 1 commit into
mainfrom
fix/drone-notify-consistency
Jun 21, 2026
Merged

fix(drone): self-consistent detection notify + durable detection log#50
ifnull merged 1 commit into
mainfrom
fix/drone-notify-consistency

Conversation

@ifnull

@ifnull ifnull commented Jun 21, 2026

Copy link
Copy Markdown
Owner

The drone-detected notification could describe the wrong drone with "unknown nm". The example automation triggered on sensor.airspace_drone_count but rendered its message from sensor.airspace_nearest_drone — two independent entities fed by two MQTT topics. The count includes drones with no position yet (Basic ID heard before a Location message); the nearest sensor only carries positioned drones. So a new positionless drone bumped the count and fired the automation while the nearest sensor still held an earlier (or stale-retained) drone — wrong aircraft, no distance.

Trigger on the nearest sensor's track_id attribute instead, so the trigger and the message body are the same self-consistent entity, and the automation only fires once a positioned drone exists (distance always present). self_id is untrusted operator free-text (e.g. "Spoofing test") and now appears only as a last-resort label, never beside a registry-resolved make/model.

Add a durable drone_detected log line, emitted once per drone after enrichment. It records serial, make/model, self_id, distance, AGL and operator-located in journald / docker logs, independent of MQTT retention — so detections can be audited after the retained topics rotate (the gap that made this bug un-diagnosable from MQTT alone).

The drone-detected notification could describe the wrong drone with "unknown
nm". The example automation triggered on sensor.airspace_drone_count but
rendered its message from sensor.airspace_nearest_drone — two independent
entities fed by two MQTT topics. The count includes drones with no position yet
(Basic ID heard before a Location message); the nearest sensor only carries
positioned drones. So a new positionless drone bumped the count and fired the
automation while the nearest sensor still held an earlier (or stale-retained)
drone — wrong aircraft, no distance.

Trigger on the nearest sensor's track_id attribute instead, so the trigger and
the message body are the same self-consistent entity, and the automation only
fires once a positioned drone exists (distance always present). self_id is
untrusted operator free-text (e.g. "Spoofing test") and now appears only as a
last-resort label, never beside a registry-resolved make/model.

Add a durable `drone_detected` log line, emitted once per drone after
enrichment. It records serial, make/model, self_id, distance, AGL and
operator-located in journald / docker logs, independent of MQTT retention — so
detections can be audited after the retained topics rotate (the gap that made
this bug un-diagnosable from MQTT alone).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ifnull ifnull merged commit 9436fc8 into main Jun 21, 2026
3 checks passed
@ifnull ifnull deleted the fix/drone-notify-consistency branch June 26, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant