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 second trigger not working

    Scheduled Pinned Locked Moved Solved Troubleshooting
    14 Posts 3 Posters 4.4k Views 3 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.
    • A Offline
      Arynio
      last edited by

      Basically, I want to use MMM-NotificationTrigger to turn my TV on and off by using the notification(MOTION_DETECTED with some value) from MMM-MotionDetector.
      This is my config for MMM-NotificationTrigger:
      {
      module: “MMM-NotificationTrigger”,
      config: {
      triggers:[
      {
      trigger: “MOTION_DETECTED”,
      fires: [
      {
      fire:“TURN_OFF”,
      exec: “echo ‘on 0.0.0.0’ | cec-client -s -d 1”,
      },
      ],
      },
      {
      trigger: “TURN_OFF”,
      fires: [
      {
      delay: 20000,
      fire: “OKAY”,
      exec: “echo ‘standby 0.0.0.0’ | cec-client -s -d 1”,
      },
      ],
      },
      ]
      }

      },

      The turning on part works, however the second trigger never reacts to the TURN_OFF and never sends an OKAY. Am I doing something wrong ?

      S M 3 Replies Last reply Reply Quote 0
      • S Offline
        sdetweil @Arynio
        last edited by

        @arynio delay is 20 seconds… a long time

        maybe try 2000

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        A 1 Reply Last reply Reply Quote 0
        • A Offline
          Arynio @sdetweil
          last edited by

          @sdetweil Have tried that, but that doesn’t change anything.
          My main problem is that the second trigger never reacts.
          I have never seen it fire a OKAY as an answer

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @Arynio
            last edited by sdetweil

            @arynio who is listening for the fire notification?

            not in your config.

            turn_off fires okay after 20 seconds

            but no one is listening for it

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            A 1 Reply Last reply Reply Quote 0
            • A Offline
              Arynio @sdetweil
              last edited by

              @sdetweil Yeah TURN_OFF fires fine.
              MMM-NotificationTrigger is supposed to listen to its own TURN_OFF and fire again so that it will turn the screen off after a 20-second delay

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @Arynio
                last edited by

                @arynio add a module that reports all the notifications

                my SampleModule does this
                https://github.com/sdetweil/SampleModule

                then open the developers window, ctrl-shift-i on the keyboard, and select the console tab to see the messages

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                A 1 Reply Last reply Reply Quote 0
                • A Offline
                  Arynio @sdetweil
                  last edited by

                  @sdetweil Can i do this via ssh or do I have to connect my keyboard to my pi?

                  S 1 Reply Last reply Reply Quote 0
                  • S Offline
                    sdetweil @Arynio
                    last edited by

                    @arynio if u set

                    address:“0.0.0.0”,
                    ipWhitelist:[],

                    in config.js for mm

                    then you can use a browser on your PC to access mm, and do the same debugging

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      Arynio
                      last edited by

                      @sdetweil
                      This is what happens when motion is detected:

                      MMM-MotionDetector: Motion detected, score 28
                      MMM-NotificationTrigger.js:84 [NOTTRG] TURN_OFF is emitted.
                      MMM-MotionDetector.js:89 MMM-MotionDetector: Motion detected, score 29
                      MMM-NotificationTrigger.js:84 [NOTTRG] TURN_OFF is emitted.
                      MMM-MotionDetector.js:89 MMM-MotionDetector: Motion detected, score 67
                      MMM-NotificationTrigger.js:84 [NOTTRG] TURN_OFF is emitted.
                      null:1 GET http://localhost:8080/null 404 (Not Found)
                      Image (async)
                      getDom @ MMM-EveryNews.js:118
                      (anonymous) @ main.js:113
                      updateDom @ main.js:111
                      updateDom @ main.js:550
                      updateDom @ module.js:358
                      (anonymous) @ MMM-EveryNews.js:146
                      MMM-NotificationTrigger.js:42 [NOTTRG] Execution Result: {trigger: ‘MOTION_DETECTED’, fire: ‘TURN_OFF’, error: null, stdout: ‘opening a connection to the CEC adapter…\n’, stderr: ‘’}
                      MMM-NotificationTrigger.js:42 [NOTTRG] Execution Result: {trigger: ‘MOTION_DETECTED’, fire: ‘TURN_OFF’, error: null, stdout: ‘opening a connection to the CEC adapter…\nERROR: … 4085]\tcould not open a connection (try 5)\n’, std>
                      MMM-NotificationTrigger.js:42 [NOTTRG] Execution Result: {trigger: ‘MOTION_DETECTED’, fire: ‘TURN_OFF’, error: {…}, stdout: ‘opening a connection to the CEC adapter…\nERROR: … 10208]\tcould not start CEC communications\n’, stde>null:1 GET http://localhost:8080/null 404 (Not Found)

                      So i know that there are some erros about not being able to connect but it still works fine regardless.
                      Still the main problem is that TURN_OFF is emitted but I never get a reaction to it from my second trigger.

                      S 1 Reply Last reply Reply Quote 0
                      • S Offline
                        sdetweil @Arynio
                        last edited by sdetweil

                        @arynio said in MMM-NotificationTrigger second trigger not working:

                        stdout: ‘opening a connection to the CEC adapter…\nERROR: … 10208]\tcould not start CEC communications\n’,

                        so there was an error

                        did it get emitted? (NOTTRG)
                        does it depend on the results from exec?
                        ( I do not know anything about module, just guessing)

                        do u see it on the notifications received by other modules?

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        A 1 Reply Last reply Reply Quote 0
                        • A Offline
                          Arynio @sdetweil
                          last edited by

                          @sdetweil Yes the TURN_OFF gets emitted and i can see it. But MMM-NotificationTrigger doesn’t react to it, doesn’t fire the OKAY and doesnt execute the “echo ‘standby 0.0.0.0’ | cec-client -s -d 1”

                          1 Reply Last reply Reply Quote 0
                          • M Offline
                            MMRIZE @Arynio
                            last edited by

                            @arynio
                            I haven’t tested. But as far as I know, a notification from the module itself would not be heard by itself to prevent infinite loop possibility.

                            1 Reply Last reply Reply Quote 1
                            • M Offline
                              MMRIZE @Arynio
                              last edited by MMRIZE

                              @arynio

                              https://github.com/MichMich/MagicMirror/blob/26a76f80d63e5c9746b6db712d6901219f8b6b93/js/main.js#L97-L99

                              if (module !== sender && (!sendTo || module === sendTo)) {
                                module.notificationReceived(notification, payload, sender);
                              }
                              

                              module.notifcationReceived() doesn’t work when the recipient module and the sending module are the same.
                              A module cannot hear its voice.

                              If you want to use a chained shell commands with delay, make .sh file and execute it.

                              A 1 Reply Last reply Reply Quote 1
                              • A Offline
                                Arynio @MMRIZE
                                last edited by

                                @mmrize Okay will do that thanks

                                1 Reply Last reply Reply Quote 0

                                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                With your input, this post could be even better 💗

                                Register Login
                                • 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