Skip to content

Commit

Permalink
additional fix for timer values yaml handle
Browse files Browse the repository at this point in the history
  • Loading branch information
dmatik committed Dec 30, 2024
1 parent 8cd7f60 commit 99d8de6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dist/switcher-boiler-card-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ class SwitcherBoilerCardEditor extends LitElement {
setConfig(config) {
this._config = {
...config,
timer_values: (config.timer_values || ["15", "30", "45", "60"]).sort((a, b) => parseInt(a) - parseInt(b)),
timer_values: [...new Set((config.timer_values || ['15', '30', '45', '60'])
.map(Number) // Convert all values to numbers
.filter((value) => value >= 1 && value <= 150) // Keep only values in the range of 1 and 150
.sort((a, b) => a - b) // Sort numerically
.map(String) // Convert back to strings
)],
};
}

Expand Down

0 comments on commit 99d8de6

Please sign in to comment.