Pluck in HA radio stats into the WS fanout endpoint

This commit is contained in:
Jack Kingsman
2026-04-10 12:39:37 -07:00
parent 43c5e0f67d
commit 3bd756ee4e
13 changed files with 504 additions and 178 deletions
@@ -447,7 +447,7 @@ export function SettingsStatisticsSection({ className }: { className?: string })
)}
{/* Noise Floor */}
{stats.noise_floor_24h.supported !== false && (
{stats.noise_floor_24h && (
<>
<Separator />
<div>
@@ -468,14 +468,14 @@ export function SettingsStatisticsSection({ className }: { className?: string })
<NoiseFloorChart samples={stats.noise_floor_24h.samples} />
) : stats.noise_floor_24h.samples.length === 0 ? (
<p className="text-sm text-muted-foreground">
No noise floor samples collected yet. Samples are collected every five minutes,
and retained until server restart.
No noise floor samples collected yet. Samples are collected every minute and
retained until server restart.
</p>
) : (
<p className="text-sm text-muted-foreground">
Only one sample so far ({stats.noise_floor_24h.samples[0].noise_floor_dbm} dBm).
More data needed for a chart. Samples are collected every five minutes, and
retained until server restart.
More data needed for a chart. Samples are collected every minute and retained
until server restart.
</p>
)}
</div>
+2 -4
View File
@@ -657,11 +657,10 @@ describe('SettingsModal', () => {
{ timestamp: 1711796400, count: 8 },
],
noise_floor_24h: {
sample_interval_seconds: 300,
sample_interval_seconds: 60,
coverage_seconds: 3600,
latest_noise_floor_dbm: -105,
latest_timestamp: 1711800000,
supported: true,
samples: [],
},
};
@@ -728,11 +727,10 @@ describe('SettingsModal', () => {
},
packets_per_hour_72h: [],
noise_floor_24h: {
sample_interval_seconds: 300,
sample_interval_seconds: 60,
coverage_seconds: 0,
latest_noise_floor_dbm: null,
latest_timestamp: null,
supported: null,
samples: [],
},
};
+18 -1
View File
@@ -62,6 +62,23 @@ export interface AppInfo {
commit_hash: string | null;
}
export interface RadioStatsSnapshot {
timestamp: number | null;
battery_mv: number | null;
uptime_secs: number | null;
noise_floor: number | null;
last_rssi: number | null;
last_snr: number | null;
tx_air_secs: number | null;
rx_air_secs: number | null;
packets_recv: number | null;
packets_sent: number | null;
flood_tx: number | null;
direct_tx: number | null;
flood_rx: number | null;
direct_rx: number | null;
}
export interface HealthStatus {
status: string;
radio_connected: boolean;
@@ -76,6 +93,7 @@ export interface HealthStatus {
max_contacts: number | null;
max_channels: number | null;
} | null;
radio_stats?: RadioStatsSnapshot | null;
database_size_mb: number;
oldest_undecrypted_timestamp: number | null;
fanout_statuses: Record<string, FanoutStatusEntry>;
@@ -540,7 +558,6 @@ export interface NoiseFloorHistoryStats {
coverage_seconds: number;
latest_noise_floor_dbm: number | null;
latest_timestamp: number | null;
supported: boolean | null;
samples: NoiseFloorSample[];
}