v2.0.0
What's New
This is the initial HACS-ready release of the US NWS Alert Card with comprehensive features, security hardening, and performance optimizations.
New Features
- Real-time NWS weather alerts for your specified zone
- Severity-based color coding (Extreme, Severe, Moderate, Minor, Unknown)
- Expandable alert descriptions with "Show more/less" toggle for long descriptions (>200 chars)
- Zone name display under card title for better context
- Persistent toggle state across updates
- Automatic polling with configurable interval (default: 5 minutes)
- Exponential backoff retry logic (max 3 attempts, starting at 5s delay)
- 10-second fetch timeout via AbortSignal
Security Enhancements
- XSS protection via HTML escaping for all user-facing text
- Email input sanitization prevents header injection
- External links use `rel="noopener noreferrer"`
- Zone format validation
Performance Optimizations
- Event delegation eliminates memory leaks from repeated renders
- Set-based alert comparison instead of JSON serialization
- Alert caching mechanism to preserve state
- Efficient re-rendering only when alerts change
User Experience
- Accessible ARIA labels and keyboard navigation
- Dynamic card sizing based on alert count
- Improved date formatting with shorter month names
- Loading state on initial connection
- Proper "No active alerts" message display
Code Quality
- Constants for configuration (MAX_RETRIES, BASE_RETRY_DELAY, DESCRIPTION_THRESHOLD)
- Proper method organization and separation of concerns
- Comprehensive error messages and validation
- CLAUDE.md documentation for AI-assisted development
Installation
This release is available through HACS:
Via HACS Custom Repository:
- Open HACS in Home Assistant
- Click the 3 dots in the upper right corner
- Select "Custom repositories"
- Add repository URL: `https://github.com/sxdjt/ha-nws-alert-card\`
- Select category: "Lovelace"
- Click "Install"
- Restart Home Assistant
Manual Installation:
- Download `nws-alert-card.js` from this release
- Copy it to `/config/www/nws-alert-card.js` on your Home Assistant server
- Add the resource in your Lovelace configuration
Configuration Example
```yaml
type: custom:nws-alert-card
nws_zone: WAZ558 # Your NWS zone (REQUIRED)
email: your-email@example.com # REQUIRED for NWS API compliance
title: NWS Weather Alert # Optional
update_interval: 300 # Optional, seconds between updates
show_severity_markers: true # Optional
```
Disclaimer
Important: Do not rely on this card for critical weather information. Always consult the National Weather Service or other competent weather providers for important safety decisions.
Full Changelog
https://github.com/sxdjt/ha-nws-alert-card/blob/main/CHANGELOG.md