• 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
  1. Home
  2. tnorling
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
T
Offline
  • Profile
  • Following 0
  • Followers 0
  • Topics 0
  • Posts 6
  • Groups 0

tnorling

@tnorling

5
Reputation
490
Profile views
6
Posts
0
Followers
0
Following
Joined May 17, 2017, 10:25 PM
Last Online Feb 20, 2019, 11:45 PM

tnorling Unfollow Follow

Best posts made by tnorling

  • RE: Phone Notifications

    So I had a few issues with this module that I think I was able to fix. The first issue I had was that the second notification gets posted several times. Second, when a notification from an app is already on the list, if a new notification from that app comes in it does not update or push it to the top. Finally, the top of the list is the oldest notification, not the newest. I came up with a solution that seems to work for me so far.

    In the phone_notification.js file update the cleanPayload function to look like this

    cleanPayload: function(newPayload){
            var application_name = newPayload.application_name;
            var that = this;
            var dupIndex = 0;
            if(this.payload.length > 0)
            {
                this.payload.forEach(function (m) {
                    // If application_name already exists, increment notification count
                    if(m.application_name === application_name)
                    {
                        m.count++;
                        that.payload.splice(dupIndex,1);
                    }
                    dupIndex++;
                });
            }
            
            this.payload.unshift(newPayload);
            this.payload.slice(0, this.config.displayCount -1);
        },
    

    Let me know if this helps or if you have any issues with it.

    posted in Utilities
    T
    tnorling
    May 17, 2017, 10:39 PM
  • RE: Phone Notifications

    @SypherDaemon Interesting…what did you set your numberOfNotifications to in the config file? I have mine set to 3 and I am indeed showing 3 notifications at a time. I also just finished writing a function to remove notifications once they’ve been swiped away from your phone. Maybe I changed something somewhere else as well that made it all work. I’ll post my current working code shortly for you to test out.

    Edit: The count may no longer work because I am now replacing notifications coming from the same app. I’ll see what I can do to fix that next…

    posted in Utilities
    T
    tnorling
    May 18, 2017, 2:42 AM
  • RE: Phone Notifications

    @SypherDaemon No problem! I’ve been wanting to use this for my own project so I’ve been trying to fix the issues I see with it. Most of the work was done by others, they deserve the credit on this one. I forked the original repo and uploaded my work if you’d like the dismissal feature as well.

    Link is Here

    posted in Utilities
    T
    tnorling
    May 18, 2017, 3:11 AM
  • RE: Phone Notifications

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

    posted in Utilities
    T
    tnorling
    May 18, 2017, 4:47 PM
  • RE: Phone Notifications

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

    posted in Utilities
    T
    tnorling
    May 18, 2017, 7:11 PM

Latest posts made by tnorling

  • RE: Phone Notifications

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

    posted in Utilities
    T
    tnorling
    May 18, 2017, 9:02 PM
  • RE: Phone Notifications

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

    posted in Utilities
    T
    tnorling
    May 18, 2017, 7:11 PM
  • RE: Phone Notifications

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

    posted in Utilities
    T
    tnorling
    May 18, 2017, 4:47 PM
  • RE: Phone Notifications

    @SypherDaemon No problem! I’ve been wanting to use this for my own project so I’ve been trying to fix the issues I see with it. Most of the work was done by others, they deserve the credit on this one. I forked the original repo and uploaded my work if you’d like the dismissal feature as well.

    Link is Here

    posted in Utilities
    T
    tnorling
    May 18, 2017, 3:11 AM
  • RE: Phone Notifications

    @SypherDaemon Interesting…what did you set your numberOfNotifications to in the config file? I have mine set to 3 and I am indeed showing 3 notifications at a time. I also just finished writing a function to remove notifications once they’ve been swiped away from your phone. Maybe I changed something somewhere else as well that made it all work. I’ll post my current working code shortly for you to test out.

    Edit: The count may no longer work because I am now replacing notifications coming from the same app. I’ll see what I can do to fix that next…

    posted in Utilities
    T
    tnorling
    May 18, 2017, 2:42 AM
  • RE: Phone Notifications

    So I had a few issues with this module that I think I was able to fix. The first issue I had was that the second notification gets posted several times. Second, when a notification from an app is already on the list, if a new notification from that app comes in it does not update or push it to the top. Finally, the top of the list is the oldest notification, not the newest. I came up with a solution that seems to work for me so far.

    In the phone_notification.js file update the cleanPayload function to look like this

    cleanPayload: function(newPayload){
            var application_name = newPayload.application_name;
            var that = this;
            var dupIndex = 0;
            if(this.payload.length > 0)
            {
                this.payload.forEach(function (m) {
                    // If application_name already exists, increment notification count
                    if(m.application_name === application_name)
                    {
                        m.count++;
                        that.payload.splice(dupIndex,1);
                    }
                    dupIndex++;
                });
            }
            
            this.payload.unshift(newPayload);
            this.payload.slice(0, this.config.displayCount -1);
        },
    

    Let me know if this helps or if you have any issues with it.

    posted in Utilities
    T
    tnorling
    May 17, 2017, 10:39 PM
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