Dashboard: TUV křivka napojená na skutečnou telemetrii TČ
Some checks failed
CI and deploy / migration-check (push) Successful in 17s
CI and deploy / deploy (push) Failing after 46s

tuv_actual_c byl od vzniku grafu placeholder (null), TUV chart nikdy
neukazoval data. Nové view vw_telemetry_heat_pump_15m_7d (15min agregace,
R__101 + grant R__072) a plnění slotů v useDashboardData. Teploty avg přes
přítomné řádky (idle-skip ok — není to výkon).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dusan Vojacek
2026-06-13 00:09:10 +02:00
parent fb9d0f107a
commit 8882fa0c91
3 changed files with 47 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ END $$;
GRANT USAGE ON SCHEMA ems TO ems_anon;
GRANT SELECT ON ems.vw_site_status TO ems_anon;
GRANT SELECT ON ems.vw_telemetry_heat_pump_15m_7d TO ems_anon;
GRANT SELECT ON ems.vw_site_effective_price TO ems_anon;
GRANT SELECT ON ems.vw_latest_inverter TO ems_anon;
GRANT SELECT ON ems.vw_latest_heat_pump TO ems_anon;

View File

@@ -0,0 +1,23 @@
-- 15min agregace telemetrie TČ pro dashboard (TUV křivka v SocTuvChart).
-- Teploty: avg přes přítomné řádky je OK (idle-skip ředí řádky, ale teplota
-- není výkon — viz telemetry.md Idle-skip; nikdy z toho nepočítat energii).
drop view if exists ems.vw_telemetry_heat_pump_15m_7d;
create view ems.vw_telemetry_heat_pump_15m_7d as
select
time_bucket(interval '15 minutes', t.measured_at) as slot_start,
t.site_id,
round(avg(t.tuv_tank_temp_c)::numeric, 1) as avg_tuv_c,
round(avg(t.water_outlet_temp_c)::numeric, 1) as avg_water_out_c,
round(avg(t.water_inlet_temp_c)::numeric, 1) as avg_water_in_c,
max(t.operating_mode) as operating_mode,
count(*) as sample_count
from ems.telemetry_heat_pump t
where t.measured_at > now() - interval '7 days'
group by 1, 2;
comment on view ems.vw_telemetry_heat_pump_15m_7d is
'15min agregace TČ telemetrie za 7 dní pro dashboard (TUV/voda křivky).';
grant select on ems.vw_telemetry_heat_pump_15m_7d to ems_anon;