Skip to content

Commit

Permalink
Limit frame duration to 10 seconds (limited by LaMetric)
Browse files Browse the repository at this point in the history
  • Loading branch information
klein0r committed Oct 29, 2024
1 parent ff28abf commit 5556744
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion admin/jsonConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@
},
"filter": false,
"sort": false,
"default": 5
"default": 5,
"min": 1,
"max": 10,
"step": 1
}
]
},
Expand Down
10 changes: 8 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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}`);

Expand Down

0 comments on commit 5556744

Please sign in to comment.