Documentation languages:
- English: README.md
- Russian: README.ru.md
- Spanish: README.es.md
DIVA is a Home Assistant custom integration for pet care tracking. It models the installation as a single DIVA hub and each pet as its own Home Assistant device. DIVA publishes entities, timeline calendars, runtime events, anomalies, and recommendations for Herald or native Home Assistant automations.
The hub name is fixed to DIVA Pet Guardian in the normal UI flow. It is used only as the config entry title and hub device label.
- Async-first implementation
DataUpdateCoordinatorruntime model- One DIVA hub config entry with multiple pets inside it
- Event-driven outputs, never direct notifications
- Optional camera-based bowl monitoring
- Optional calendar sync to external
calendar.*entities - JSON runtime storage in
/config/diva_runtime.json
- Feeding, water, walk, and sleep tracking
- Structured weekly planner in the config/options form
- Multiple feeding types: dry, wet, treat, medication, supplement
- Food catalog with brand, category, and calorie density
- Food transition plan with dated mix steps
- Treat accounting, calories consumed, and feeding quality scoring
- Medical core with medication courses, symptom logging, recovery plans, and chronic condition tracking
- Default dog vaccination plan based on WSAVA core guidance with Spain overlays for rabies, leptospirosis, and leishmaniosis review
- Editable vaccine workflow with complete, reschedule, and cancel actions
- Weight goals, rolling weight history, and 14-day weight trend analytics
- Combined per-pet timeline calendar
- Vet appointment planning and external calendar sync
- Pet passport fields: passport number, microchip, insurance, vet details
- GPS/BLE tracking, safe zones, room presence mapping, and household presence links
- Behavior-signal ingest from external AI/vision entities or manual reporting
- Structured behavior observations with source, confidence, and detector/model provenance
- Rolling baseline analytics for food, sleep, activity, and hourly sleep/activity buckets
- Explainable stress scoring, sleep quality analytics, long inactivity detection, subtle anomaly detection, and AI behavior profiles
- Seasonal recommendations using a linked
weather.*or numericsensor.*temperature entity - Care journal with actor/action/note entries
- Family operations model with care roles, caregiver shifts, recurring checklists, approval queues, and operations reports
- Optional bowl camera analysis with simple pixel differencing and optional OpenCV contour support
- Copy
custom_components/divainto your Home Assistant config directory. - Restart Home Assistant.
- Add the
DIVAintegration fromSettings -> Devices & services. - Create the first pet profile.
- Add more pets from the integration
Optionsflow.
DIVA works with numpy only.
For stronger contour-based bowl interaction detection, install an OpenCV package in the Home Assistant Python environment, for example opencv-python-headless.
DIVA persists hub runtime data into /config/diva_runtime.json.
The file stores the hub name, pet profiles, routines, timeline snapshots, journal entries, calendar sync state, recent notices, and camera metadata.
Legacy .storage runtime data is imported automatically on the first start after the update.
DIVA now uses a versioned pet_schema = 3 config shape.
Each pet record is stored in explicit sections:
profileplanmedicalanalyticsexternal_links
The runtime JSON payload also stores typed runtime_sections for:
medicalmobilitybehavioroperationsreports
Inside the domain layer, PetEngine now exposes explicit sub-engine boundaries:
routinesnutritionmedicalmobilitybehaviorreporting
The DIVA hub stores a list of pets. Each pet profile includes:
namespeciesbreedbirthdateweightdiet_mode- Optional
avatar - Optional
feeding_routines - Optional
walk_routines - Optional
care_routines - Optional
routine_exceptions - Optional
default_manual_mode - Optional
weather_adaptation - Optional
heat_threshold_c - Optional
cold_threshold_c - Optional
vet_appointments - Optional
food_catalog - Optional
food_transition_plan - Optional
medical_country - Optional
medical_region - Optional
regional_policy - Optional
vaccine_profile - Optional
vet_override - Optional
body_condition_score - Optional
weight_goal_min_kg - Optional
weight_goal_max_kg - Optional
medication_courses - Optional
chronic_conditions - Optional
diagnoses - Optional
allergies - Optional
contraindications - Optional
medical_history - Optional
vaccine_overrides - Optional
care_roles - Optional
care_shifts - Optional
checklist_items - Optional
approval_required_actions - Optional
external_calendar_entity_ids - Optional passport and veterinary fields
- Optional GPS/BLE/presence/weather/behavior entities
- Optional
safe_zones - Optional
room_presence_sources - Optional
camera_room_name - Optional
camera_entity_id - Optional
food_bowl_area - Optional
water_bowl_area
Bowl areas use x,y,width,height pixel coordinates.
Avatar values can use /local/..., /media/local/..., or a full https://... URL.
Routine configuration is now structured in the UI. No text DSL is required.
Each routine row includes:
- time
- weekdays
- label
- duration
- meal type and portion for feedings
- location for walks/care
- category and notes for care routines
Supported manual modes:
normalvacationillness
Automatic adaptive modes:
heatwinterhome_alone
Routine exceptions are one-off date-bound overrides with three actions:
skipaddmove
Examples:
- Move a walk from
13:00to20:30for a hot day - Skip a feeding for a fasting day
- Add an extra care event for a specific date
Nutrition configuration is now structured in the UI.
Food catalog entries support:
food_namefood_brandfood_kind:main_food,treats,medical_food,supplementsmeal_typekcal_per_gramnotes
Food transition steps support:
transition_datefrom_food_nameto_food_namefrom_percentto_percentnotes
The transition mix must always sum to 100%.
diva.feed_pet can now optionally take:
meal_typefood_name
Medical settings are configured in a structured section of the pet form.
Medication courses support:
medication_namedosemedication_timesstart_dateend_datemedication_routenotes
Chronic conditions support:
condition_namecondition_statusmonitor_interval_daysnotes
Structured medical profile also supports:
diagnoses: diagnosis name, status, diagnosed date, notesallergies: allergen, reaction, notescontraindications: contraindication, reason, notesmedical_history: dated medical event, category, notesregional_policy: pragmatic regional overlay label such ases_general,madrid,andalucia,galicia,customvaccine_profile:auto,dog_default,spain_dog_defaultvet_override: whether configured vaccine overrides can replace generated default doses
Vaccination defaults:
- Dogs use a default protocol derived from WSAVA 2024 core guidance
- Spain overlays keep rabies on an annual review cadence
- Spain overlays add leptospirosis and leishmaniosis annual review entries
- English/Cocker Spaniel does not get a special core timing rule, but the notes flag Spanish exposure review
vaccine_overridescan add custom reminders or replace default due datesregional_policyadds regional review notes without hardcoding legal advice into the core templatevet_override = falsekeeps default generated vaccine doses authoritative even if a matching override exists- runtime services can complete, reschedule, or cancel vaccine reminders per pet
Medical runtime services:
diva.log_medication_dosediva.log_symptomdiva.start_recovery_plandiva.complete_vaccine_dosediva.reschedule_vaccinediva.cancel_vaccinediva.log_weightdiva.generate_vet_report
diva.log_symptom can now optionally take:
duration_hours
diva.generate_vet_report writes a txt or pdf report into /config/diva_reports/ and fires a DIVA event with:
report_pathtelegram_caption- summary fields for automations
Vet appointments:
2026-03-12 14:00|Annual checkup|60|City Vet|vet|Bring passport
2026-06-01 10:00|Vaccination|30|City Vet|vet|Booster shot
Format:
YYYY-MM-DD HH:MM|label|duration_minutes|location|category|notes
Days can be daily, weekdays, weekends, or comma-separated short names such as mon,wed,fri.
Operations settings are configured in a structured section of the pet form.
Operations profile objects support:
care_rolescare_shiftschecklist_itemsapproval_required_actions
Checklist items can be daily or weekly and may be marked as approval-required per item.
Approval-aware runtime services:
diva.complete_checklist_itemdiva.approve_actiondiva.generate_operations_report
If an action is configured as approval-required, DIVA does not execute it immediately.
Instead it creates a queued approval record, fires an approval_requested event, and waits for diva.approve_action.
diva.generate_operations_report writes a txt or pdf report into /config/diva_reports/ and fires a DIVA event with:
report_pathtelegram_caption- checklist and approval summary fields
DIVA creates its own per-pet calendar entity for the full routine timeline.
For external calendars:
- Google: use the built-in Home Assistant
Google Calendarintegration - Apple/iCloud: use the built-in
CalDAVintegration - Then link the resulting
calendar.*entities in the DIVA pet profile - Run
diva.sync_calendarto push upcoming DIVA events into those linked calendars
DIVA itself does not own OAuth or CalDAV credentials. It reuses Home Assistant calendar entities as the sync target.
Each linked calendar now has a source_of_truth policy:
divacalendarmanual_review
The sync is now reconcile-based and bidirectional:
- create missing DIVA events
- update changed DIVA events when the target calendar supports
UPDATE_EVENT - delete stale DIVA events when the target calendar supports
DELETE_EVENT - import external edits back into DIVA as stable timeline overrides when the calendar is the source of truth
- record conflicts instead of auto-merging when the policy is
manual_review - fall back safely when a calendar backend is create-only
Imported calendar overrides are applied on top of the DIVA timeline as one-off replacements, skips, or custom imported events. This keeps recurring routines stable while still allowing external calendar edits to round-trip back into DIVA.
The current avatar field accepts a path or URL and exposes it as entity_picture.
Planned for a future iteration:
- A post-setup pet avatar editor in the DIVA options flow
- Media-browser based image selection
- Preview before saving
- Optional crop support in a dedicated frontend editor
Each pet appears as a Home Assistant device. The DIVA hub is registered as a service device and each pet device is attached through it.
Sensors:
sensor.<pet>_food_todaysensor.<pet>_calories_consumed_todaysensor.<pet>_water_todaysensor.<pet>_weightsensor.<pet>_weight_trendsensor.<pet>_last_feedingsensor.<pet>_next_feedingsensor.<pet>_next_walksensor.<pet>_walk_distancesensor.<pet>_next_medicationsensor.<pet>_next_vet_visitsensor.<pet>_next_vaccinesensor.<pet>_vaccine_statussensor.<pet>_last_seen_eatingsensor.<pet>_activity_levelsensor.<pet>_sleep_durationsensor.<pet>_sleep_qualitysensor.<pet>_stress_scoresensor.<pet>_inactivity_durationsensor.<pet>_separation_scoresensor.<pet>_feeding_quality_scoresensor.<pet>_baseline_driftsensor.<pet>_behavior_profilesensor.<pet>_health_scoresensor.<pet>_active_medicationssensor.<pet>_recovery_statussensor.<pet>_body_condition_scoresensor.<pet>_symptom_severitysensor.<pet>_recommended_food_portionsensor.<pet>_daily_timelinesensor.<pet>_current_shiftsensor.<pet>_checklist_progresssensor.<pet>_pending_approvalssensor.<pet>_today_vs_baselinesensor.<pet>_weekly_summarysensor.<pet>_operations_centersensor.<pet>_current_zonesensor.<pet>_current_roomsensor.<pet>_room_heatmap
Device trackers:
device_tracker.<pet>_location
Binary sensors:
binary_sensor.<pet>_hungrybinary_sensor.<pet>_needs_walkbinary_sensor.<pet>_food_bowl_emptybinary_sensor.<pet>_water_bowl_emptybinary_sensor.<pet>_sleepingbinary_sensor.<pet>_home_alonebinary_sensor.<pet>_geofence_breachedbinary_sensor.<pet>_anomaly_detected
Buttons:
button.<pet>_feed_nowbutton.<pet>_refill_foodbutton.<pet>_refill_waterbutton.<pet>_start_walkbutton.<pet>_finish_walkbutton.<pet>_generate_operations_report
Numbers:
number.<pet>_food_portionnumber.<pet>_daily_caloriesnumber.<pet>_weight_goal_minnumber.<pet>_weight_goal_max
Select:
select.<pet>_diet_modeselect.<pet>_operation_mode
Camera:
camera.<pet>_bowl_monitor
Calendar:
calendar.<pet>_timeline
DIVA publishes these Home Assistant events:
diva_eventdiva_anomalydiva_recommendation
Event payloads always include at least:
pet: don_abrikos_a1b2c3
pet_name: Don Abrikos
timestamp: "2026-03-09T08:30:00+00:00"Additional runtime events now include schedule and journal flows such as:
food_servedfood_eatenroutine_duevet_appointment_duecare_action_loggedbehavior_reportedcalendar_syncedapproval_requestedaction_approvedchecklist_completedoperations_report_generated
diva.feed_petdiva.skip_feedingdiva.delay_feedingdiva.start_walkdiva.finish_walkdiva.sync_calendardiva.log_care_actiondiva.log_medication_dosediva.log_symptomdiva.report_behaviordiva.observe_behaviordiva.complete_checklist_itemdiva.approve_actiondiva.apply_modediva.start_recovery_plandiva.complete_vaccine_dosediva.upsert_vaccine_overridediva.remove_vaccine_overridediva.reschedule_vaccinediva.cancel_vaccinediva.upsert_medication_coursediva.remove_medication_coursediva.log_weightdiva.generate_vet_reportdiva.generate_operations_reportdiva.add_schedule_exception
diva.feed_pet accepts optional nutrition overrides:
portionmeal_typefood_name
Target by device_id or pet_id.
If there is only one pet in the hub, target is optional.
automation:
- alias: Send DIVA vet report to Telegram
trigger:
- platform: event
event_type: diva_event
event_data:
event: vet_report_generated
action:
- action: telegram_bot.send_document
data:
file: "{{ trigger.event.data.report_path }}"
caption: "{{ trigger.event.data.telegram_caption }}"automation:
- alias: Herald DIVA recommendation
trigger:
- platform: event
event_type: diva_recommendation
action:
- action: herald.notify
data:
title: "Pet recommendation"
message: "{{ trigger.event.data.pet_name }}: {{ trigger.event.data.recommendation }}"
level: warningaction:
- action: diva.sync_calendar
target:
entity_id: calendar.don_abrikos_timeline
data:
pet_id: don_abrikos_a1b2c3
days: 14A ready example card is available in examples/lovelace_pet_card.yaml.
The per-pet DIVA timeline calendar can also be shown directly on a Calendar card for a full day agenda.
A fuller built-in dashboard example is available in examples/lovelace_dashboard.yaml.
A dedicated walk map stack is available in examples/lovelace_walk_map.yaml.
A dedicated room heatmap stack is available in examples/lovelace_room_heatmap.yaml.
It covers:
- daily control
- timeline calendar
- medical status
- mobility and behavior
- operations center
- calendar sync health
- walk map via
device_tracker.<pet>_location
Use it as a YAML dashboard or copy individual cards into an existing dashboard.
DIVA auto-registers a dedicated sidebar panel at /diva-editor.
The panel is served directly from the integration and does not require:
panel_custom- a separate frontend build pipeline
- copying assets into
/www
Current panel coverage:
- medication course create, edit, remove
- medication dose logging
- vaccine complete, reschedule, cancel
- vaccine override create, edit, remove
- manual calendar sync
- calendar conflict review and resolution
- vet and operations report export
- walk map summary
- room heatmap summary
Sidebar visibility is configurable from Settings -> Devices & Services -> DIVA -> Configure -> Hub settings.
When hidden, the editor route still exists at /diva-editor.
For editable UI workflows, a helper + script workbench is available:
- package:
examples/ui_workbench_package.yaml - Lovelace view:
examples/lovelace_editor_workbench.yaml
This workbench remains the Home Assistant-native fallback UI for:
- completing, rescheduling, and cancelling vaccines
- logging medication doses
- exporting vet and operations reports
- triggering calendar sync
It is useful if you prefer native helpers and scripts over the custom DIVA editor panel.
- External calendar reconcile depends on feature support of the selected calendar backend. Some calendars are create-only.
- DIVA-managed external events are identified by a sync marker added to the event description.
Diagnostics include:
- Hub settings
- JSON storage backend and file path
- Per-pet configuration
- Entity state snapshots
- Timeline and journal data
- Camera settings and recent analysis
- Recent DIVA notices per pet
- Runtime metrics per pet
Pure logic tests are provided under tests/custom_components/diva for:
- Feeding logic
- Event payload generation
- Recommendation generation
- Camera detection heuristics
- Schedule parsing and behavior reporting
Home Assistant integration test scaffolding is provided under tests_integration/custom_components/diva.