Skip to content

feat: Telegram and webhook alerts, spooled offline - #9

Merged
agus-darmawan merged 4 commits into
mainfrom
feat/alerts
Nov 1, 2026
Merged

agus-darmawan merged 4 commits into
mainfrom
feat/alerts

Conversation

@agus-darmawan

Copy link
Copy Markdown
Member

What and why

A critical finding at 02:00 is worthless in a report read at 08:00. New package hotdog_alerts (alert_node) tells the crew as it happens:

Event Severity With
finding ≥ findings.min_severity (warning) the finding's thermal image or sound map, what to do
patrol failed critical why, findings per severity, report link
patrol came back to the dock on its own warning why (battery, duration, blocked)
patrol stopped by an operator attention
patrol finished (patrol_done) its worst findings per severity, report link
health ERROR (again after 30 min) critical the issues
  • Telegram (Bot API, sendPhoto with the evidence when it fits a caption, else sendMessage, HTML escaped) and a JSON webhook (Authorization: Bearer from HOTDOG_WEBHOOK_TOKEN) for a control room / ticket system. Tokens only from the env file, never parameters; nothing logs the token URL.
  • Spool on disk (~/.hotdog/alerts): every alert is written first, sent every retry_sec, oldest first, each channel once; a failing channel is retried next pass without blocking the others; dropped after max_age_hours / beyond max_queued (logged). Survives an uplink outage and restarts.
  • Quiet repeats: the same finding again only after repeat_hours (12 h) unless worse; a patrol that ended before the node started is never re-announced.
  • language: en | id (Bahasa Indonesia for the crew), robot_name, report_url (links to the feat: HTML patrol reports, retention and the report server #8 patrol pages).
  • alerts/test for commissioning.
  • Bringup starts it (alerts, env ALERTS); TELEGRAM_BOT_TOKEN= and HOTDOG_WEBHOOK_TOKEN= in the env template.
  • Docs: package README (Telegram set-up with @Botfather and the group id, webhook payload), commissioning step 9, operations, README, CHANGELOG.

How it was tested

  • pre-commit run on every changed and new file
  • Unit + style (incl. Python 3.8 / Foxy checks): hotdog_alerts 9, hotdog 31 — findings and the preferred image, repeats and "worse", Bahasa Indonesia, patrol and health alerts, links, spool (age, size, broken files), Telegram photo / text and the webhook against a local stand-in API, 502 then retried and delivered, HTML escaping
  • CI Foxy build + test/ros (alert_node against a stand-in webhook) — needs DHARMA_TOKEN
  • On the robot: ros2 service call /alerts/test std_srvs/srv/Trigger arrives in the group

Checklist

  • Conventional commit titles
  • Parameters documented (config/alerts.yaml, README)
  • CHANGELOG entry
  • Safety-relevant: no (outbound notifications only; secrets stay in /etc/hotdog/hotdog.env, mode 640)

Generated by Claude Code

@agus-darmawan
agus-darmawan merged commit 52b0abb into main Nov 1, 2026
agus-darmawan added a commit that referenced this pull request Nov 1, 2026
feat: Telegram and webhook alerts, spooled offline
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