From a35faa9554d1bd85ae786ea07a21d7423c501e72 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Mon, 3 May 2021 20:44:33 +0200 Subject: [PATCH] Allow null values for serial.adapter. https://github.com/nurikk/z2m-frontend/issues/449 --- lib/util/settings.js | 4 ++-- lib/util/settings.schema.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/util/settings.js b/lib/util/settings.js index 2540d026..2e239021 100644 --- a/lib/util/settings.js +++ b/lib/util/settings.js @@ -322,7 +322,7 @@ function applyEnvironmentVariables(settings) { const iterate = (obj, path) => { Object.keys(obj).forEach((key) => { if (key !== 'type') { - if (key !== 'properties') { + if (key !== 'properties' && obj[key]) { const type = (obj[key].type || 'object').toString(); const envPart = path.reduce((acc, val) => `${acc}${val}_`, ''); const envVariableName = (`ZIGBEE2MQTT_CONFIG_${envPart}${key}`).toUpperCase(); @@ -347,7 +347,7 @@ function applyEnvironmentVariables(settings) { } } - if (typeof obj[key] === 'object') { + if (typeof obj[key] === 'object' && obj[key]) { const newPath = [...path]; if (key !== 'properties') { newPath.push(key); diff --git a/lib/util/settings.schema.json b/lib/util/settings.schema.json index 38fc941e..27f44111 100644 --- a/lib/util/settings.schema.json +++ b/lib/util/settings.schema.json @@ -144,7 +144,7 @@ }, "adapter": { "type": ["string", "null"], - "enum": ["deconz", "zstack", "zigate", "ezsp"], + "enum": ["deconz", "zstack", "zigate", "ezsp", null], "title": "Adapter", "requiresRestart": true, "description": "Adapter type, not needed unless you are experiencing problems"