iCloud custom_component device tracker that will not drain your battery

@walt thanks for this component.

I have added my iphone and it shows the location i.e. home etc fine but it says that the low power mode is false and device_status is offline. Is that normal?

1 Like

Low Power Mode is a mode an ios device goes into when it drops below 20% battery (optionally i believe). Device status has at least 3 states I’ve seen: (Online, Offline, Pending). Not sure what criteria determines this. That could come from Apple via icloud api.

1 Like

Hi to every one,

I’m using this custom_component (icloud2.py), but i don’t see my position in map or also the entity i can’t see it in my HA

I have file icloud2.py in this route:

imagen

and in logs i can see only this:

2018-09-05 23:04:01 WARNING (MainThread) [homeassistant.loader] You are using a custom component for device_tracker.icloud2 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

what’s happening?

thanks,

Here is what I did. I use lovelace btw:

Check under de “states” -> http://yourdomain:8123/dev-state

Look for a something like: device_tracker.youriphonesname
(You can find your device name in your phone under: “Settings” > “General” > “Info

Then you have to add the below code to your ui-lovelace.yaml

  - type: map
    aspect_ratio: 62.5%
    default_zoom: 6
    entities:
      - device_tracker.nameofyourdevice
      - zone.home

You should get something like this:

1 Like

Is there a way to show this map as a card in hassio without lovelace?

Maybe this is usable for you:

Click

Did you figure this out yet. Remember you won’t see your device in the map if you’re in your ‘home’ zone which is setup default in Home Assistant.

So I got this working for me, after a couple of hours.
First I had to understand how the filter works.
The filter is just filtering the names of devices. For example:
My iPhone is called ‘Myiphone’, my wifes iPhone is called ‘wife’.
Hers wasn’t displayed with this component.
If a devices for example is called ‘notaniphone’ it would be displayed!

Next think to figure out was how to have multiple filters installed.
The filter is not an array, it is a simple String.
So filter like
filter_devices: 'phone', 'wife'
or

filter_devices:
  - 'phone'
  - 'wife'

won’t work.
So what do you have to do? You need double the entrys

device_tracker:
  - platform: icloud2
    username: !secret icloud_username
    password: !secret icloud_password
    account_name: 'Phone'
    filter_devices: 'phone'
  - platform: icloud2
    username: !secret icloud_username
    password: !secret icloud_password
    account_name: 'Wife' 
    filter_devices: 'wife'

This is how it worked now!
I will test it the next couple of days.

1 Like

I’ve switched from the original iCloud tracker to this, however it seems that the old one is still running every minute. My server log shows this every minute:
2018-11-27 00:16:57 INFO (SyncWorker_10) [pyicloud.base] Authentication completed successfully

How can I remove the old implementation completely?

I just deleted the old icloud section in the configuration!
It works perfectly fine.
I would love to See this in the next hass.io release!

I have removed the old configuration and added the icloud2 platform, but it is still polling every minute…

Has anyone tried this recently? Can anyone confirm if the battery issues are resolved? There seems to be a few mixed results in this thread.

I tried it for weeks, but the battery was drained aswell. Thats why I don’t use it anymore.
I use the app, the recent beta, and also the fritzbox component.
If you don’t have a fritzbox, look if there is a component for your router.

I use the iOS app (beta) and asuswrt with pretty good results… my only issue is my kids iPads and iPods don’t update the battery level/state as frequently as I’d like and I’m pretty sure when I using the actual iCloud component they all updated pretty regularly… oh well… I’m hoping when the new iOS app is released it will resolve it (I can’t put the beta on the kids due to their age it won’t let me)

I think it could take a while till it will be released.
See this post here

iCloud3 custom component released

iCloud3 is a new Home Assistant device tracker custom component that greatly expands the capabilities of the iCloud (and iCloud2) HA component. It exposes many new attributes, provides many new features, is based on enhanced route tracking methods, is much more accurate, and includes additional service calls.

Some of these features include:

  1. A variable polling interval based on the Waze route mapping service (drive time and distance rather than just a calculated straight line distance).
  2. Immediate status update on zone changes (enter and exit).
  3. Short 15-second polling when less than 1 mi/km from home (reliabily trigger automations based on an accurace distance).
  4. Ability to include or exclude devices or device types (filters for devices you want to track).
  5. Dynamic Stationary Zones (conserve battery life when stationary).
  6. Automatically repoll the device if the GPS location data is ‘old’ or inaccurate (on the next 15-second interval).
  7. Tracking security (prevent GPS coordinates from being reported to HA if not in a zone).
  8. Additional service call commands (setting intervals, pausing and resuming polling, zone assignment, etc.)
  9. No longer need any other program (other than the HA IOS app) to handle device tracking and presence detection (no more Nmap, OwnTracks or router based tracking components).
  10. Configuration variables (16 new variables), Attributes (13 new items returned), Service Calls (10 new subcommands), lines of code (from 425 to 2500+).
  11. And more…

It is now available for download at https://github.com/gcobb321/icloud3. You will find comprehensive documentation and screenshots, all the configuration files, automations and lovelace card setup that I use for device tracking, presence detection and reporting on my rig.

I’ve been using this for a while but this is the first general release of the component. You may run into some problems I haven’t come across. If so, post them on the Issues page on my repositary.

Gary Cobb, aka GeeksterGary

1 Like

This looks pretty good and looks like a lot of time has gone into developing this.

I only have one question… how does this affect the battery on the iPhones?? The previous version of were just too much of a drain ion the battery to keep using.

2 Likes

I have used an iPhone X until December (iPhone XS since then) and have noticed no noticeable effect on the battery. Most of the time I am in a zone (Home and others) that is on a 2-hour inzone (configurable) polling cycle. As soon as I leave the zone, the IOS app generates an exit zone notification and actual polling begins. I just picked 2-hours but it configurable and could be 6, 12 or whatever works best in your situation.

A lot of work has been spent minimizing battery usage and the polling interval calculation is a major part of that… The base iCloud component calculates the polling interval on the distance from home, not the time it will take to get there. iCloud3 uses the driving time/distance from the Waze mapping service (except for the last mile). This makes determining the polling interval much more accurate. For example, it’s a 20-minute drive home – the next poll is in 12-minutes. If, at that poll, I am now 10-minutes from home, the next poll would be in 6-minutes. The interval is determined by taking 60% of the Waze drive time (configurable) until the last mile. Then it goes to a 15-second poll to trigger ‘arrive home’ automations.

Another way it minimizes battery usage is by creating Dynamic Station Zones. If you haven’t moved very much during 2 polling cycles (shopping, friends house, doctors office, the beach, etc), a DSZ is created with the current location and you are now on a 2-hour polling cycle. When you leave the DSZ, the IOS app notifies HA of the zone exit and you are back on the time/distance cycle.

Service Call commands let you pause and resume polling. For example, you are on a trip far from home. It makes no sense to poll the device even though the polling interval would be very large. If you are out of the country I am sure the driving time returned from the Waze service would be unrealistic. When you arrive back in the country, resume polling and it will be gin in 15-seconds.

Let me know if you have any more questions.

BTW, Yes, I have been working on this for a while. The project started last March when I could not get any reliable presence detection to work and just wanted my garage door to open when I got home. I kept adding functions and features until I was satisfied and couldn’t think of anything else to add.

No more questions, but you seem to have really worked on battery usage. I’ll give it a go when I get a chance to set it up. Actually, 1 more question. Is the HA app needed for this to work? I don’t really want to put the HA app on my kids iphones, but if it’s needed, then oh well.

Yes. It is needed. Otherwise, there is no reliable way to get zone enter and exit notifications.