Closed StevenLShafer closed 3 years ago
Yes, this can be simulatenously frustrating and challenging. Do you think you would have a chance to dive into the code and propose a change / fix? It has been a (long) while since I played with the device id stuff and vaguely recall these id issues. I also think I tried channels "just because it worked".
Another difficulty may stem from the recent woes Pushbullet had with Google so maybe the API is now more restricted. But that is just a guess from my end.
Happy to. My son, Thomas Shafer (a Google developer) helped me track this down. If he has a few minutes this weekend we may be able to propose a fix.
Steve
From: Dirk Eddelbuettel notifications@github.com Sent: Friday, June 12, 2020 11:35 AM To: eddelbuettel/rpushbullet rpushbullet@noreply.github.com Cc: Steven L Shafer Steven.Shafer@stanford.edu; Author author@noreply.github.com Subject: Re: [eddelbuettel/rpushbullet] Error Message / defaults (#63)
Yes, this can be simulatenously frustrating and challenging. Do you think you would have a chance to dive into the code and propose a change / fix? It has been a (long) while since I played with the device id stuff and vaguely recall these id issues. I also think I tried channels "just because it worked".
Another difficulty may stem from the recent woes Pushbullet had with Google so maybe the API is now more restricted. But that is just a guess from my end.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/eddelbuettel/rpushbullet/issues/63#issuecomment-643425901, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFHWJTZZSGSAB42PQMH34DLRWJYLXANCNFSM4N4Q73QQ.
Good to close this now that #64 is merged?
Two observations:
In your routine .checkReturnCode, instead of returning the error message, the routine returns the incredibly unhelpful " Bad Request - Usually this results from missing a required parameter." I suggest that you always provide the contents of res, so that the return codes can provide appropriate detail.
I found this by tracking down the error 400 results. For a day this worked perfectly: pbPost( devices = "Phone", type = "note", title = "Message from R", body = "The most recent COVID files have been downloaded.", apikey = "o.Jbasd1UfghyOOZnaZ7Tp3rsxf4vShe82xXy" ) However, it started to fail with message 400 for no apparent reason. Eventually I tracked this down to the device "Phone" not being found after the api call, despite no change in the setup. My guess is that this is a problem with the pushbullet API. Having tracked this down, I was able to fix this by instead using a channel, and having the program just default to all devices:
pbPost( channel = "", type = "note", title = "Message from R", body = "The most recent COVID files have been downloaded.", apikey = "o.Jb1UN5cEOOZnaZ7Tp3rsxf4vShe82xXy" )
When the channel is blank, then the program sends the command to all devices by default. I don't think this is the intended behavior. However, it fixed the error when the API could no longer find the phone device.
For what it is worth, here is the json file (the id numbers are made up in order to share this): { "key": "o.Jb1UN5cEOOZnaZ7Tp3rsxf4vShe82xXy" , "devices": [ "3CD2F993129D599D" ], "names": [ "Phone" ], "defaultdevice": "Phone" }
I have two computers set up identically. One returns the correct result with devices = "Phone", and one fails with message 400. Both work channel = "".