Skip to content

sigel/MMM-Sounds2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MMM-Sounds2

Based on MMM-Sounds but rather than playing the sound locally it gets played in browser for those who host their MagicMirror on a separate server.

NOTE: Chrome blocks the autoplay of sounds until you interact with the site. Adding --autoplay-policy=no-user-gesture-required should do the trick, here is how I launch mine on my pi.

chromium-browser --noerrdialogs --autoplay-policy=no-user-gesture-required --kiosk --incognito https://dash.url.com

Module Installation

  1. Navigate into your MagicMirror's modules folder and execute git clone https://github.com/sigel/MMM-Sounds2.git

Using the module

To use this module, add it to the modules array in the config/config.js file:

modules: [
	{
		module: 'MMM-Sounds2',
		config: {
			startupSound:	true,	// Play sound on startup
			alertSound:	true,	// Play alert sound when alert module is triggered
			quietTimeStart:	'23:00',	// 11pm
			quietTimeEnd:	'07:00'	// 7am
		}
	}
]

Configuration options

The following properties can be configured:

Option Description
startupSound Play sound after module startup

Possible values: boolean
Default value: true
alertSound Play sound for alert module

Possible values: boolean
Default value: true
defaultDelay The default delay before playing the file in milliseconds

Possible values: integer
Default value: 10
quietTimeStart The 24 hour and minute start of Quiet time

Possible values: string
Default value: null
quietTimeEnd The 24 hour and minute end of Quiet time

Possible values: string
Default value: null
debug Enable to display more debug messages in console

Possible values: bool
Default value: false

Quiet Times

This module supports not playing sounds during a quiet time, if BOTH the quietTimeStart and quietTimeEnd config options are specified.

The values for these times are HH:mm and must be in 24 hour format. Examples:

  • 00:30 - 12:30am
  • 06:30 - 6:30am
  • 14:11 - 2:11pm
  • 23:30 - 11:30pm

Telling the module to play sounds from another module

From another module you can tell this module to play a sound in 2 ways:

In your module:

self.sendNotification('PLAY_ALERT', 'alert');

or also specifying a delay:

self.sendNotification('PLAY_ALERT', {sound: 'alert', delay: 1000}); // 1 second delay

Included sounds

  • alert
  • announcement
  • bells
  • chord
  • notify
  • startup
  • synth

About

MagicMirror Module to play Sounds

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%