Operation: Nightly Security Audit
User Story
As a homeowner and parent,
I want an automated system to perform a comprehensive "pre-flight" safety check of the home every night at 10:00 PM,
So that I can ensure the perimeter is secure, safety sensors are operational, and the home environment is optimized for the morning without performing a manual walkthrough.
Acceptance Criteria
- Time-Based Trigger: The audit must execute automatically at 22:00 daily.
- Perimeter Verification: System must check that all exterior doors in the "Lock Group" are locked and both garage doors (ratgdo) are closed.
- Environmental Safety:
- Monitor nursery temperature to ensure it remains between 68°F and 72°F.
- Verify leak sensors and smoke/CO detectors are in a "Clear" state.
- Infrastructure Readiness: Audit EV range and flag if a vehicle has less than 100 miles of range remaining.
- System Integrity: Confirm the smoke detector relay node status is "Alive" to prevent false-negative readings from offline hardware.
- Actionable Reporting: If any check fails, send a critical notification to mobile devices with a detailed line-item report using status emojis (✅/❌).
Technical Requirements
Hardware: Home Assistant Green/Yellow, Zigbee Deadbolts, ratgdo (ESP32) Garage Controllers, Z-Wave Smoke/CO Relay, ESPHome Temperature Sensors.
Software: Home Assistant Core, Jinja2 Templating Engine, Pirate Weather API integration.
The Solution: Home Assistant Automation
This YAML configuration utilizes complex templating to evaluate multiple domains simultaneously while only triggering a notification if a discrepancy is found.
alias: "Security: Night Time Check"
description: >-
Checks locks, garage, weather, car, leaks, smoke, and Oliver's room at
bedtime.
triggers:
- at: "22:00:00"
trigger: time
actions:
- if:
- condition: or
conditions:
- condition: state
entity_id: lock.lock_group
state: unlocked
- condition: state
entity_id:
- cover.ratgdo32disco_f1f4e4_door
- cover.ratgdo32_e15ec8_door
state: open
- condition: numeric_state
entity_id: sensor.big_beefy_range
below: 100
- condition: numeric_state
entity_id: sensor.sir_farts_a_lot_range
below: 100
- condition: numeric_state
entity_id: sensor.pirateweather_overnight_low_temperature_0d
below: 40
- condition: state
entity_id: binary_sensor.leak_sensor_group
state: "on"
- condition: template
value_template: "{{ not is_state('sensor.node_53_node_status', 'alive') }}"
- condition: state
entity_id: binary_sensor.smoke_detector_relay_smoke_detected
state: "on"
- condition: state
entity_id: binary_sensor.smoke_detector_relay_carbon_monoxide_detected
state: "on"
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.oliversroomtemp_temperature_2
below: 68
- condition: numeric_state
entity_id: sensor.oliversroomtemp_temperature_2
above: 72
then:
- action: notify.mobile_app_kyles_iphone
data:
title: 🏠 Nightly Check Failed
message: >
{% set lock = is_