• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

Send existing Notifications from a script

Scheduled Pinned Locked Moved Development
15 Posts 3 Posters 2.6k 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
    sdetweil @thetobyde
    last edited by Jun 29, 2020, 12:52 AM

    @thetobyde and the module code with the buttons?

    Sam

    How to add modules

    learning how to use browser developers window for css changes

    T 1 Reply Last reply Jun 29, 2020, 1:59 AM Reply Quote 0
    • T Offline
      thetobyde @sdetweil
      last edited by Jun 29, 2020, 1:59 AM

      @sdetweil didt change that because it worked for the pre-existing Shutdown and Reboot button from the developer of MMM-smartTouch… isnt it right?

      1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @thetobyde
        last edited by Jun 29, 2020, 2:04 AM

        @thetobyde said in Send existing Notifications from a script:

        require('child_process').this.sendSocketNotification("PAGE_CHANGED", 1);
        

        well, you are not launching a program to chnage the page, and don’t need to send this down to the node_helper
        as he has to send it back up to the module to send the notfication,

        just do the sendNotification from the module (note its not sendsocketNotification(to my node helper) , just sendNotification(to other modules)

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • L Offline
          lavolp3 Module Developer
          last edited by lavolp3 Jun 29, 2020, 7:30 AM Jun 29, 2020, 7:27 AM

          @thetobyde if you haven’t figured it out yet, have a look at my module https://github.com/lavolp3/MMM-NavigationBar which kind of does what you want. This one is using MMM-pages as well.

          ALl that I needed for this to work out is this:

            getDom: function() {
              var container = document.createElement("div");
              container.className = "naviContainer";
              self = this;
              for (var i = 0; i < this.config.sections.length; i++) {
                var buttonDiv = document.createElement("div");
                buttonDiv.className = "naviButton fas fa-"+this.config.sectionIcons[this.config.sections[i]];
                buttonDiv.style.fontSize = this.config.iconSize + "px";
                button.addEventListener("click", function() {
                  self.sendNotification("PAGE_CHANGED", i);
                });
                //this.log(buttonDiv.className);
                container.appendChild(buttonDiv);
              }
              return container;
            },
          

          How to troubleshoot modules
          MMM-soccer v2, MMM-AVStock

          1 Reply Last reply Reply Quote 0
          • L Offline
            lavolp3 Module Developer
            last edited by Jun 29, 2020, 7:32 AM

            @thetobyde I think you should avoid the node_helper and directly send a broadcast notification via self.sendNotification() to to the MMM-pages module.

                  button.addEventListener("click", function() {
                    self.sendNotification("PAGE_CHANGED", i);
                  });
            

            How to troubleshoot modules
            MMM-soccer v2, MMM-AVStock

            S 1 Reply Last reply Jun 29, 2020, 10:38 AM Reply Quote 0
            • S Offline
              sdetweil @lavolp3
              last edited by Jun 29, 2020, 10:38 AM

              @lavolp3 which is what I said 3 posts back

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              L 1 Reply Last reply Jun 29, 2020, 10:46 AM Reply Quote 0
              • L Offline
                lavolp3 Module Developer @sdetweil
                last edited by Jun 29, 2020, 10:46 AM

                @sdetweil sorry read thorugh it too fast

                How to troubleshoot modules
                MMM-soccer v2, MMM-AVStock

                1 Reply Last reply Reply Quote 0
                • T Offline
                  thetobyde
                  last edited by Jun 30, 2020, 12:29 AM

                  It‘s working! Thx u!!

                  1 Reply Last reply Reply Quote 0
                  • 1
                  • 2
                  • 2 / 2
                  2 / 2
                  • First post
                    12/15
                    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