idle autodock, alerts on spectator and mini pages

This commit is contained in:
legop3
2026-01-09 15:06:44 -05:00
parent 50d3977814
commit 29154c56e6
6 changed files with 163 additions and 7 deletions
+19
View File
@@ -101,6 +101,15 @@ function formatOiEmoji(oiMode) {
return '❔';
}
function formatDuration(ms) {
if (ms == null) return 'n/a';
const seconds = Math.max(0, Math.round(ms / 1000));
const minutes = Math.floor(seconds / 60);
const remainder = seconds % 60;
if (minutes <= 0) return `${seconds}s`;
return remainder > 0 ? `${minutes}m ${remainder}s` : `${minutes}m`;
}
function isCharging(sensors) {
const label = sensors?.chargingState?.label?.toLowerCase();
const chargingByLabel =
@@ -694,6 +703,16 @@ function handleBusEvent(event) {
});
updatePresence();
break;
case 'rover.dockGuard':
announce({
channelId: channels.adminAlerts,
color: 0xf0b651,
title: 'Dock Guard Triggered',
description: `${payload?.roverId} (${payload?.reasonText || 'undocked'}) for ${formatDuration(
payload?.idleMs,
)}. Seek dock + sensor stream reissued until movement.`,
});
break;
case 'battery.warn':
announce({
channelId: channels.adminAlerts,