Add throttling recovery metrics

This commit is contained in:
seo
2026-06-18 04:34:18 +09:00
parent b6d12f9a0e
commit 81a24530d6
4 changed files with 127 additions and 9 deletions
+44 -4
View File
@@ -24,9 +24,11 @@
statusLowVoltage: $('#statusLowVoltage'),
statusLowVoltageLast: $('#statusLowVoltageLast'),
statusLowVoltageDuration: $('#statusLowVoltageDuration'),
statusLowVoltageRecent: $('#statusLowVoltageRecent'),
statusThrottling: $('#statusThrottling'),
statusThrottlingLast: $('#statusThrottlingLast'),
statusThrottlingDuration: $('#statusThrottlingDuration'),
statusThrottlingRecent: $('#statusThrottlingRecent'),
statusBatteryVoltage: $('#statusBatteryVoltage'),
statusBatterySoc: $('#statusBatterySoc'),
statusBatteryRemaining: $('#statusBatteryRemaining'),
@@ -98,19 +100,27 @@
lowVoltage: 'Low Voltage',
lowVoltageLast: 'Last Low Voltage',
lowVoltageDuration: 'LV Duration',
lowVoltageRecent: 'LV 10m',
lowVoltageActive: 'Active',
lowVoltageNormal: 'Normal',
lowVoltageRecovering: 'Recovering',
lowVoltageRepeated: 'Repeated',
lowVoltageSeen: 'seen since boot',
lowVoltageNotSeen: 'not seen since boot',
throttling: 'Throttling',
throttlingLast: 'Last Throttling',
throttlingDuration: 'Throttle Duration',
throttlingRecent: 'Throttle 10m',
throttlingActive: 'Throttling',
throttlingNormal: 'Normal',
throttlingRecovering: 'Recovering',
throttlingRepeated: 'Repeated',
throttlingSeen: 'seen since boot',
throttlingNotSeen: 'not seen since boot',
currentEpisode: 'current',
lastEpisode: 'last',
recentCount: 'events',
recentActive: 'active',
batteryV: 'Battery V',
batterySoc: 'Battery SOC',
sensorHistory: 'Sensor History',
@@ -247,19 +257,27 @@
lowVoltage: '저전압',
lowVoltageLast: '최근 저전압',
lowVoltageDuration: '저전압 지속',
lowVoltageRecent: '저전압 10분',
lowVoltageActive: '감지 중',
lowVoltageNormal: '정상',
lowVoltageRecovering: '복구 중',
lowVoltageRepeated: '반복 발생',
lowVoltageSeen: '부팅 후 이력 있음',
lowVoltageNotSeen: '부팅 후 이력 없음',
throttling: '스로틀링',
throttlingLast: '최근 스로틀링',
throttlingDuration: '스로틀링 지속',
throttlingRecent: '스로틀링 10분',
throttlingActive: '감지 중',
throttlingNormal: '정상',
throttlingRecovering: '복구 중',
throttlingRepeated: '반복 발생',
throttlingSeen: '부팅 후 이력 있음',
throttlingNotSeen: '부팅 후 이력 없음',
currentEpisode: '현재',
lastEpisode: '최근',
recentCount: '발생',
recentActive: '감지',
batteryV: '배터리 전압',
batterySoc: '배터리 SOC',
sensorHistory: '센서 이력',
@@ -804,16 +822,36 @@
return formatDhms(parseWifiDurationSeconds(value)) || value;
}
function eventStateText(eventState, activeKey, normalKey, seenKey, notSeenKey) {
function eventStateText(eventState, activeKey, normalKey, recoveringKey, repeatedKey, seenKey, notSeenKey) {
if (!eventState || eventState.available === false) {
return t('na');
}
const stateText = eventState.active ? t(activeKey) : t(normalKey);
let stateText = t(normalKey);
if (eventState.state_label === 'repeated') {
stateText = t(repeatedKey);
} else if (eventState.state_label === 'recovering') {
stateText = t(recoveringKey);
} else if (eventState.active) {
stateText = t(activeKey);
}
const seenText = eventState.seen_since_boot ? t(seenKey) : t(notSeenKey);
return `${stateText} (${seenText})`;
}
function eventRecentText(eventState) {
if (!eventState || eventState.available === false) {
return t('na');
}
const count = Number(eventState.recent_event_count ?? 0);
const seconds = Number(eventState.recent_active_seconds ?? 0);
const percent = Number(eventState.recent_active_percent ?? 0);
const activeText = formatDhms(seconds) || '0s';
return `${count}${state.lang === 'ko' ? '회' : 'x'} / ${t('recentActive')} ${activeText} (${percent.toFixed(1)}%)`;
}
function eventDurationText(eventState) {
if (!eventState || eventState.available === false) {
return t('na');
@@ -826,11 +864,11 @@
}
function lowVoltageStateText(lowVoltage) {
return eventStateText(lowVoltage, 'lowVoltageActive', 'lowVoltageNormal', 'lowVoltageSeen', 'lowVoltageNotSeen');
return eventStateText(lowVoltage, 'lowVoltageActive', 'lowVoltageNormal', 'lowVoltageRecovering', 'lowVoltageRepeated', 'lowVoltageSeen', 'lowVoltageNotSeen');
}
function throttlingStateText(throttling) {
return eventStateText(throttling, 'throttlingActive', 'throttlingNormal', 'throttlingSeen', 'throttlingNotSeen');
return eventStateText(throttling, 'throttlingActive', 'throttlingNormal', 'throttlingRecovering', 'throttlingRepeated', 'throttlingSeen', 'throttlingNotSeen');
}
function timeAgo(seconds) {
@@ -877,9 +915,11 @@
setText(els.statusLowVoltage, lowVoltageStateText(lowVoltage));
setText(els.statusLowVoltageLast, lowVoltage.last_detected_at || '-');
setText(els.statusLowVoltageDuration, eventDurationText(lowVoltage));
setText(els.statusLowVoltageRecent, eventRecentText(lowVoltage));
setText(els.statusThrottling, throttlingStateText(throttling));
setText(els.statusThrottlingLast, throttling.last_detected_at || '-');
setText(els.statusThrottlingDuration, eventDurationText(throttling));
setText(els.statusThrottlingRecent, eventRecentText(throttling));
setText(els.statusBatteryVoltage, battery.voltage === null || battery.voltage === undefined ? '-' : `${Number(battery.voltage).toFixed(3)} V`);
setText(els.statusBatterySoc, battery.percent === null || battery.percent === undefined ? '-' : `${Number(battery.percent).toFixed(2)}%`);
setText(els.statusBatteryRemaining, battery.remaining?.display || '-');