fix reload pv on dashboard
This commit is contained in:
@@ -67,9 +67,9 @@ COMMENT ON VIEW ems.vw_latest_ev_charger IS
|
||||
CREATE OR REPLACE VIEW ems.vw_latest_heat_pump
|
||||
WITH (security_invoker = false)
|
||||
AS
|
||||
SELECT DISTINCT ON (t.heat_pump_id)
|
||||
t.site_id,
|
||||
t.heat_pump_id,
|
||||
SELECT
|
||||
hp.site_id,
|
||||
hp.id AS heat_pump_id,
|
||||
hp.code AS heat_pump_code,
|
||||
t.measured_at,
|
||||
t.outdoor_temp_c,
|
||||
@@ -81,11 +81,25 @@ SELECT DISTINCT ON (t.heat_pump_id)
|
||||
t.defrost_active,
|
||||
t.alarm_code,
|
||||
-- Odhadovaný COP pro aktuální venkovní teplotu
|
||||
ems.fn_cop_estimate(t.heat_pump_id, t.outdoor_temp_c) AS cop_estimated,
|
||||
ems.fn_cop_estimate(hp.id, t.outdoor_temp_c) AS cop_estimated,
|
||||
now() - t.measured_at AS data_age
|
||||
FROM ems.telemetry_heat_pump t
|
||||
JOIN ems.asset_heat_pump hp ON hp.id = t.heat_pump_id
|
||||
ORDER BY t.heat_pump_id, t.measured_at DESC;
|
||||
FROM ems.asset_heat_pump hp
|
||||
LEFT JOIN LATERAL (
|
||||
SELECT
|
||||
thp.measured_at,
|
||||
thp.outdoor_temp_c,
|
||||
thp.tuv_tank_temp_c,
|
||||
thp.water_outlet_temp_c,
|
||||
thp.power_w,
|
||||
thp.operating_mode,
|
||||
thp.cop_actual,
|
||||
thp.defrost_active,
|
||||
thp.alarm_code
|
||||
FROM ems.telemetry_heat_pump thp
|
||||
WHERE thp.heat_pump_id = hp.id
|
||||
ORDER BY thp.measured_at DESC
|
||||
LIMIT 1
|
||||
) t ON true;
|
||||
|
||||
COMMENT ON VIEW ems.vw_latest_heat_pump IS
|
||||
'Nejnovější telemetrická data pro každé tepelné čerpadlo včetně odhadovaného COP.
|
||||
|
||||
Reference in New Issue
Block a user