diff --git a/apps/sleepphasealarm/ChangeLog b/apps/sleepphasealarm/ChangeLog index 80b2e554b..795c62fa2 100644 --- a/apps/sleepphasealarm/ChangeLog +++ b/apps/sleepphasealarm/ChangeLog @@ -12,3 +12,4 @@ Add setting to disable scheduler alarm 0.10: Fix: Do not wake when falling asleep 0.11: Minor tweaks +0.12: Support javascript command to execute as defined in scheduler 'js' configuration diff --git a/apps/sleepphasealarm/app.js b/apps/sleepphasealarm/app.js index a5193b244..ba8bff9b2 100644 --- a/apps/sleepphasealarm/app.js +++ b/apps/sleepphasealarm/app.js @@ -173,12 +173,16 @@ if (nextAlarmDate !== undefined) { setTimeout(load, 1000); } else if (measure && now >= minAlarm && swest === false) { addLog(now, "alarm"); - buzz(); measure = false; - if (config.settings.disableAlarm) { - // disable alarm for scheduler - nextAlarmConfig.last = now.getDate(); - require("Storage").writeJSON("sched.json", alarms); + if (nextAlarmConfig.js) { + eval(nextAlarmConfig.js); // run nextAlarmConfig.js if set + } else { + buzz(); + if (config.settings.disableAlarm) { + // disable alarm for scheduler + nextAlarmConfig.last = now.getDate(); + require('Storage').writeJSON('sched.json', alarms); + } } } }); diff --git a/apps/sleepphasealarm/metadata.json b/apps/sleepphasealarm/metadata.json index fd3366812..ced99062f 100644 --- a/apps/sleepphasealarm/metadata.json +++ b/apps/sleepphasealarm/metadata.json @@ -2,7 +2,7 @@ "id": "sleepphasealarm", "name": "SleepPhaseAlarm", "shortName": "SleepPhaseAlarm", - "version": "0.11", + "version": "0.12", "description": "Uses the accelerometer to estimate sleep and wake states with the principle of Estimation of Stationary Sleep-segments (ESS, see https://ubicomp.eti.uni-siegen.de/home/datasets/ichi14/index.html.en). This app will read the next alarm from the alarm application and will wake you up to 30 minutes early at the best guessed time when you are almost already awake.", "icon": "app.png", "tags": "alarm",