From e179f1f1fd4d6f3941dfc8bd66c0d24d317673b2 Mon Sep 17 00:00:00 2001 From: Wesley Ray Date: Fri, 12 Jun 2026 15:49:47 -0400 Subject: [PATCH] canbus: Discord alert when the water-heater DSI fault trips New Pi package (repo copy canbus/ha/dsi_fault_alert.yaml): when the CAN node's DSI-lockout binary sensor holds 'on' for 10s, fire the server- alerts Discord webhook (@here, appropriately rude), with a cleared message when it recovers. Webhook URL lives in the Pi's HA secrets.yaml (!secret discord_server_alerts_webhook), not the repo. Co-Authored-By: Claude Fable 5 --- canbus/HANDOFF.md | 4 +++ canbus/ha/dsi_fault_alert.yaml | 58 ++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 canbus/ha/dsi_fault_alert.yaml diff --git a/canbus/HANDOFF.md b/canbus/HANDOFF.md index a4253c3..eb692ff 100644 --- a/canbus/HANDOFF.md +++ b/canbus/HANDOFF.md @@ -161,5 +161,9 @@ into the YAML as two `binary_sensor`s; nothing left to do here. - **Water Heater DSI Fault** = node `95` page-3 `b0` bit5 (`0x20`). Healthy heater = `0x80` off / `0x81` running; lockout = `0xA0`. +- **Discord alert wired (2026-06-12):** `canbus/ha/dsi_fault_alert.yaml` (on the + Pi as `packages/dsi_fault_alert.yaml`) pings the server-alerts channel via + webhook (`!secret discord_server_alerts_webhook`, same one Gatus uses) when + the fault latches for 10 s, plus a cleared message. Test-fired OK. - **OneControl System Fault** = page-0 `b0` bit0 (`0x01`), a bus-wide "fault exists somewhere" flag (read from node `95`'s page 0 in the lambda). diff --git a/canbus/ha/dsi_fault_alert.yaml b/canbus/ha/dsi_fault_alert.yaml new file mode 100644 index 0000000..ef49b31 --- /dev/null +++ b/canbus/ha/dsi_fault_alert.yaml @@ -0,0 +1,58 @@ +# Water-heater DSI fault → Discord ping in the server-alerts channel. +# +# The CAN node decodes the heater's DSI lockout (node 95 page-3 b0 bit5 — +# see canbus/README.md); when the burner fails to light (usually an empty +# propane tank) the module latches the fault and this fires the webhook. +# +# Deploy to Pi: /config/packages/dsi_fault_alert.yaml +# Repo copy: canbus/ha/dsi_fault_alert.yaml +# Secret: discord_server_alerts_webhook in the Pi's /config/secrets.yaml +# (same webhook Gatus uses for the alerts channel) + +rest_command: + discord_server_alerts: + url: !secret discord_server_alerts_webhook + method: POST + content_type: "application/json; charset=utf-8" + payload: >- + {"username": "Camper OneControl", + "content": {{ message | tojson }}, + "allowed_mentions": {"parse": ["everyone"]}} + +automation: + - id: camper_dsi_fault_discord + alias: "Camper: DSI fault → Discord" + description: >- + 10s 'for' debounces a single glitched broadcast frame; a real lockout + is latched by the module so it easily survives the wait. + triggers: + - trigger: state + entity_id: binary_sensor.onecontrol_can_water_heater_dsi_fault + to: "on" + for: "00:00:10" + actions: + - action: rest_command.discord_server_alerts + data: + message: >- + @here 🔥 **WATER HEATER DSI FAULT** — hey dumbass, you're out of + propane again. (Or the igniter finally died, but let's be honest, + it's the propane.) The heater is in lockout — swap the tank, then + cycle the heater off/on to relight. + mode: single + + - id: camper_dsi_fault_cleared_discord + alias: "Camper: DSI fault cleared → Discord" + triggers: + - trigger: state + entity_id: binary_sensor.onecontrol_can_water_heater_dsi_fault + from: "on" + to: "off" + for: "00:00:10" + actions: + - action: rest_command.discord_server_alerts + data: + message: >- + ✅ DSI fault cleared — the water heater is lighting again. Crisis + averted. Try to remember this feeling next time you eyeball the + tank gauge and say "eh, it's fine." + mode: single