updates to accomodate valve node

This commit is contained in:
znetsixe
2025-07-24 13:17:10 +02:00
parent 30908365ba
commit 2540d19b76
6 changed files with 487 additions and 4 deletions

View File

@@ -83,6 +83,11 @@ class ChildRegistrationUtils {
this.connectValve(child);
break;
case "machineGroup":
this.logger.debug(`Registering complete machineGroup child: ${id}`);
this.connectMachineGroup(child);
break;
case "actuator":
this.logger.debug(`Registering linear actuator child: ${id}`);
this.connectActuator(child,positionVsParent);
@@ -184,6 +189,26 @@ class ChildRegistrationUtils {
this.logger.info(`Valve ${valveId} registered successfully.`);
}
connectMachineGroup(machineGroup) {
if (!machineGroup) {
this.logger.warn("Invalid machineGroup provided.");
return;
}
try {
const machineGroupId = Object.keys(this.mainClass.machineGroups).length + 1;
this.mainClass.machineGroups[machineGroupId] = machineGroup;
} catch (error) {
this.logger.warn(`Skip machinegroup connnection: ${error.message}`);
}
machineGroup.emitter.on("totalFlowChange", (data) => {
this.mainClass.logger.debug('Total flow change of machineGroup detected');
this.mainClass.handleInput("parent", "totalFlowChange", data)}); //Geef nieuwe totale flow door aan valveGrouControl
this.logger.info(`MachineGroup ${machineGroup.config.general.name} registered successfully.`);
}
connectActuator(actuator, positionVsParent) {
if (!actuator) {
this.logger.warn("Invalid actuator provided.");