From 09292119e601fa4188f98cb1d60758f56fb2d06f Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Mon, 6 Apr 2026 21:43:22 -0400 Subject: [PATCH] Only send Matrix notification on priority escalation, not title updates Title changes (e.g. rising Power_On_Hours counter) were firing a Matrix ping every hour. Notifications now only trigger when priority escalates to a higher severity level. Co-Authored-By: Claude Sonnet 4.6 --- create_ticket_api.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/create_ticket_api.php b/create_ticket_api.php index 4e26fa4..3178ddf 100644 --- a/create_ticket_api.php +++ b/create_ticket_api.php @@ -265,14 +265,18 @@ if ($existing) { ['reason' => 'auto-updated by hwmonDaemon (condition worsened)'] )); - require_once __DIR__ . '/helpers/NotificationHelper.php'; - NotificationHelper::sendTicketNotification($existingId, [ - 'title' => $title, - 'priority' => $newPriority < $existingPriority ? $newPriority : $existingPriority, - 'category' => $category, - 'type' => $type, - 'status' => $existingStatus, - ], 'automated'); + // Only notify on priority escalation — title-only updates (e.g. rising + // Power_On_Hours counter) should not generate a Matrix ping every hour. + if (isset($changes['priority'])) { + require_once __DIR__ . '/helpers/NotificationHelper.php'; + NotificationHelper::sendTicketNotification($existingId, [ + 'title' => $title, + 'priority' => $changes['priority']['to'], + 'category' => $category, + 'type' => $type, + 'status' => $existingStatus, + ], 'automated'); + } } $conn->close();