From 5556744ea1f86bd68bea9a6f029bf93d3e613f5b Mon Sep 17 00:00:00 2001 From: Matthias Kleine Date: Tue, 29 Oct 2024 11:38:28 +0100 Subject: [PATCH] Limit frame duration to 10 seconds (limited by LaMetric) --- README.md | 4 ++++ admin/jsonConfig.json | 5 ++++- main.js | 10 ++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 91ee8e7..0cfda00 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,10 @@ iobroker add lametric Placeholder for the next version (at the beginning of the line): ### **WORK IN PROGRESS** --> +### **WORK IN PROGRESS** + +* (@klein0r) Limit frame duration to 10 seconds (limited by LaMetric) + ### 3.4.0 (2024-09-06) * (@klein0r) Updated LaMetric firmware version recommendation to 2.3.9 (3.1.2) diff --git a/admin/jsonConfig.json b/admin/jsonConfig.json index 1d4fc7b..11612f0 100644 --- a/admin/jsonConfig.json +++ b/admin/jsonConfig.json @@ -168,7 +168,10 @@ }, "filter": false, "sort": false, - "default": 5 + "default": 5, + "min": 1, + "max": 10, + "step": 1 } ] }, diff --git a/main.js b/main.js index 515a8b0..b607aed 100644 --- a/main.js +++ b/main.js @@ -1688,9 +1688,15 @@ class LaMetric extends utils.Adapter { replacedText = ''; // will be removed in filter function (see below) } + let duration = f?.duration ?? 5; + + if (duration > 10) { + duration = 10; // 10 seconds is the limit + } + const newObj = { text: replacedText.trim(), - duration: f?.duration ? f.duration * 1000 : 5000, + duration: duration * 1000, // ms }; if (f.icon) { @@ -1719,7 +1725,7 @@ class LaMetric extends utils.Adapter { if (this.config.type === 'push') { if (!this.myDataDiyApp) { - this.log.warn(`[mydatadiy] unable to push changes to device - app package id not found`); + this.log.warn(`[mydatadiy] unable to push changes to device - app package id not found (app installed?)`); } else if (newFrames.length > 0) { this.log.debug(`[mydatadiy] pusing changes to device - app ${this.myDataDiyApp}`);