From e42053ab1b2ea5cb47c3ac0db2fbfb7fc47d5fb8 Mon Sep 17 00:00:00 2001 From: "anklimov@gmail.com" Date: Sun, 26 Apr 2026 11:55:51 +0300 Subject: [PATCH] Multvent/MultiAC finally working as designed. pre-relese deep testing Co-authored-by: Copilot --- lighthub/modules/out_multivent.cpp | 87 +++++++++++++++++++++++++++--- lighthub/modules/out_multivent.h | 2 + 2 files changed, 82 insertions(+), 7 deletions(-) diff --git a/lighthub/modules/out_multivent.cpp b/lighthub/modules/out_multivent.cpp index ac76be7..9b7c6c2 100644 --- a/lighthub/modules/out_multivent.cpp +++ b/lighthub/modules/out_multivent.cpp @@ -154,6 +154,54 @@ int out_Multivent::isActive() return 0; } + + void out_Multivent::stopAllzones(){ + if (!gatesObj) return; + debugSerial << F("VENT: Stop all zones. ")<child; + while (i) + { + if (i->name && *i->name) + { + int cmd = getIntFromJson(i,"cmd"); + switch (cmd) + { + case CMD_ON: + case CMD_HEATCOOL: + case CMD_FAN: + case CMD_AUTO: + case CMD_COOL: + case CMD_HEAT: + case CMD_DRY: + //case CMD_OFF: + setValToJson(i,"@preHaltcmd",cmd); + // setPassiveMode(i, true); + fanCtrl(itemCmd().Cmd(CMD_OFF).setSuffix(S_CMD),i->name,true); + break; + } + } + i=i->next; + }//while + } + + + void out_Multivent::restoreAllzones(){ + if (!gatesObj) return; + debugSerial << F("VENT: Restore all zones. ")<child; + while (i) + { + if (i->name && *i->name) + { + int preHaltcmd = getIntFromJson(i,"@preHaltcmd",CMD_OFF); + if (preHaltcmd) //setPassiveMode(i, false); + fanCtrl(itemCmd().Cmd(preHaltcmd).setSuffix(S_CMD),i->name,true); + setValToJson(i,"@preHaltcmd",0); //reset preHaltcmd in any case + } + i=i->next; + }//while + }; + #define assign_if_positive(var, source) {int x=source; if (x>=0) {var=x;}} int out_Multivent::Poll(short cause) @@ -193,6 +241,7 @@ int out_Multivent::Poll(short cause) int cmd = getIntFromJson (i,"cmd"); float set = getFloatFromJson(i,"set"); float val = getFloatFromJson(i,"val"); + int fan = getIntFromJson(i,"fan"); int execCmd = 0; bool weakMode=false; // kind of modes when we activating PID only if AC in active mode @@ -217,12 +266,12 @@ int out_Multivent::Poll(short cause) } break; case CMD_FAN: - ventRequested = true; + if (fan>0) ventRequested = true; weakMode = true; execCmd = cmd; break; case CMD_AUTO: - autoRequested = true; + if (fan>0) autoRequested = true; weakMode = true; execCmd = cmd; break; @@ -402,6 +451,7 @@ void out_Multivent::setPassiveMode(aJsonObject* zone, bool mode) item->SendStatusImmediate(itemCmd().Cmd(CMD_AUTO).setSuffix(S_FAN),FLAG_COMMAND,zone->name); //Send /fan->AUTO SubmitParameters(cascadeObj,"fan",itemCmd().Cmd(CMD_AUTO).setSuffix(S_FAN),false); + setValToJson(zone,"fan",0); //reset fan level on passive mode ON } else { @@ -550,8 +600,22 @@ switch (suffixCode) return -1; case S_CMD: - debugSerial<<"VENT: Todo - handle cmd/HALT. cmd="< 0 && !isActiveNow) diff --git a/lighthub/modules/out_multivent.h b/lighthub/modules/out_multivent.h index bc341c5..44435a5 100644 --- a/lighthub/modules/out_multivent.h +++ b/lighthub/modules/out_multivent.h @@ -48,6 +48,8 @@ protected: void setBoost(itemCmd); void resetBoost(); void notifyState(itemCmd state); + void stopAllzones(); + void restoreAllzones(); aJsonObject * gatesObj;