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

Phone Notifications

Scheduled Pinned Locked Moved Utilities
97 Posts 31 Posters 122.4k Views 33 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.
  • R Offline
    ronny3050 Module Developer @tnorling
    last edited by May 18, 2017, 4:13 AM

    @tnorling excellent work! Glad you could figure it out.

    Once you’re good to go, would you mind submitting a pull request?

    T 1 Reply Last reply May 18, 2017, 4:47 PM Reply Quote 0
    • T Offline
      tnorling @ronny3050
      last edited by tnorling May 18, 2017, 5:08 PM May 18, 2017, 4:47 PM

      @ronny3050 I submitted a pull request. A couple things to note: the notification count no longer works. In order to make it work it would need to increment on a notification being posted and decrement on dismissal. However, the dismissal information does not contain a field that differentiates between 2 notifications from the same application. So that means when a dismissal gets triggered on an app that has 2 or more active notifications it would remove all the notifications from that app making the count a useless number. This also means that when any notification from an app gets dismissed, even if it’s not the most recent, the notification from that app shown on the mirror get dismissed. I’ll look into this a little further but from what I’ve seen so far there doesn’t seem to be a way around it.

      The second issue I’ve been running into is that there seems to be a server request error when notifications come in or get dismissed too quickly. It happens quietly in the background but if you find your phone blowing up with notifications, they may stop appearing on the mirror. We may need to incorporate a short waiting period between requests so it doesn’t lock up and miss incoming notifications.

      Edit: I did actually figure out how to differentiate between notifications from the same app. I was just not paying close enough attention to the API haha. I guess the question now is whether or not the count is necessary since each notification would presumably have its own unique content. I can think of a way to do it if it’s a feature people want, but for my purposes it seems fine without.

      R 1 Reply Last reply May 18, 2017, 5:41 PM Reply Quote 1
      • R Offline
        ronny3050 Module Developer @tnorling
        last edited by ronny3050 May 18, 2017, 5:42 PM May 18, 2017, 5:41 PM

        @tnorling I believe there is an ID associated with each notification that can help discriminate between two notifications from the same application.

        For the second issue, I like the idea of a short waiting period. Another idea might be, albeit more complicated, is to have a notificationTimePeriod, say 45 seconds. If N notifications show up within 45 seconds, we will display the first notification in the notification area in the mirror, and slide subsequent ones with a delayNextNotification time period. That is, in the mirror, we will only use one item in the notification list to display all N notifications within a 45 second time period by sliding each of them with a delay.

        Please let me know how this sounds. Thanks!

        Edit: Sorry! Saw your edit late :b

        T 1 Reply Last reply May 18, 2017, 7:11 PM Reply Quote 1
        • T Offline
          tnorling @ronny3050
          last edited by May 18, 2017, 7:11 PM

          @ronny3050 It seems to be related to requesting the information from Pushbullet rather than displaying it onto the mirror so I’m not sure changing the rate at which we display them will solve the issue. There seem to be some limitations on how often you can use their API with a free account. I also noticed that some notifications, such as incoming phone calls, show up on the JSON stream as repeated pushes instead of just one. This would result in several requests back to back for the same notification and could be contributing to the problem. I’m not sure if this is a solveable problem though as it’s on their end. At first I thought we could check to see if the incoming notification is already on the list and do nothing if it is, but at that point the request has already been made.

          After some thought, a wait period might not work either. Say you have a push, push, dismiss, push in quick succession. With a wait period in between requests the mirror may skip the second push if the dismiss happens before the wait period is over and you may see something like push, dismiss, push on the mirror. I’m not too familiar with the way the JSON file comes in. If you get the whole file each time a new event happens, a wait period could work. But if you only get the new event we’ll have some issues.

          Of course getting a paid Pushbullet account would probably solve this issue without needing to rework the code, but who wants to pay? :P

          Thoughts or other ideas?

          1 Reply Last reply Reply Quote 1
          • R Offline
            ronny3050 Module Developer
            last edited by ronny3050 May 18, 2017, 7:37 PM May 18, 2017, 7:37 PM

            @tnorling thanks for the information! You’re indeed correct in stating that there is a ratelimit associated with requesting pushes. It indeed seems like an unsolvable issue, given that once we request a push, the JSON response is already sent, even if it is streamed. :(

            The json response comes in whenever a new event occurs, however, we could maintain a stack of current pushes and dismissals. The wait time could then be dynamic shortened if a dismissal is found in the stack.

            Will this work?

            T 1 Reply Last reply May 18, 2017, 9:02 PM Reply Quote 0
            • T Offline
              tnorling @ronny3050
              last edited by May 18, 2017, 9:02 PM

              @ronny3050 I’m not sure if I quite understand. It seems to me that any time there is activity on pushbullet we get a ping saying “hey look at me, I have new information for you” and then we check to see what event occurred and act accordingly. And from what I understand any time pushbullet notifies us of activity it counts towards the ratelimit because that’s when the websocket gets opened. So unless it’s dependent on when you read the JSON, the only way I see us limiting the rate at which we make requests is by periodically checking the JSON and parsing the new information rather than listening for new activity. Which kind of defeats the purpose.

              Of course I could be wrong about all this, I’m not super familiar with websockets or the API. We might be stuck with the way it is, but it works well enough as long as your phone isn’t receiving a ton of notifications at one time.

              1 Reply Last reply Reply Quote 0
              • M Offline
                malicious_banjo
                last edited by Jun 17, 2017, 3:28 AM

                The very first time I set up this module I was getting notifications. After about ten minutes my log started reporting rateLimit errors, and notifications stopped coming in.

                Since then, notifications don’t work at all. I’ve tried resetting all my tokens and starting over, I’ve completely removed/reinstalled the module, still nothing. I even bought a month of pro to see what would happen.

                The log isn’t reporting any problems, it’s basically like my mirror doesn’t even know it’s connected to my account. Any ideas to fix it?

                R 1 Reply Last reply Jun 18, 2017, 5:45 PM Reply Quote 0
                • R Offline
                  ronny3050 Module Developer @malicious_banjo
                  last edited by Jun 18, 2017, 5:45 PM

                  @malicious_banjo do you use Pushbullet a lot? There’s a limit on how many requests are given out per user.

                  If you use Pushbullet outside of this module, it is possible that you ran out of requests.

                  Seems like a good course of action will be to custom create an Android app that will push notifications.

                  M 1 Reply Last reply Jun 18, 2017, 5:55 PM Reply Quote 0
                  • R Offline
                    ronny3050 Module Developer
                    last edited by Jun 18, 2017, 5:46 PM

                    @tnorling what do you say we create our own mobile application for both Android and iOS that can push notifications. This way, we won’t have to rely on Pushbullet and can control push limits.

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      malicious_banjo @ronny3050
                      last edited by Jun 18, 2017, 5:55 PM

                      @ronny3050 Nope, I made a PushBullet specifically for this module. The error returned after just two notifications on the mirror.

                      I can get a single notification to appear now, but only from the “Send Test Notification” button from the Mirroring menu on the Pushbullet app. The console will output null and then after that, nothing more.

                      R 1 Reply Last reply Jun 18, 2017, 6:00 PM Reply Quote 0
                      • 1
                      • 2
                      • 6
                      • 7
                      • 8
                      • 9
                      • 10
                      • 8 / 10
                      • 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