question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Specific device polling

See original GitHub issue

If I do api.devices[0].location() will that only request the location for that device or will it end up telling all of my devices to send their location back to iCloud? I currently have a script polling an iPhone every 30 seconds for testing, but I noticed that my Apple Watch battery has drained significantly more than a normal day.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:10

github_iconTop GitHub Comments

3reactions
torarnvcommented, Sep 24, 2017

Yes, the way things work right now is that calling location() will result in a call to FindMyiPhoneServiceManager.refresh_client(), which passes selectedDevice: all in the request.

I don’t know what format selectedDevice takes, but you could look at the network request in Chrome and figure that out, and then e.g. add a deviced = all argument to refresh_client.

1reaction
northtreecommented, May 22, 2018

I have changed the selectedDevice param. However, iCloud still returns all devices information.

diff --git a/pyicloud/services/findmyiphone.py b/pyicloud/services/findmyiphone.py

-    def refresh_client(self):
+    def refresh_client(self, device_id='all'):

-                        'selectedDevice': 'all',
+                        # 'selectedDevice': 'all',
+                        'selectedDevice': device_id,

 
     def location(self):
-        self.manager.refresh_client()
+        self.manager.refresh_client(device_id=self.content['id'])
         return self.content['location']
Read more comments on GitHub >

github_iconTop Results From Across the Web

Device polling — Tango Controls 9.3.4 documentation
It add a new object (command or attribute) to the list of object(s) to be polled. It is also with this command that...
Read more >
What is device polling? - Quora
Effectively polling means a central controller asks each device in turn: “Do you have something for me?” Whereas Interrupt means each device just...
Read more >
Polling (computer science) - Wikipedia
Polling, or polled operation, in computer science, refers to actively sampling the status of an external device by a client program as a...
Read more >
Ubuntu Manpage: polling — device polling support
Device polling (polling for brevity) refers to a technique that lets the operating system periodically poll devices, instead of relying on the devices...
Read more >
What is polling? | Definition from TechTarget
In electronic communication polling is the continuous checking of other programs or devices by one progam or device to see what state they...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found