From 49574f6ed29a7090f1262ca50c5744b031affd03 Mon Sep 17 00:00:00 2001 From: Michael Hawkshaw <228663+mhawkshaw@users.noreply.github.com> Date: Sat, 25 Mar 2023 09:31:00 +0100 Subject: [PATCH] Fix crash should devices list be empty in config file --- package.json | 2 +- src/platform.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e7ec58b..88ce03b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "displayName": "Homebridge Enviroplus", "name": "homebridge-enviroplus", - "version": "2.1.4", + "version": "2.1.5", "description": "Fetches information from Raspberry Pi Enviroplus sensors for air quality.", "license": "Apache-2.0", "repository": { diff --git a/src/platform.ts b/src/platform.ts index f90c924..81ecbe2 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -23,9 +23,9 @@ export class EnviroplusPlatform implements DynamicPlatformPlugin { provided = provided && device.displayName && device.serial && device.topic; } } - } else if (this.config.devices) { + } else { provided = false; - this.log.error('The devices property is not of type array. Cannot initialise. Type %s', typeof this.config.devices); + this.log.error('The devices property is not of type array or is empty. Cannot initialise. Type %s', typeof this.config.devices); } return provided; }