Journal

Home Resilience Index: Composite KPI Dashboard for Security, AQI, Energy and Wellness

Home Resilience Index: แดชบอร์ด KPI รวม ความปลอดภัย คุณภาพอากาศ พลังงาน และสุขภาพ

May 12, 2026 · 1 min read
Home Resilience Index: Composite KPI Dashboard for Security, AQI, Energy and Wellness

The Home Resilience Index Concept

Modern smart homes collect vast sensor data, but it’s scattered across hundreds of entities. The Home Resilience Index (HRI) condenses four critical dimensions into a single 0–100 score so homeowners can assess overall home health at a glance.

The 4 HRI Dimensions

| Dimension | Weight | Indicators | |---|---|---| | Security (S) | 30% | Frigate 24h event count, door locks, cameras online | | Air Quality (A) | 25% | PM2.5, CO2 ppm, TVOC | | Energy (E) | 25% | Solar self-consumption %, battery SOC, grid dependency | | Wellness (W) | 20% | Temperature/humidity, noise dB, presence hours |

HRI Formula and Sub-scores

HRI = (S_score × 0.30) + (A_score × 0.25) + (E_score × 0.25) + (W_score × 0.20)

Each sub-score normalizes raw sensor readings to 0–100 via linear interpolation:

python # AQI score: PM2.5 0=100pts, PM2.5 75+=0pts aqi_score = max(0, 100 - (pm25 / 75) * 100)  # Energy score: solar self-consumption + battery SOC weighted average energy_score = (solar_self_pct * 0.6) + (battery_soc * 0.4)  # Security score: penalize threats, bonus for locked doors + cameras online threat_penalty = min(100, frigate_events_24h * 15) security_score = max(0, min(100,     100 - threat_penalty + (10 if all_locks_locked else 0) + (5 if cameras_online else 0) ))

Home Assistant Template Sensors

yaml template:   - sensor:       - name: HRI Security Score         unit_of_measurement: pts         state: >           {% set events = states('sensor.frigate_events_24h') | int(0) %}           {% set locks = states('lock.front_door') == 'locked' and states('lock.back_door') == 'locked' %}           {% set cams = states('binary_sensor.frigate_cameras_online') == 'on' %}           {% set base = [0, 100 - (events * 15)] | max %}           {{ [100, base + (10 if locks else 0) + (5 if cams else 0)] | min }}        - name: HRI AQI Score         unit_of_measurement: pts         state: >           {% set pm25 = states('sensor.pm25_indoor') | float(0) %}           {% set co2 = states('sensor.co2_living_room') | float(400) %}           {% set pm_score = [0, 100 - (pm25 / 75 * 100)] | max %}           {% set co2_score = [0, 100 - ((co2 - 400) / 1200 * 100)] | max %}           {{ ((pm_score * 0.6) + (co2_score * 0.4)) | round(1) }}        - name: Home Resilience Index         unit_of_measurement: pts         icon: mdi:shield-home         state: >           {% set s = states('sensor.hri_security_score') | float(0) %}           {% set a = states('sensor.hri_aqi_score') | float(0) %}           {% set e = states('sensor.hri_energy_score') | float(0) %}           {% set w = states('sensor.hri_wellness_score') | float(0) %}           {{ (s * 0.30 + a * 0.25 + e * 0.25 + w * 0.20) | round(1) }}

Lovelace Dashboard Layout

yaml type: vertical-stack cards:   - type: gauge     entity: sensor.home_resilience_index     name: 🏠 HRI     min: 0     max: 100     severity:       green: 70       yellow: 40       red: 0     needle: true   - type: horizontal-stack     cards:       - type: gauge         entity: sensor.hri_security_score         name: 🔒 Security         min: 0         max: 100       - type: gauge         entity: sensor.hri_aqi_score         name: 🌿 Air         min: 0         max: 100       - type: gauge         entity: sensor.hri_energy_score         name: ⚡ Energy         min: 0         max: 100       - type: gauge         entity: sensor.hri_wellness_score         name: 💚 Wellness         min: 0         max: 100

LINE Alert When HRI Drops Below Threshold

yaml alias: HRI Alert — Below 50 trigger:   - platform: numeric_state     entity_id: sensor.home_resilience_index     below: 50     for: "00:10:00" action:   - service: notify.line_notify     data:       message: >-         ⚠️ HRI: {{ states('sensor.home_resilience_index') }}/100         Security: {{ states('sensor.hri_security_score') }}         Air: {{ states('sensor.hri_aqi_score') }}         Energy: {{ states('sensor.hri_energy_score') }}         Wellness: {{ states('sensor.hri_wellness_score') }}

Summary

The HRI transforms hundreds of sensor readings into one actionable number — ideal for daily summary reports, executive dashboards, or alerts when home conditions deteriorate across any dimension.

Questions & answers

Can I adjust the HRI weights?
Yes — edit the weight values in the template sensor. If your home has no solar, set Energy weight to 0 and redistribute to other dimensions.
Which Home Assistant version does this require?
This template sensor format requires HA 2021.9+ which introduced the new YAML block-style template sensor syntax.
How do I add a new dimension to HRI?
Create a new template sensor for the dimension, then update the HRI formula to include the new weighted component, adjusting other weights so they still sum to 1.0.
How is HRI different from HA’s built-in Energy Dashboard?
HA’s Energy Dashboard covers energy consumption only. HRI is a composite index spanning security, air quality, energy, and wellness simultaneously.

Related reading