Permalink
Browse files

Alarm timer option

Add a new option to alarm.
  • Loading branch information...
Ybbet committed Jul 4, 2018
1 parent c5a4cda commit fbf5fb017e4b1581094761b080d40f547bf24cce
Showing with 26 additions and 4 deletions.
  1. +6 −0 CHANGELOG.md
  2. +7 −2 MMM-AlarmClock.js
  3. +12 −1 README.md
  4. +1 −1 package.json
@@ -1,5 +1,11 @@
# MMM-AlarmClock Changelog
## [1.1.1]
### Added
* Add a new alarm option : timer
## [1.1.0]
### Added
@@ -141,15 +141,20 @@ Module.register('MMM-AlarmClock', {
title: this.next.sender || this.next.title,
message: this.next.message
};
let timer = this.config.timer;
if (!this.config.touch) {
alert.timer = this.config.timer;
alert.timer = timer;
}
// If the alarm has specific timer and if MM is not touch, we use the alarm timer.
if (typeof this.next.timer !== "undefined" && !this.config.touch) {
alert.timer = timer = this.next.timer;
}
this.sendNotification('SHOW_ALERT', alert);
this.alarmFired = true;
this.updateDom(300);
this.timer = setTimeout(() => {
this.resetAlarmClock();
}, this.config.timer);
}, timer);
if (this.config.touch) {
MM.getModules().enumerate((module) => {
if (module.name === 'alert') {
@@ -43,6 +43,17 @@ Alarm Clock Module for MagicMirror<sup>2</sup>
| `fadeTimer` | `60 * 1000` (1 min) | How long to fade into the alarm before `volume` is set.
| `fadeStep` | `.005` (.5%) | Increase the volume this percent amount each second until `fadeTimer` is reached.
## Alarm Options
| **Option**| **Description** |
| --- | --- |
| `time` | Time at which the alarm should sound. |
| `days` | Days of the week. <br/>``0 => Sunday, 1 => Monday, 2 => Tuesday, 3 => Wednesday, 4 => Thursday, 5 => Friday, 6 => Saturday``<br/><br/>**Example :** ``[1, 2, 3, 4, 5], // From Monday to Friday.`` |
| `title` | Title that will be displayed in the alert. |
| `message` | Message of the alarm |
| `sound` | Name or the url of the mp3 file. By default, the sound of the config will be use if this option is empty. |
| `timer` | Timer when the alarm will end. By default, the timer of the configuration will be used. |
## Alarm Sounds
There are already two alarm sounds:
@@ -57,4 +68,4 @@ There are already two alarm sounds:
### Documentation
The documentation can be found [here](https://doclets.io/fewieden/MMM-AlarmClock/master)
The documentation can be found [here](https://doclets.io/fewieden/MMM-AlarmClock)
@@ -1,6 +1,6 @@
{
"name": "mmm-alarmclock",
"version": "1.1.0",
"version": "1.1.1",
"description": "Alarm Clock Module for MagicMirror2",
"scripts": {
"lint": "./node_modules/.bin/eslint . && ./node_modules/.bin/stylelint .",

0 comments on commit fbf5fb0

Please sign in to comment.