fix repeatable migrations

This commit is contained in:
Dusan Vojacek
2026-04-19 20:15:46 +02:00
parent 0c93f493a4
commit 22bca9cd9e
73 changed files with 22 additions and 15 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).';