Skip to content

v2.0.0

Choose a tag to compare

@sxdjt sxdjt released this 24 Nov 21:53

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:

  1. Open HACS in Home Assistant
  2. Click the 3 dots in the upper right corner
  3. Select "Custom repositories"
  4. Add repository URL: `https://github.com/sxdjt/ha-nws-alert-card\`
  5. Select category: "Lovelace"
  6. Click "Install"
  7. Restart Home Assistant

Manual Installation:

  1. Download `nws-alert-card.js` from this release
  2. Copy it to `/config/www/nws-alert-card.js` on your Home Assistant server
  3. 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