Comments (6)
@stevenmcastano -- the instance of PyiCloudService
has a property devices
that returns a dictionary containing every device found on your iCloud account, and the values of that dictionary each have a .location()
property you can use for updating their location.
Here's a rough example:
>>> from pyicloud import PyiCloudService
>>> svc = PyiCloudService('[email protected]')
>>> svc.devices
{u'abcdefg': <AppleDevice(iPhone 6: Adam Coddingtons iPhone)>}
>>> svc.devices['abcdefg']
<AppleDevice(iPhone 6: Adam Coddingtons iPhone)>
>>> svc.devices['abcdefg'].location()
{u'timeStamp': 1471294340008, u'locationFinished': True, u'longitude': -122.6736735274295, u'positionType': u'GPS', u'locationType': None, u'latitude': 45.56516553745192, u'isOld': False, u'isInaccurate': False, u'horizontalAccuracy': 10.0}
from pyicloud.
Let me know if that doesn't help!
from pyicloud.
That did it!! Thanks!!
Quick question on device/API usage. I want to use this for a home automation system so it knows when I've left my house far enough that I'm about 1 mile away, then again when I come back to about 5 miles away.... so I can control air condition/lighting/etc...
Do you know how many API calls you can make per day? And/or if making calls as frequently as once per minute is going have an effect on battery life? Does each request actually cause anything to happen on the phone?
from pyicloud.
I'm afraid I have no idea about API limits, but I've never hit them. Regarding battery life, yes, every request will impact your battery life given that your phone will then be asked to update its location by checking to see which GPS satellites it can currently hear. That's not a tremendously expensive operation, but it does take more battery power than just sitting idle.
from pyicloud.
Well that's to know on the API limits at least...
As for the battery drain, I'm going to let it run for a while with the 1 minute loop and see how it actually effects the battery. I guess if it's too much of a problem I can slow down the loop based on how far away I am.
I'm using geopy to compute how many miles from the lattitude and longitude of my house is, so I can I could set it to check how every often I am as miles away, so if I'm under 2 miles away, check every minute, or even 30 seconds. Beyond that, every time I'm another mile away, slow the loop down by 1 more minute. So when I drive to NY let's say and I'm 240 miles away, it'll only check once every 4 hours.
I'm basically thinking I can't outrun it, even if I'm driving 60 mph, I'm only going to get closer by 1 mile per minute. The only thing that could ever happen is if I out-fly it... which I think maybe I can set so if it checks when I'm in airplane mode and it knows it can't reach the iPhone, then I check more often until I can...
I just don't know how to figure that part out yet... maybe if isAccurate and isOld fields will come into play there.
from pyicloud.
I also want to know what is the meaning of isAccurate and isOld fields?
from pyicloud.
Related Issues (20)
- Put everything in Docker Container
- Drive: operations on node are not reflected in node
- No support for Security Keys for Apple ID HOT 1
- Data loss in Photos Service about duplicated RecordName HOT 2
- Does any know how to decode locationenc field?
- Help Request: 2fa and maintaining a login for at least 24 hours
- iCloud Advanced Data Protection
- Image Download with highest compatibility (including editing)
- [email protected]
- import fails - ImportError HOT 1
- This is fantastic!
- Why does pycloud reported size differ from icloud.com reported size?
- Inactive Project Maintenance and Unattended Pull Requests
- It is possible to extract field "Closest city" from my iCloud photos ? HOT 1
- Show keyError when authentication with username and password HOT 4
- 421 Authentication Error HOT 2
- Items of type app_library show up empty HOT 1
- Enabling feature of "Save to Photos" or "Save Video" from photo in iDrive
- Question
- Question | Contacts modification (updating/adding/removing)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyicloud.