widalarmeta: use sched lib and remove template comment

pull/3232/head
Rob Pilling 2024-03-02 16:11:36 +00:00
parent 4c0eccaf67
commit a25ed8f6ff
1 changed files with 4 additions and 2 deletions

View File

@ -19,7 +19,10 @@
loadSettings();
function getNextAlarm(date) {
const alarms = (require("Storage").readJSON("sched.json",1) || []).filter(alarm => alarm.on && alarm.hidden !== true);
const alarms = require("sched")
.getAlarms()
.filter(alarm => alarm.on && alarm.hidden !== true);
WIDGETS["widalarmeta"].numActiveAlarms = alarms.length;
if (alarms.length > 0) {
const times = alarms.map(alarm => require("sched").getTimeToAlarm(alarm, date) || Number.POSITIVE_INFINITY);
@ -116,7 +119,6 @@
} /* draw */
if (config.maxhours > 0) {
// add your widget
WIDGETS["widalarmeta"]={
area:"tl",
width: 0, // hide by default = assume no timer