1.8 KiB
pets
Purpose
Pet rule engine. Defines composable conditions (detected-in-zone, not-seen-for-N-minutes, detected-without-person, time-of-day, etc.) and per-pet state tracking that downstream code uses to trigger pet-specific alerts and automations. The on-camera pet identification itself lives in vigilar/detection/pet_id.py; this package is the behavioural layer on top of those sightings.
Key files
vigilar/pets/rules.py—PetStatedataclass,evaluate_condition, rule evaluator; readspet_rulesviaget_all_enabled_rulesvigilar/pets/__init__.py(empty)
MQTT topics
Subscribes: No MQTT subscribers found at time of writing. The module is invoked as a library — typically from the events processor or an evaluator that already has topic payloads in hand. Publishes: No MQTT publishers found at time of writing.
Database tables
pet_rules— loaded viavigilar.storage.queries.get_all_enabled_rulespets,pet_sightings,pet_training_images— owned schema-wise by this feature area but written from elsewhere (events processor for sightings, detection/trainer for training images, web for pets CRUD)
Depends on
storage— readspet_rulesalerts.profiles— reusesis_in_time_windowfor time-of-day conditions
Consumed by
events/ rule evaluator — drives pet-specific alert actionsweb— thepetsblueprint manages pets, training images, and rules
Notes
PetState is per-pet, in-memory, and tracks last-seen camera and time, current zone with entry time, and whether a person is currently present alongside the pet. This makes rules like "cat in kitchen for more than 5 minutes while nobody is home" possible without joining SQLite on every frame. The condition schema is a plain dict with a type discriminator, so new condition kinds can be added without schema changes.