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

Sending notification from MMM-Remote-Control to MMM-ProfileSwitcher

Scheduled Pinned Locked Moved Troubleshooting
9 Posts 3 Posters 5.1k 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.
  • T Offline
    tismepaulo
    last edited by tismepaulo Feb 9, 2017, 9:09 PM Feb 9, 2017, 9:08 PM

    Hello

    I’m stuck trying to use the notification request feature of MMM-Remote-Control to send a notification to MMM-ProfileSwitcher in order to switch profiles. I’m doing this via a web GET request, which I know works already as I’ve got Monitor On and Monitor Off functioning correctly using http://IP.ADDRESS:PORT/remote?action=MONITOROFF

    I know I’ve mashed together from two read me’s, but there’s no reason it shouldn’t work. I’m using: http://IP.ADDRESS:PORT/remote?action=NOTIFICATION&notification=‘CURRENT_PROFILE’&payload=‘profilename’ i.e. ‘CURRENT_PROFILE’ is written exactly like that with the 2x ’ and profilename is the name of the profile I want to change to, again with 2x '.

    I’ve also tried ", %27, %22, and all varieties with {} around it. I usually get the message {“status”:“Unexpected token ’ in JSON at position 0”} although I have had {“status”:“success”} with " around profilename, but nothing happened.

    Can anyone help me please?

    T 1 Reply Last reply Feb 15, 2017, 7:38 AM Reply Quote 0
    • T Offline
      tismepaulo @tismepaulo
      last edited by Feb 15, 2017, 7:38 AM

      Anybody out there able to help? It’s so frustrating as every other part of MM has been fantastic and relatively easy. Can anyone at least confirm that it should work in theory?

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jopyth Moderator
        last edited by Jopyth Feb 15, 2017, 10:35 AM Feb 15, 2017, 10:28 AM

        It looks like it should work. Are you trying this from a javascript, or are you just trying to figure out the static URL you need to call?

        Please have a look at this example: https://jsfiddle.net/5yzw2zrb/6/

        On the left you can see javascript code you could use to build the needed URL, and on the left you can see an example. Adapt the variables in the code to build some other kind of notification. Dont forget to run the script, e.g., with CTRL+Return, to see the the new result.

        Edit: Another example which should be working out of the box is building an alert notification.

        Helpful sticky: How to troubleshoot

        T 2 Replies Last reply Feb 17, 2017, 8:10 AM Reply Quote 0
        • T Offline
          tismepaulo @Jopyth
          last edited by Feb 17, 2017, 8:10 AM

          @Jopyth thank you for that tool. I will try a few things out later. I am trying to find the correct static URL to use, and fingers crossed this will get me there!

          1 Reply Last reply Reply Quote 0
          • T Offline
            tismepaulo @Jopyth
            last edited by Feb 18, 2017, 9:06 AM

            @Jopyth thank you again for your help. I got it working with the following: http://IP.ADDRESS:PORT/remote?action=NOTIFICATION¬ification=CURRENT_PROFILE&payload=%22profilename%22

            So it was the unnecessary ’ ’ around CURRENT_PROFILE that was breaking it before. I’ll see about sugggesting an edit to the relevant module read me. Cheers

            S 1 Reply Last reply Feb 18, 2017, 9:44 AM Reply Quote 0
            • S Offline
              strawberry 3.141 Project Sponsor Module Developer @tismepaulo
              last edited by Feb 18, 2017, 9:44 AM

              @tismepaulo https://github.com/Jopyth/MMM-Remote-Control/blob/master/README.md#notification-request the readme is correct it doesn’t say to put quotes around the notification

              Please create a github issue if you need help, so I can keep track

              T 1 Reply Last reply Feb 18, 2017, 9:46 AM Reply Quote 0
              • T Offline
                tismepaulo @strawberry 3.141
                last edited by Feb 18, 2017, 9:46 AM

                @strawberry-3.141 you’re right, but https://github.com/tosti007/MMM-ProfileSwitcher/blob/master/README.md#switching-profiles kinda does. I was going to add to the Using with other modules section of MMM-ProfileSwitcher

                S 1 Reply Last reply Feb 18, 2017, 9:51 AM Reply Quote 0
                • S Offline
                  strawberry 3.141 Project Sponsor Module Developer @tismepaulo
                  last edited by Feb 18, 2017, 9:51 AM

                  @tismepaulo thats a diffenrent use case the example shown in your link is for using inside a module and not as a http request, so therefore you need the quotes

                  Please create a github issue if you need help, so I can keep track

                  T 1 Reply Last reply Feb 18, 2017, 11:03 AM Reply Quote 1
                  • T Offline
                    tismepaulo @strawberry 3.141
                    last edited by Feb 18, 2017, 11:03 AM

                    @strawberry-3.141 ah OK, thanks :)

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