MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    How do you get modules to communicate with each other?

    Tutorials
    3
    7
    136
    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
      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
        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

        Create a working config
        How to add modules

        A 1 Reply Last reply Reply Quote 1
        • A
          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
            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

            Create a working config
            How to add modules

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

              @sdetweil This is so helpful, thanks!

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

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

                Sam

                Create a working config
                How to add modules

                1 Reply Last reply Reply Quote 0
                • cowboysdude
                  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 1
                  • 1 / 1
                  • First post
                    Last post
                  Enjoying MagicMirror? Please consider a donation!
                  MagicMirror created by Michael Teeuw.
                  Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                  This forum is using NodeBB as its core | Contributors
                  Contact | Privacy Policy