-- 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).';
