Skip to content

feat(webhooks): configurable outbound HTTP rules for mesh events#82

Open
iceice400 wants to merge 1 commit into
KMX415:mainfrom
iceice400:feat/webhook-engine-config
Open

feat(webhooks): configurable outbound HTTP rules for mesh events#82
iceice400 wants to merge 1 commit into
KMX415:mainfrom
iceice400:feat/webhook-engine-config

Conversation

@iceice400
Copy link
Copy Markdown
Contributor

Summary

  • Adds configurable outbound HTTP webhooks driven by webhooks.rules in local.yaml
  • Async POST via httpx on mesh events: battery low, node offline/online, keyword match, duty spike
  • Per-rule cooldown in memory; failures logged to admin audit log (webhook.fire)
  • Disabled by default — no behaviour change until webhooks.enabled: true

Why

Operators want Home Assistant / Node-RED / Slack-style integrations without polling the dashboard API. Webhooks fire off the decoded packet stream without touching relay or TX paths.

Type

  • Feature
  • Bug fix
  • Docs
  • Refactor
  • UI
  • Installer
  • Region support
  • Hardware change

Testing

  • python -m unittest tests.test_webhook_engine -v (9 tests, pass)
  • Tested on hardware with real webhook target

Test plan

  1. Default config → service starts; no outbound HTTP
  2. Enable one battery_low rule pointing at a test HTTP server; inject low-battery telemetry → POST received
  3. Repeat within cooldown → single POST only
  4. Kill webhook target → packet pipeline continues; audit log shows webhook.fire error
  5. Invalid config (duplicate name, missing keyword, bad URL) → startup rejects with clear error

Relay / TX impact

None. Webhook engine subscribes to decoded packets only; no relay/decoder changes.

Config

webhooks:
  enabled: false
  rules:
    - name: low-battery-ha
      url: "http://192.168.1.10:8123/api/webhook/mesh_low_battery"
      event: battery_low
      cooldown_seconds: 3600

storm_quarantine validates at startup but does not fire until storm-guard (PR 12) lands.

AI-assisted?

Implemented with AI assistance; unit tests run locally.

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