sql first refactor
Some checks failed
CI and deploy / migration-check (push) Successful in 5s
CI and deploy / deploy (push) Failing after 20s

This commit is contained in:
Dusan Vojacek
2026-04-19 20:02:20 +02:00
parent a02e11ee13
commit 93f883f5e0
74 changed files with 6022 additions and 4014 deletions

View File

@@ -0,0 +1,27 @@
-- pole registrů pro jeden TOU time point (čistá logika čísel; zápis řeší control exporter)
create or replace function ems.fn_deye_time_point_regs(
p_slot_index int,
p_hhmm int,
p_power_w int,
p_soc_pct int,
p_grid_charge_bit int
)
returns int[]
language sql
immutable
as $fn$
select array[
148 + p_slot_index * 6,
p_hhmm,
154 + p_slot_index * 6,
p_power_w,
166 + p_slot_index * 6,
p_soc_pct,
172 + p_slot_index * 6,
p_grid_charge_bit
];
$fn$;
comment on function ems.fn_deye_time_point_regs(int, int, int, int, int) is
'Adresy a hodnoty pro jeden Deye TOU blok (reg páry 148/154/166/172 + offset slotu).';