From c1f5a393cffaafd7b37435c254ef15f97b2d388d Mon Sep 17 00:00:00 2001 From: Robert Strouse Date: Fri, 22 Apr 2022 08:06:34 -0700 Subject: [PATCH] Remove reported pumps that are outside the bounds of the max pumps. Previously ET would put them back after we removed them. --- controller/boards/EasyTouchBoard.ts | 3 +- .../comms/messages/config/PumpMessage.ts | 86 +++++++++++-------- 2 files changed, 53 insertions(+), 36 deletions(-) diff --git a/controller/boards/EasyTouchBoard.ts b/controller/boards/EasyTouchBoard.ts index 1d6f419c..f086920f 100644 --- a/controller/boards/EasyTouchBoard.ts +++ b/controller/boards/EasyTouchBoard.ts @@ -162,7 +162,8 @@ export class EasyTouchBoard extends SystemBoard { [101, { name: 'feature8', desc: 'Feature 8' }] ]); // We need this because there is a no-pump thing in *Touch. - // RKS: 05-04-21 The no-pump item was removed as this was only required for -webClient. deletePumpAsync should remove the pump from operation. + // RKS: 05-04-21 The no-pump item was removed as this was only required for -webClient. deletePumpAsync should remove the pump from operation. Do not use 255 as EasyTouch reports + // 255 or 0 for pumps that are not installed. this.valueMaps.pumpTypes = new byteValueMap([ [1, { name: 'vf', desc: 'Intelliflo VF', maxPrimingTime: 6, minFlow: 15, maxFlow: 130, flowStepSize: 1, maxCircuits: 8, hasAddress: true }], [64, { name: 'vsf', desc: 'Intelliflo VSF', minSpeed: 450, maxSpeed: 3450, speedStepSize: 10, minFlow: 15, maxFlow: 130, flowStepSize: 1, maxCircuits: 8, hasAddress: true }], diff --git a/controller/comms/messages/config/PumpMessage.ts b/controller/comms/messages/config/PumpMessage.ts index f8163f97..caee5053 100755 --- a/controller/comms/messages/config/PumpMessage.ts +++ b/controller/comms/messages/config/PumpMessage.ts @@ -36,43 +36,59 @@ export class PumpMessage { // packet 24/27/152/155 - Pump Config: IntelliTouch const pumpId = msg.extractPayloadByte(0); let type = msg.extractPayloadByte(1); // Avoid setting this then setting it back if we are mapping to a different value. + let isActive = type !== 0 && pumpId <= sys.equipment.maxPumps; // RKS: 04-14-21 - Only create the pump if it is available. If the pump was previously defined as another type // then it will be removed and recreated. - let pump: Pump = sys.pumps.getItemById(pumpId, pumpId <= sys.equipment.maxPumps && type !== 0); - if (pump.type !== type && type !== 0) { - sys.pumps.removeItemById(pumpId); - pump = sys.pumps.getItemById(pumpId, true); - } - pump.address = pumpId + 95; - switch (type) { - case 0: // none - pump.type = 0; - pump.isActive = false; - break; - case 64: // vsf - pump.type = type; - pump.isActive = true; - PumpMessage.processVSF_IT(msg); - break; - case 255: // vs 3050 on old panels. - case 128: // vs - case 134: // vs Ultra Efficiency - pump.type = 128; - pump.isActive = true; - PumpMessage.processVS_IT(msg); - break; - case 169: // vs+svrs - pump.type = 169; - pump.isActive = true; - PumpMessage.processVS_IT(msg); - break; - default: // vf - type is the background circuit - pump.type = 1; // force to type 1? - pump.isActive = true; - PumpMessage.processVF_IT(msg); - break; - } - if (pump.isActive) { + let pump: Pump = sys.pumps.getItemById(pumpId, isActive); + if(isActive) { + // Remap the combination pump types. + switch (type) { + case 0: + case 64: + case 169: + break; + case 255: + case 128: + case 134: + type = 128; + break; + default: + type = 1; + break; + } + if (pump.type !== type) { + sys.pumps.removeItemById(pumpId); + pump = sys.pumps.getItemById(pumpId, isActive); + } + pump.address = pumpId + 95; + switch (type) { + case 0: // none + pump.type = 0; + pump.isActive = false; + break; + case 64: // vsf + pump.type = type; + pump.isActive = true; + PumpMessage.processVSF_IT(msg); + break; + case 255: // vs 3050 on old panels. + case 128: // vs + case 134: // vs Ultra Efficiency + pump.type = 128; + pump.isActive = true; + PumpMessage.processVS_IT(msg); + break; + case 169: // vs+svrs + pump.type = 169; + pump.isActive = true; + PumpMessage.processVS_IT(msg); + break; + default: // vf - type is the background circuit + pump.type = 1; // force to type 1? + pump.isActive = true; + PumpMessage.processVF_IT(msg); + break; + } if (typeof pump.name === 'undefined') pump.name = sys.board.valueMaps.pumpTypes.get(pump.type).desc; const spump = state.pumps.getItemById(pump.id, true); spump.name = pump.name;