Skip to content

Add homeassistant-event-gateway template - #7

Open
canuto wants to merge 3 commits into
mainfrom
feature/homeassistant-event-gateway
Open

Add homeassistant-event-gateway template#7
canuto wants to merge 3 commits into
mainfrom
feature/homeassistant-event-gateway

Conversation

@canuto

@canuto canuto commented Jan 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a new template for receiving Home Assistant events via webhook
  • Implements rules-based noise filtering to reduce notification fatigue
  • Forwards notable events to Slack with optional AI explanations
  • Home Assistant stays in control of devices - this is a read-only event gateway

Features

Feature Description
Webhook endpoint POST /ha/event with secure token authentication via webhook-verify
Event storage Normalized schema in ha_events collection
Deduplication Ignores identical events within configurable window
Burst detection Flags rapid repeated triggers from same entity
Time-of-day Night-time motion/door events flagged as notable
Entity filtering Allowlist/denylist with wildcard support
Slack notifications Block Kit formatting with entity emojis
AI explanations Optional OpenAI/Anthropic integration
Daily digest GET /ha/digest with statistics

Dependencies

  • Uses webhook-verify@0.2 which has native Home Assistant support for secure constant-time token comparison

Files

homeassistant-event-gateway/
├── .env.example        # Environment variable documentation
├── .gitignore
├── package.json
├── README.md           # Comprehensive docs with HA YAML examples
└── src/
    ├── index.js        # Routes and handlers
    ├── rules.js        # Noise filtering logic
    ├── slack.js        # Slack message formatting
    └── ai.js           # Optional LLM explanations

Test plan

  • Deploy template to a test Codehooks project
  • Verify webhook accepts events with correct secret
  • Verify webhook rejects events without secret
  • Test deduplication by sending same event twice
  • Test Slack notification formatting
  • Test digest endpoint returns correct statistics

🤖 Generated with Claude Code

canuto and others added 3 commits January 19, 2026 12:51
A Codehooks.io template for receiving Home Assistant events via webhook,
applying noise filtering rules, and forwarding notable events to Slack
with optional AI explanations.

Features:
- Webhook endpoint with shared secret authentication
- Event storage in ha_events collection
- Rules-based noise filtering (deduplication, burst detection, time-of-day)
- Entity allowlist/denylist with wildcard support
- Slack notifications using Block Kit
- Optional AI explanations (OpenAI/Anthropic)
- Daily digest endpoint with statistics

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use webhook-verify library for constant-time secret comparison
- Add webhook-verify ^0.2.0 as dependency
- Update README with security section mentioning webhook-verify

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The Node.js https module is not available in the Codehooks runtime.
Use fetch (globally available) instead for Slack and AI API calls.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant