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-NotificationTrigger

    Scheduled Pinned Locked Moved System
    8 Posts 2 Posters 3.0k Views 4 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.
    • ? Offline
      A Former User
      last edited by A Former User

      MMM-NotificationTrigger

      This module could relay or convert notifications from some module’s to other module’s.
      Modules have their own incoming and outgoing notifications, but most of them are not compatible with each other. Some modules may have the user-configurable notification name or payload, but most are not. In that case, you should modify the module to make possible to understand or to broadcast other’s notification. Those are normally hardcoded in the modules, it means you should re-edit after upgrading.

      With MMM-NotificationTrigger, you can TRANSLATE one notification from other notification(s). And you can make a CHAIN to activate multi-modules together, even conditionally.

      For example, You might be using MMM-motion-detection and MMM-Remote-Control, but your MMM-motion-detection can emit only motion-detected and motion-stopped notifications unless you modify the module itself.

      Now with MMM-NotificationTrigger,

      1. you can translate motion-detected notification to REMOTE_ACTION {action:"MONITORON"} which is understandable by MMM-Remote-Control module.
      2. At the same time, you can activate another ALERT module for showing greeting message automatically,
      3. And even more, you can change the greeting message by time.(or any condition)

      Ok, this is just an example. I believe you can find more usages for your real purpose by yourself.

      Screenshot

      This module works in background, so there is no screenshot.

      See the details and download

      [card:eouia/MMM-NotificationTrigger]

      UPDATE

      2018-10-02

      • exec is added. Now you can execute your external shell command or script by notification.
      {
        module: "MMM-NotificationTrigger",
        config: {
          triggers:[
            {
              trigger: "DOM_OBJECTS_CREATED",
              fires: [
                {
                  fire:"MY_COMMAND",
                  exec: "sleep 5; ls -l"
                },
              ],
            },
          ]
        }
      },
      
      1 Reply Last reply Reply Quote 2
      • ? Offline
        A Former User
        last edited by

        UPDATE

        2018-10-02

        • exec is added. Now you can execute your external shell command or script by notification.
        {
          module: "MMM-NotificationTrigger",
          config: {
            triggers:[
              {
                trigger: "DOM_OBJECTS_CREATED",
                fires: [
                  {
                    fire:"MY_COMMAND",
                    exec: "sleep 5; ls -l"
                  },
                ],
              },
            ]
          }
        },
        
        1 Reply Last reply Reply Quote 2
        • M Offline
          MilkShake
          last edited by MilkShake

          Hi Everyone,
          Can some help me create a Notification trigger that fires multiple commands?

          So I have a gate that calls PLAY_SOUND when the gate button is pressed. Besides playing the sound I would like to show an alert and wake up the screen.

          So playing the sound and wakening the screen works. But I would like to add an Alert as well. The working config is like this:

          {
                module: "MMM-NotificationTrigger",
                config: {
                  triggers:[
                    {
                      trigger: "PLAY_SOUND",
                      fires: [
                        {
                          fire:"USER_PRESENCE",
                          payload: function(payload) {
                            return false
                          },
                        },
                      ],
                    },
                  ]
                }
           },
          

          Now, if I wan’t and alert on the same event, I tried this:

          {
                module: "MMM-NotificationTrigger",
                config: {
                  triggers:[
                    {
                      trigger: "PLAY_SOUND",
                      fires: [
                        {
                          fire:"USER_PRESENCE",
                          payload: function(payload) {
                            return false
                          },
          
          		{
                          fire:"SHOW_ALERT",
                      	payload: function() {
                        	return {
                          type:"notification",
                          title:"Porten",
                          message: "Der er nogen ved porten!"
                          },
                        },
                      ],
                    },
                  ]
                }
           },
          

          But it does not work.

          Any help appreciated…

          Best
          MilkShake

          ? 1 Reply Last reply Reply Quote 0
          • ? Offline
            A Former User @MilkShake
            last edited by A Former User

            @MilkShake

            It works.

            Anyway, this is more cleaner configuration.

            {
              module: "MMM-NotificationTrigger",
              config: {
                triggers:[
                  {
                    trigger: "PLAY_SOUND",
                    fires: [
                      {
                        fire:"USER_PRESENCE",
                      },
                      {
                        fire:"SHOW_ALERT",
                        payload: {
                          type:"notification",
                          title:"Porten",
                          message: "Der er nogen ved porten!",
                        },
                      },
                    ],
                  },
                ]
              }
            },
            
            M 1 Reply Last reply Reply Quote 0
            • M Offline
              MilkShake @Guest
              last edited by

              @Sean I also tried that. The Alert does not show up in MM. It wakes the screen with USER_PRESENCE and plays the sound, but no Alert.

              ? 1 Reply Last reply Reply Quote 0
              • ? Offline
                A Former User @MilkShake
                last edited by

                @MilkShake Well, I don’t know why your ALERT module is not working, but as you see the screenshot, it should work. And, probably the reason might not be this module’s responsibility.

                M 2 Replies Last reply Reply Quote 0
                • M Offline
                  MilkShake @Guest
                  last edited by

                  @Sean Yeah, I see that. When I fire this

                  http://MM_IP:8080/remote?action=SHOW_ALERT&message=Der%er%nogen%ved%porten!&title=PORT&timer=10&type=alert

                  it displays the alert.

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    MilkShake @Guest
                    last edited by

                    @Sean I got it to work using:

                    {
                          module: "MMM-NotificationTrigger",
                          config: {
                            triggers:[
                              {
                                trigger: "PLAY_SOUND",
                                fires: [
                                  {
                                    fire:"USER_PRESENCE",
                                    payload: function(payload) {
                                      return false
                                    },
                    
                        {
                                    fire:"SHOW_ALERT",
                                  payload: function(payload) {
                                    return {
                                    type:"notification",
                                    title:"Porten",
                                    message: "Der er nogen ved porten!"
                                    },
                                  },
                                ],
                              },
                            ]
                          }
                     },
                    

                    Thanks for helping!

                    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