Handle pet and wildlife events in event processor
This commit is contained in:
@@ -127,6 +127,21 @@ class EventProcessor:
|
||||
if suffix in _TOPIC_EVENT_MAP:
|
||||
etype, sev = _TOPIC_EVENT_MAP[suffix]
|
||||
return etype, sev, camera_id
|
||||
|
||||
# Pet detection
|
||||
if suffix == "pet/detected":
|
||||
return EventType.PET_DETECTED, Severity.INFO, camera_id
|
||||
|
||||
# Wildlife detection — severity depends on threat_level in payload
|
||||
if suffix == "wildlife/detected":
|
||||
threat = payload.get("threat_level", "PASSIVE")
|
||||
if threat == "PREDATOR":
|
||||
return EventType.WILDLIFE_PREDATOR, Severity.CRITICAL, camera_id
|
||||
elif threat == "NUISANCE":
|
||||
return EventType.WILDLIFE_NUISANCE, Severity.WARNING, camera_id
|
||||
else:
|
||||
return EventType.WILDLIFE_PASSIVE, Severity.INFO, camera_id
|
||||
|
||||
# Ignore heartbeats etc.
|
||||
return None, None, None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user