axis6779/unifi-ntfy-middleman

By axis6779

Updated 4 months ago

Image
Message queues
Internet of things
Monitoring & observability
0

569

axis6779/unifi-ntfy-middleman repository overview

A Python middleman for Unifi Gateway ↔ Ntfy human-readable notifications. Unifi sends raw json that can’t be modified before sending, so this small app catches the webhook, formats it and forwards to your Ntfy instance.

Set-up

  1. In your Unifi Gateway, open Alarm Manager and create your alarm. Under Action, choose Webhook and point the URL to this middleman (not Ntfy). For example: http://10.10.10.10:5000/unifi ⟵ /unifi endpoint is required
  2. Modify docker-compose with your Ntfy URL & Topic, and update port number if needed.

docker-compose.yml

services:
  unifintfy:
    image: axis6779/unifi-ntfy-middleman:latest
    restart: unless-stopped
    container_name: unifintfy
    ports:
      - "5000:5000"
    environment:
      - NTFY_TOPIC=https://ntfy.example.com/TOPIC
      - DEDUP_SECONDS=0    # Default 0
      - PORT=5000          # Default 5000
      - LOG_RAWDATA=false  # Default false
    healthcheck:
      test: ["CMD-SHELL", "curl -fs http://localhost:5000/health || exit 1"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 15s

Endpoints

PathDescriptionExpects/returns
/unifiPoint your Unifi Gateway Alarm/Webhook to this URLExpects application/json POST
/healthChecks whether both itself and your Ntfy instance is reachableReturns application/json
{"ntfy":"ok","service":"ok"}
/metricsSome simple metrics, useful for debuggingReturns text/plain
/metrics/unifi_webhooks_received
/metrics/unifi_notifications_sent
/metrics/unifi_notifications_failed
/metrics/unifi_duplicates_suppressed
Returns application/json
{"webhooks_received":5}

Tag summary

Content type

Image

Digest

sha256:601df1b5c

Size

52.9 MB

Last updated

4 months ago

docker pull axis6779/unifi-ntfy-middleman