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:
2026-06-24 11:02:42 +02:00
parent 8d4f496ff4
commit e8521351d7
4 changed files with 249 additions and 1 deletions
+6 -1
View File
@@ -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,
})
}