From 99785ca8cc7a808e2c7b807b9082011669019e20 Mon Sep 17 00:00:00 2001 From: Evgenii Abramov Date: Tue, 30 Mar 2021 23:37:11 +0300 Subject: [PATCH] Add allowed users support --- device.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/device.js b/device.js index c275203..3dc9aae 100644 --- a/device.js +++ b/device.js @@ -113,10 +113,15 @@ class Device { } } - /* Unused for now */ - // findProperty(type) { - // return this.data.properties.find(p => p.type === type); - // } + /* Find property by type (and instance) */ + findProperty(type, instance) { + const {properties} = this.data; + if (instance != undefined) { + return properties.find(p => p.type === type && p.state.instance === instance); + } else { + return properties.find(p => p.type === type); + } + } /* Find 'set' topic by instance*/ findTopicByInstance(instance) {