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

      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 Reply Quote 0
      • S Offline
        sdetweil @adrien00
        last edited by

        @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 Reply Quote 1
        • A Offline
          adrien00 @sdetweil
          last edited by

          @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 Reply Quote 0
          • S Offline
            sdetweil @adrien00
            last edited by sdetweil

            @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 Reply Quote 0
            • A Offline
              adrien00 @sdetweil
              last edited by

              @sdetweil This is so helpful, thanks!

              S cowboysdudeC 2 Replies Last reply Reply Quote 0
              • S Offline
                sdetweil @adrien00
                last edited by

                @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
                • cowboysdudeC Offline
                  cowboysdude Module Developer @adrien00
                  last edited by

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