diff --git a/apps/sleeplogalarm/ChangeLog b/apps/sleeplogalarm/ChangeLog index 5560f00bc..0030c8783 100644 --- a/apps/sleeplogalarm/ChangeLog +++ b/apps/sleeplogalarm/ChangeLog @@ -1 +1,2 @@ 0.01: New App! +0.02: Add "from Consec."-setting \ No newline at end of file diff --git a/apps/sleeplogalarm/README.md b/apps/sleeplogalarm/README.md index 42c2d6074..184eb4b53 100644 --- a/apps/sleeplogalarm/README.md +++ b/apps/sleeplogalarm/README.md @@ -1,27 +1,40 @@ # Sleep Log Alarm -This widget searches for active alarms and raises the alarm event up to the defined time earlier, if in a light sleep phase. +This widget searches for active alarms and raises an own alarm event up to the defined time earlier, if in light sleep or awake phase. Optional the earlier alarm will only be triggered if comming from or in consecutive sleep. The settings of the earlier alarm can be adjusted and it is possible to filter the targeting alarms by time and message. By default the time of the targeting alarm is displayed inside the widget which can be adjusted, too. --- -### App Usage +### Settings --- -#### Inside the settings: !!! dummy entries !!! - - __Thresholds__ submenu - Changes take effect from now on, not retrospective! - - __Max Awake__ | maximal awake duration - _10min_ / _20min_ / ... / __60min__ / ... / _120min_ - - __Min Consecutive__ | minimal consecutive sleep duration - _10min_ / _20min_ / ... / __30min__ / ... / _120min_ - - __Deep Sleep__ | deep sleep threshold - _30_ / _31_ / ... / __100__ / ... / _200_ - - __Light Sleep__ | light sleep threshold - _100_ / _110_ / ... / __200__ / ... / _400_ - - __Reset to Default__ | reset to bold values above - - __BreakToD__ | time of day to break view - _0:00_ / _1:00_ / ... / __12:00__ / ... / _23:00_ - - __App Timeout__ | app specific lock timeout - __0s__ / _10s_ / ... / _120s_ + - __earlier__ | duration to trigger alarm earlier + _10min_ / _20min_ / __30min__ / ... / _120min_ + - __from Consec.__ | only trigger if comming from consecutive sleep + _on_ / __off__ + - __vib pattern__ | vibration pattern for the earlier alarm + __..__ / ... + - __msg__ | customized message for the earlier alarm + __...__ / ... + - __msg as prefix__ | use the customized message as prefix to the original message or replace it comlpetely if disabled + __on__ / _off_ + - __disable alarm__ | if enabled the original alarm will be disabled + _on_ / __off__ + This feature does not work for alarms on the next day! + - __auto snooze__ | auto snooze option for the earlier alarm + __on__ / _off_ + - __Filter Alarm__ submenu + - __time from__ | exclude alarms before this time + _0:00_ / _0:15_ / ... / __3:00__ / ... / _24:00_ + - __time to__ | exclude alarms after this time + _0:00_ / _0:15_ / ... / __12:00__ / ... / _24:00_ + - __msg includes__ | include only alarms including this string in msg + __""__ / ... + - __Widget__ submenu + - __hide__ | completely hide the widget + _on_ / __off__ + - __show time__ | show the time of the targeting alarm + __on__ / _off_ + - __color__ | color of the widget + _red_ / __yellow__ / ... / _white_ - __Enabled__ | completely en-/disables the background service __on__ / _off_ diff --git a/apps/sleeplogalarm/app.png b/apps/sleeplogalarm/app.png index 6efb22a3f..1a8e53865 100644 Binary files a/apps/sleeplogalarm/app.png and b/apps/sleeplogalarm/app.png differ diff --git a/apps/sleeplogalarm/lib.js b/apps/sleeplogalarm/lib.js index f899ae54e..71210f98b 100644 --- a/apps/sleeplogalarm/lib.js +++ b/apps/sleeplogalarm/lib.js @@ -29,14 +29,15 @@ exports = { return Object.assign({ enabled: true, earlier: 30, - filter_from: 3, - filter_to: 12, - filter_msg: "", + fromConsec: false, vibrate: "..", msg: "...\n", msgAsPrefix: true, disableOnAlarm: false, // !!! not available if alarm is at the next day as: true, + filter_from: 3, + filter_to: 12, + filter_msg: "", wid_hide: false, wid_time: true, wid_color: g.theme.dark ? 65504 : 31, // yellow or blue @@ -72,7 +73,9 @@ exports = { to: this.time - 1, fn: function (data) { // execute trigger function if on light sleep or awake - if (data.status === 3 || data.status === 2) + // and if set if comming from consecutive + if ((data.status === 3 || data.status === 2) && !settings.fromConsec || + data.consecutive === 3 || data.prevConsecutive === 3) require("sleeplogalarm").trigger(); } }; diff --git a/apps/sleeplogalarm/metadata.json b/apps/sleeplogalarm/metadata.json index fc1d546da..1a37ffcbf 100644 --- a/apps/sleeplogalarm/metadata.json +++ b/apps/sleeplogalarm/metadata.json @@ -2,7 +2,7 @@ "id":"sleeplogalarm", "name":"Sleep Log Alarm", "shortName": "SleepLogAlarm", - "version": "0.01", + "version": "0.02", "description": "Enhance your morning and let your alarms wake you up when you are in light sleep.", "icon": "app.png", "type": "widget", diff --git a/apps/sleeplogalarm/settings.js b/apps/sleeplogalarm/settings.js index fe774c3b2..3a37b7274 100644 --- a/apps/sleeplogalarm/settings.js +++ b/apps/sleeplogalarm/settings.js @@ -30,12 +30,12 @@ "": { title: "Filter Alarm" }, - /*LANG*/"< Back": () => showMain(2), + /*LANG*/"< Back": () => showMain(8), /*LANG*/"time from": { value: settings.filter_from, step: 0.25, min: 0, - max: 23, + max: 24, wrap: true, noList: true, format: v => (0|v) + ":" + ("" + (0|(v%1 * 60))).padStart(2, "0"), @@ -47,7 +47,7 @@ /*LANG*/"time to": { value: settings.filter_to, step: 0.25, - min: 1, + min: 0, max: 24, wrap: true, noList: true, @@ -78,7 +78,7 @@ "": { title: "Widget Settings" }, - /*LANG*/"< Back": () => showMain(8), + /*LANG*/"< Back": () => showMain(9), /*LANG*/"hide": { value: settings.wid_hide, onchange: v => { @@ -130,7 +130,13 @@ writeSetting(); } }, - /*LANG*/"Filter Alarm": () => showFilterMenu(), + /*LANG*/"from Consec.": { + value: settings.fromConsec, + onchange: v => { + settings.fromConsec = v; + writeSetting(); + } + }, /*LANG*/"vib pattern": require("buzz_menu").pattern( settings.vibrate, v => { @@ -165,6 +171,7 @@ writeSetting(); } }, + /*LANG*/"Filter Alarm": () => showFilterMenu(), /*LANG*/"Widget": () => showWidMenu(), /*LANG*/"Enabled": { value: settings.enabled,