Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per-alarm timeout not working #49

Open
thisisjjd opened this issue Aug 19, 2024 · 0 comments
Open

Per-alarm timeout not working #49

thisisjjd opened this issue Aug 19, 2024 · 0 comments

Comments

@thisisjjd
Copy link

Platform (Hardware/OS): Raspberry Pi 3 Model B Rev 1.2, Raspbian GNU/Linux 12 (bookworm)

Node version: 20.15.0

MagicMirror version: v2.28.0

Module version: 2.0.2

Description of the issue:

From my testing, the per-alarm "timer" value is ignored.

I have tried both with and without an overall "timer" value being set. The overall timer value is used whether or not a per-alarm timer is set. If there is no overall timer value set, then the per-alarm value of "timer" seems to be ignored and the default per-alarm timer of 1 minute is used.

Here is a summary of my testing:

overall              per-alarm                    result
-------------------------------------------
set                  not set                         overall value is used
set                  set                             overall value is used
not set              set                             default overall 1-minute value is used
not set              not set                         default overall 1-minute value is used

Looking at the code, if I'm reading it right, it appears the per-alarm timer is ignored if "touch" is enabled:

            let timer = this.config.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) {
                timer = this.next.timer;
            }
            if (!this.config.touch) {
                alert.timer = timer;
            }

Is there a way to set per-alarm timeouts even if you have "touch" enabled?

Here is what my config looks like:

	{
	    disabled: false,
	    module: 'MMM-AlarmClock',
	    position: 'top_center',
	    config: {
		alarms: [
		    { 
			time: "06:00",
			days: [1,2,3,4,5], 
			title: "Wake Up for work",
			message: "You have to go to work today",
			sound: "https://fm909.wbur.org/wbur_www",
			timer: 60 * 60 * 1000 
		    },
		    { 
			time: "11:28", 
			days: [0,1,2,3,4,5,6],
			title: "Test alarm",
			message: "Will it blend?",
			sound: "https://fm909.wbur.org/wbur_www",
			timer: 30 * 1000 
		    },
		],
		// overall timer setting commented out
		// timer: 60 * 60 * 1000, 
		format: "dd H:mm",
		touch: true,
		popup: true,
		fade: true,
		fadeTimer: 30000,
		fadeStep: 0.0333,
	    }
	},

In this example (with the overall "timer setting commented out), "Test alarm" goes off at 11:28, but doesn't stop after 30 seconds. Instead, it continues until the (default) 60 seconds and then stops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant