fix cutoff
Some checks failed
CI and deploy / migration-check (push) Failing after 18s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-04-29 13:04:30 +02:00
parent 9d37efb991
commit 5593397fd3
2 changed files with 9 additions and 4 deletions

View File

@@ -1651,14 +1651,16 @@ async def write_inverter_setpoints(
r179 = await mb179.read_holding_registers(179, 1, unit_id)
if r179 and len(r179) >= 1:
current_179 = int(r179[0])
new_179 = (current_179 & ~REG179_MI_EXPORT_MASK) | int(target_bits)
registers.append((179, "control_board_special_1", new_179))
# Deye firmware/UI u některých instalací neinterpretuje jen bits01 maskou,
# ale očekává přímo hodnotu 2/3. Proto zapisujeme "clean" 2/3 (bez RMW),
# aby se cutoff skutečně projevil i v UI.
registers.append((179, "control_board_special_1", int(target_bits)))
logger.info(
"[control] %s: reg179 MI cutoff %s (old=%s new=%s mask=0x%04X)",
inv.code,
"ON" if want_cutoff else "OFF",
current_179,
new_179,
int(target_bits),
REG179_MI_EXPORT_MASK,
)
else: