Dashboard: TUV křivka napojená na skutečnou telemetrii TČ
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:
@@ -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;
|
||||
|
||||
23
db/views/R__101_vw_telemetry_heat_pump_15m_7d.sql
Normal file
23
db/views/R__101_vw_telemetry_heat_pump_15m_7d.sql
Normal 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;
|
||||
Reference in New Issue
Block a user