A comprehensive Home Assistant custom integration for managing emergency alerts with hub-based organization, group management, and intuitive status tracking.
β οΈ AI-Assisted Development Warning: This project has been largely developed with the assistance of AI tools (Claude and Cursor). I only have a basic understanding of what this code does and have been using this project as a way to experiment with AI-assisted development while creating a component I wanted for my dashboard. The code may contain inconsistencies, and best practices might only be partially followed due to the contextual limitations of AI. Use at your own risk and feel free to contribute improvements!
- Global Settings Hub: Manage system-wide notification preferences and escalation settings
- Alert Group Hubs: Organize alerts with custom group names (e.g., "Ivan's Security Alerts", "Kitchen Safety")
- Device Hierarchy: Clean organization in Home Assistant's device registry
- Multiple Trigger Types: Simple entity monitoring, Jinja2 templates, and logical combinations
- Severity Levels: Critical, warning, and info classifications
- Status Tracking: Real-time status with dedicated status sensors
- Action Buttons: Acknowledge, clear, and escalate alerts with button entities
- Menu-Style Management: Beautiful button-based interface instead of dropdown menus
- Immediate Updates: Changes take effect instantly with automatic config reloading
- Smart Forms: Pre-filled edit forms with helpful descriptions and examples
- Progressive Disclosure: Forms adapt based on your selections
- Status Sensors: Track alert states (active, acknowledged, cleared, escalated)
- Group Summaries: Overview of active alerts per group
- Device Organization: Each alert gets its own device with related entities
- Open HACS in your Home Assistant instance
- Go to "Integrations"
- Click the "+" button and search for "Emergency Alerts"
- Install the integration
- Restart Home Assistant
- Add the integration via Settings β Devices & Services
- Copy the
custom_components/emergency_alertsfolder to your Home Assistantcustom_componentsdirectory - Restart Home Assistant
- Add the integration via Settings β Devices & Services
When adding the integration, you'll choose between:
- Configure system-wide notification settings
- Set default escalation times
- Manage global message templates
- One per Home Assistant instance
- Create custom-named groups for organizing alerts
- Example group names: "Security Alerts", "Kitchen Safety", "Ivan's Monitors"
- Multiple groups supported
After setup, click the gear icon on any Alert Group Hub to access the management menu:
- β Add New Alert - Create a new alert
- βοΈ Edit Alert - Modify existing alerts (appears when alerts exist)
- ποΈ Remove Alert - Delete alerts (appears when alerts exist)
Monitor a single entity's state:
# Example: Front door left open
Entity ID: binary_sensor.front_door
Trigger State: "on"
Severity: warningUse Jinja2 templates for complex conditions:
# Example: High temperature with low humidity
Template: "{{ states('sensor.temperature')|float > 30 and states('sensor.humidity')|float < 20 }}"
Severity: criticalCombine multiple conditions:
# Example: Multiple motion sensors triggered
Conditions: [
{"entity_id": "binary_sensor.motion_kitchen", "state": "on"},
{"entity_id": "binary_sensor.motion_living_room", "state": "on"}
]
Operator: and
Severity: info- Name: Descriptive alert name (e.g., "Front Door Open", "High Temperature")
- Severity: Critical, Warning, or Info
- Escalation Time: Minutes before escalating if not acknowledged
- Actions: Service calls for triggered, cleared, and escalated states
For each alert in a group, the integration creates:
binary_sensor.emergency_[name]- Alert state (on/off)sensor.emergency_[name]_status- Current status (active, acknowledged, cleared, escalated, inactive)button.emergency_[name]_acknowledge- Acknowledge the alertbutton.emergency_[name]_clear- Manually clear the alertbutton.emergency_[name]_escalate- Force escalation
sensor.emergency_[group]_summary- Group overview and active alert count
- Triggered β Alert becomes active, status = "active"
- User Action β Use buttons to acknowledge, clear, or escalate
- Status Updates β Status sensor reflects current state
- Automatic Clearing β Alert clears when condition is no longer met
- Escalation β If not acknowledged within escalation time
Group: "Home Security"
Alert: "Door Open While Armed"
Trigger: Template - "{{ states('alarm_control_panel.home') == 'armed_away' and states('binary_sensor.front_door') == 'on' }}"
Severity: Critical
Actions: Notify mobile app, trigger sirenGroup: "Safety Monitors"
Alert: "Water Leak Detected"
Trigger: Simple - binary_sensor.water_leak_basement = "on"
Severity: Critical
Actions: Send notifications, shut off water valveGroup: "Maintenance"
Alert: "Fridge Door Open"
Trigger: Simple - binary_sensor.fridge_door = "on" (with delay)
Severity: Warning
Actions: Notify family membersThe integration provides several services for automation:
emergency_alerts.acknowledge- Acknowledge an active alertemergency_alerts.clear- Manually clear an alertemergency_alerts.test- Test an alert configuration
- Alerts appear as individual devices under their group hub
- Clean hierarchy in the device registry
- Proper device relationships for easy navigation
- All entities work seamlessly in automations
- Status sensors provide detailed state information
- Button entities can be triggered from automations
- Follows Home Assistant design patterns
- Integrates cleanly with the native interface
- Professional look and feel
# Run all tests
./run_tests.sh
# Run validation only
python validate_integration.py
# Run specific test
cd custom_components/emergency_alerts
python -m pytest tests/test_binary_sensor.py -vThe integration maintains high test coverage:
- Overall: >90%
- Critical paths: 100%
- Config flow: >85%
This integration is designed to be fully HACS compliant:
- β Repository structure follows HACS requirements
- β Proper manifest.json with all required fields
- β HACS validation passes in CI/CD
- β GitHub topics configured for discoverability
- Architecture Guide - Technical implementation details
- Testing Guide - Comprehensive testing documentation
- Change Log - Development history and feature evolution
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
- Follow Home Assistant integration best practices
- Maintain high test coverage
- Update documentation for new features
- Use meaningful commit messages
MIT License - see LICENSE file for details.
- GitHub Issues - Bug reports and feature requests
- GitHub Discussions - General questions and community support
- Home Assistant Community Forum - Community discussions
Special thanks to the Home Assistant community and core developers for providing the excellent framework and documentation that made this integration possible.
Emergency Alerts Integration - Making your smart home safer and more responsive, one alert at a time. π¨β¨