• 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.

How do you get modules to communicate with each other?

Scheduled Pinned Locked Moved Tutorials
7 Posts 3 Posters 1.2k 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
    adrien00
    last edited by sdetweil Mar 24, 2022, 9:11 PM Mar 19, 2022, 11:12 PM

    I’ve seen that it can be done using notifications however i dont really understand how to do so, do you have to write a script of some sort?

    The kind of thing im looking to do is have multiple pages using MMM-Pages and for example have a voice recignition module to change page.

    I just need the basic idea however as currently i have no idea how to do so.

    S 1 Reply Last reply Mar 20, 2022, 1:01 AM Reply Quote 0
    • S Away
      sdetweil @adrien00
      last edited by Mar 20, 2022, 1:01 AM

      @adrien00 your voice reco module uses a JavaScript function

      this.sendNotification(notification_string,  optional_data)
      

      in this case u need to send a notification that the MMM-Pages module understands.

      the module documents the notifications it understands

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      A 1 Reply Last reply Mar 24, 2022, 10:31 AM Reply Quote 1
      • A Offline
        adrien00 @sdetweil
        last edited by Mar 24, 2022, 10:31 AM

        @sdetweil sorry my laptop stopped working so only just seen this! Where am i writing these commands? In config.js? Do i need to put some sort of if condition in? Also do you know of any exaple codes that show how to do this?

        Thanks

        S 1 Reply Last reply Mar 24, 2022, 12:35 PM Reply Quote 0
        • S Away
          sdetweil @adrien00
          last edited by sdetweil Mar 24, 2022, 3:16 PM Mar 24, 2022, 12:35 PM

          @adrien00 the source code of the voice module would need to do this.

          many modules use this . my MMM-SleepWake does this to tell other modules that we are blanking the screen or waking it up

          https://github.com/sdetweil/MMM-SleepWake

          all the default modules send notifications to tell others about the weather, the calendar, alerts, news…

          other modules can use the info or ignore it.

          sendNotification is a broadcast to all other running modules

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          A 1 Reply Last reply Mar 24, 2022, 9:09 PM Reply Quote 0
          • A Offline
            adrien00 @sdetweil
            last edited by Mar 24, 2022, 9:09 PM

            @sdetweil This is so helpful, thanks!

            S C 2 Replies Last reply Mar 24, 2022, 9:11 PM Reply Quote 0
            • S Away
              sdetweil @adrien00
              last edited by Mar 24, 2022, 9:11 PM

              @adrien00 from the specs
              https://docs.magicmirror.builders/development/notifications.html

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • C Offline
                cowboysdude Module Developer @adrien00
                last edited by Mar 25, 2022, 12:46 AM

                @adrien00 I have two modules that relay info back and forth to each other. They are weather modules and I get info and send it over to the other module.

                I do this because I needed/wanted some weather info to show up in a specific place so I send my ‘payload’ from the 1st module to the 2nd module…

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