From 01854b118d4a534117a29453bcca397fed6740c5 Mon Sep 17 00:00:00 2001 From: John A Knight Jr Date: Fri, 18 Oct 2024 20:09:59 -0700 Subject: [PATCH] Fix crash on new connection startup --- buildHADefs.js | 3 --- index.js | 5 +++++ package.json | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/buildHADefs.js b/buildHADefs.js index fc50161..67bef6f 100644 --- a/buildHADefs.js +++ b/buildHADefs.js @@ -22,9 +22,6 @@ export function buildHADefs(self) { if (self.HA_CONFIG[s][mc].has) { let haName = self.HA_CONFIG[s][mc].name + 'Gain' - - - haVariables.push({ name: haName + ' %', variableId: vID + '_p', diff --git a/index.js b/index.js index 4bb1e96..d849f34 100644 --- a/index.js +++ b/index.js @@ -43,6 +43,11 @@ class BAirInstance extends InstanceBase { async init(config) { this.config = config + + if (!this.config.channels) { + this.config.channels = parseInt(this.config.model.replace(/\D/g, '')) + this.saveConfig(this.config) + } this.snapshot = [] this.currentSnapshot = 0 diff --git a/package.json b/package.json index 141cab5..74fd034 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "behringer-xair", - "version": "2.4.1", + "version": "2.4.2", "type": "module", "main": "index.js", "scripts": {