frontend: add DSMR data panel to Energy page
- New 'DSMR' tab showing the latest parsed telegram (GET /api/energy/dsmr/latest) as a key/value table — the source-of-truth view so you can see ingest is landing data without reading the DB. - Auto-refresh toggle (~10s); loading/error/empty states (empty explains the likely cause); null phase values shown as a dash. - useDsmrLatest extended with optional auto-refresh. Tests added.
This commit is contained in:
@@ -385,13 +385,18 @@ export function useEnergyCostSummary(start?: string, end?: string) {
|
||||
// Query: DSMR latest reading
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function useDsmrLatest() {
|
||||
export function useDsmrLatest(options?: AutoRefreshOptions) {
|
||||
const refetchInterval = options?.refetchIntervalMs != null
|
||||
? Math.max(2_000, options.refetchIntervalMs)
|
||||
: undefined
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['dsmr-latest'],
|
||||
queryFn: async () => {
|
||||
const res = await apiClient.GET('/api/energy/dsmr/latest')
|
||||
return res.data
|
||||
},
|
||||
refetchInterval,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user