oprava import/export kwh
Some checks failed
CI and deploy / migration-check (push) Failing after 11s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-05-01 14:58:29 +02:00
parent 91ee8a6adf
commit ed88ef8910
8 changed files with 158 additions and 40 deletions

View File

@@ -14,13 +14,29 @@ as $fn$
end,
'grid_import_kwh',
case
when ai.actual_grid_import_wh is null then null
else round(ai.actual_grid_import_wh::numeric / 1000, 4)
when ai.actual_grid_import_wh is null
and ai.actual_grid_export_wh is null
and ai.actual_grid_power_w is null
then null
else round(
ems.fn_audit_grid_import_wh_for_economics(
ai.actual_grid_import_wh, ai.actual_grid_export_wh, ai.actual_grid_power_w
)::numeric / 1000,
4
)
end,
'grid_export_kwh',
case
when ai.actual_grid_export_wh is null then null
else round(ai.actual_grid_export_wh::numeric / 1000, 4)
when ai.actual_grid_import_wh is null
and ai.actual_grid_export_wh is null
and ai.actual_grid_power_w is null
then null
else round(
ems.fn_audit_grid_export_wh_for_economics(
ai.actual_grid_import_wh, ai.actual_grid_export_wh, ai.actual_grid_power_w
)::numeric / 1000,
4
)
end,
'batt_charge_kwh',
case