From bfe3b1ab7d838d62f859d8ff5b100583323e0ec8 Mon Sep 17 00:00:00 2001 From: DEV2DEV-DE Date: Wed, 29 Nov 2023 19:50:16 +0100 Subject: [PATCH] Fix type assignment --- README.md | 3 +++ main.js | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3145414..5659055 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ Connects to the Jablotron cloud to access your security system. Currently the adapter is **read-only**! It's only possible to read the states. Switching will be implemented later! ## Changelog +### **WORK IN PROGRESS** +* Handle unknown state types + ### 0.0.2-beta.4 (2023-11-29)** * Switched recurring refresh from interval to timeout * Manage internal list of already created states diff --git a/main.js b/main.js index 95c8734..a6785f5 100644 --- a/main.js +++ b/main.js @@ -326,7 +326,9 @@ class Jablotron extends utils.Adapter { break; case 'boolean': type = 'boolean'; break; - default: type = 'number'; + case 'number': type = 'number'; + break; + default: throw new Error('Unknown type for value "' + name + '"'); } if (!this.existsState(id)) { await this.extendObjectAsync(id, { type: 'state', common: { name: `${name}`, type: `${type}`, role: 'state', read: read, write: write }, native: {}, });