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 to send a notification

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    35 Posts 3 Posters 5.9k 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 @Alyx
      last edited by sdetweil

      @alyx said in How to send a notification:

      this.sendNotification(“PAGE_CHANGED”, payload);

      you can only send notifications from the modulename.js

      this notification goes to all running modules
      it’s a broadcast

      the page_changed is the notification string.
      can be anything
      payload is the data that goes w that notification Id. and can be anything

      those receiving the notice MUST know what the format of payload is for and message they chose to process.all others would be ignored.

      there are hundreds of notifications each minute.

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      A 1 Reply Last reply Reply Quote 0
      • ? Offline
        A Former User @Alyx
        last edited by

        This post is deleted!
        A 1 Reply Last reply Reply Quote 0
        • A Offline
          Alyx @sdetweil
          last edited by

          @sdetweil

          Hi Sam,

          My replies are getting flagged as spam apologies for the delay. But I think I found where the Selfie script sends out the notification. Do you think the other scripts I sent earlier are configured correctly?

          1 Reply Last reply Reply Quote 0
          • A Offline
            Alyx @Guest
            last edited by

            @hango Hi Hango!

            Ok so I’ll add that first line to my MMM-SelfieShoot.js (the module that needs to be actioned by another)

            And the second will be inside the MMM-AlexaControl.js? I’ll test it now :)

            A 1 Reply Last reply Reply Quote 0
            • A Offline
              Alyx @Alyx
              last edited by

              Did it there but doesn’t seem to appear in Alexa, The other functions such as restart and monitor off/on works but I’m having trouble having this appear/ work.

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

                @alyx so in alexacontrol, you have to create a notification device

                notifications: [
                    {
                        name: 'Notificaition 1',
                        port: 11100,
                        OnOff: false,
                        notification: ["NOTIFICATION", "PAYLOAD"]
                    }
                ]
                

                name is the thing Alexa will know
                the tcp/ip port number to use for Alexa to contact this machine
                and the notification info should look familiar

                then u restart MagicMirror
                ( in the MagicMirror startup messages you should see a line listening on ??? where ??? is the port number you used in the notification entry)
                and then Alexa discover devices

                then whatever name is, should be discovered.

                then you invoke it with
                Alexa, turn on xxxx
                where xxxx is the name of your device
                (because alexacontrol creates fake wemo electric outlets)

                note that notifications shown above is a list [], so each {} is a notification device

                and this stuff goes in the alexacontrol module
                config:{}
                section

                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
                  Alyx @sdetweil
                  last edited by

                  @sdetweil I have that set up al;ready but my alexa cant discover it for some reason. If you need you can see it in my config.js file above

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

                    @alyx nice, but you missed one key point

                    and this stuff goes in the alexacontrol module
                    config:{}
                    section

                    u have in the general module section not in the module config

                    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
                      Alyx @sdetweil
                      last edited by

                      @sdetweil Ah! that worked thanks :) Next issue it doesnt call the module when activated lol

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

                        @alyx so, now open the developers window, ctrl-shift-i, and look at the console tab

                        u may be able to see some module report the notification

                        or install my samplemodule as it reports all notifications received
                        https://github.com/sdetweil/SampleModule

                        in the Alexa app u can control devices manually, so that makes testing a lot easier

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        A 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 4 / 4
                        • 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