Giter Site home page Giter Site logo

Comments (6)

coddingtonbear avatar coddingtonbear commented on June 10, 2024

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

coddingtonbear avatar coddingtonbear commented on June 10, 2024

Let me know if that doesn't help!

from pyicloud.

stevenmcastano avatar stevenmcastano commented on June 10, 2024

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.

coddingtonbear avatar coddingtonbear commented on June 10, 2024

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.

stevenmcastano avatar stevenmcastano commented on June 10, 2024

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.

 avatar commented on June 10, 2024

I also want to know what is the meaning of isAccurate and isOld fields?

from pyicloud.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.