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.

    Notifications help

    Scheduled Pinned Locked Moved Solved Troubleshooting
    7 Posts 3 Posters 1.5k 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.
    • S Offline
      sdmydbr9
      last edited by

      Trying to capture notifications for a module, can anyone tell me what’s wrong with this mai js, my objective for now is to capture the SHOW_ALERT notification and print it in the console log. Here is the mainjs

      Module.register("MMM-11-TTS", {
          start: function() {
              console.log(`Starting module: ${this.name}`);
          },
      
          notificationReceived: function(notification, payload) {
              if (notification === 'SHOW_ALERT') {
                  console.log(`Received notification: ${notification}`);
                  console.log(`Payload: ${payload}`);
              }
          }
      });
      
      
      S BKeyportB 2 Replies Last reply Reply Quote 1
      • S Offline
        sdmydbr9 @sdetweil
        last edited by

        @sdetweil
        Got it thanks

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

          @sdmydbr9 module name = module folder name = module_name.js = register name

          all must match exactly, case matters

          @sdmydbr9 said in Notifications help:

          MMM-11-TTS

          , right?

          only displayed in the dev console log unless u install mmm-logging

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          S 1 Reply Last reply Reply Quote 0
          • BKeyportB Offline
            BKeyport Module Developer @sdmydbr9
            last edited by

            @sdmydbr9 In my case, it helped me tremendously to have MMM-ViewNotifications installed on my test system, so I could eliminate if it was my code or the notification.

            https://github.com/glitch452/MMM-ViewNotifications

            The "E" in "Javascript" stands for "Easy"

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

              @sdetweil well they match, the folder, the module name and module.js.
              The folder is MMM-11-TTS under the modules directory.
              Under that directory is MMM-11-TTS.js module. I have also specified the config.js to consider this module.
              The contents of the MMM-11-TTS.js posted earlier, is that correct or if there is anything missing, can you please provide me the updated code.

              1 Reply Last reply Reply Quote 0
              • S Offline
                sdmydbr9 @BKeyport
                last edited by

                @BKeyport I did that and it’s definitely my code, I can see the notification is being sent by the SHOW_ALERT but my module is not able to capture them, I tried different codes and hit mental block now.

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

                  @sdmydbr9 I replied on discord

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

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

                    @sdetweil
                    Got it 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