MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-NotifCustomActions

    Scheduled Pinned Locked Moved System
    1 Posts 1 Posters 211 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      Matuki Module Developer
      last edited by Matuki

      Description:

      MMM-NotifCustomActions is a technical module designed to do the glue between modules or do simple JS function.

      It reacts on module notifications.

      For example, it can send a specific notification to a module or execute a shell command when another module broadcasts a notification.

      JS functions can be executed on browser side or on server side (ex: shutdown).
      For simple JS code, all can be written in module config; for complex JS functions 2 specific files are automatically loaded and are accessible by the module.

      Example of simple configuration

      This example does:

      • a shutdown command (node side) when notification ACTION_SHUTDOWN is received.
      • a sent of notification PAGE_SELECT with payload "musicPage" (client side) when notification SPOTIFY_CONNECTED is received.
      actions: [
      	{
      		notification: "ACTION_SHUTDOWN",
      		action_node: function(self, sender, payload) {
      			exec("sudo shutdown -h now");
      		}
      	},
      	{
      		notification: "SPOTIFY_CONNECTED",
      		action_client: function(self, sender, payload) {
      			self.sendNotification("PAGE_SELECT", "musicPage");
      		}
      	},
      ]
      

      Download:

      https://github.com/seb-ma/MMM-NotifCustomActions

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Enjoying MagicMirror? Please consider a donation!
      MagicMirror created by Michael Teeuw.
      Forum managed by Sam, technical setup by Karsten.
      This forum is using NodeBB as its core | Contributors
      Contact | Privacy Policy