Differentiate PET_ESCAPE and UNKNOWN_ANIMAL events by zone and identity
Replace the flat pet/detected handler with context-aware classification: unknown animals (no pet_id) → UNKNOWN_ANIMAL/WARNING, known pets in exterior/transition zones → PET_ESCAPE/ALERT, known pets indoors → PET_DETECTED/INFO. Adds four new unit tests covering all three paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -129,6 +129,15 @@ class EventProcessor:
|
||||
|
||||
# Pet detection
|
||||
if suffix == "pet/detected":
|
||||
pet_id = payload.get("pet_id")
|
||||
camera_location = payload.get("camera_location", "INTERIOR")
|
||||
|
||||
if not pet_id:
|
||||
return EventType.UNKNOWN_ANIMAL, Severity.WARNING, camera_id
|
||||
|
||||
if camera_location in ("EXTERIOR", "TRANSITION"):
|
||||
return EventType.PET_ESCAPE, Severity.ALERT, camera_id
|
||||
|
||||
return EventType.PET_DETECTED, Severity.INFO, camera_id
|
||||
|
||||
# Wildlife detection — severity depends on threat_level in payload
|
||||
|
||||
Reference in New Issue
Block a user