iCloud custom_component device tracker that will not drain your battery

I have had trouble with the icloud service calling two devices at the same time when only one is called for. I found your service works well for me as just as a means to update one iphone’s locations. I use the following with your script to automate updates in HA. Thanks

      - service: device_tracker.icloud_set_interval
        data:
          interval: 999
          account_name : iphone
          device_name : xxxiphone

Glad it’s working for you Rob – All the devices on your account will still be polled, but the frequency that each is polled is much more reasonable with this custom component.

I’m still watching the underlying library pyicloud, and hoping they can implement specific device polling. Once that is supported, we can be much smarter on polling the right device and saving battery across all devices.

I setup an automation that recored every state change of the icloud device trackers I use. I am sure using the above code that icloud2.py will only update HA device tracker that the interval is changed. (not using the update service)

It is possible that all devices get polled but HA only registers the state change of the entity that I changed the interval on. I am not sure how I can check if a device is getting updated if its not reported to HA.

1 Like

I set the red marked icloud tracker to interval 300 and the blue to interval 999 last night. These are the state changes of the device tracker. It appears interval 300 was set twice and occur 2 mins apart. I might have set the interval twice.

image

Might be something simple but… Anyone know what I’m doing wrong here?

Log Details (ERROR)

Fri Jun 01 2018 09:10:27 GMT-0500 (CDT)

Error executing service <ServiceCall configurator.configure: configure_id=1860385680-1, fields=trusted_device=XXXXXX>

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/core.py”, line 1007, in _event_to_service_call
await service_handler.func(service_call)
File “/usr/lib/python3.6/site-packages/homeassistant/components/configurator.py”, line 224, in async_handle_service_call
call.data.get(ATTR_FIELDS, {}))
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/device_tracker/icloud2.py”, line 208, in icloud_trusted_device_callback
self._trusted_device = self.api.trusted_devices[self._trusted_device]
IndexError: list index out of range

Hi! Does this support find my iPhone lost phone alerts, specifically using device_name to specify the device to ring?

Or does this issue persist from the original component? Thanks!

Hi - any thoughts on this? Has anyone managed to get the lost iPhone feature to work?

Hi Just changed from iCloud to this but some reason the devises are not tracked i.e. never leave home ??
Anyone els having this issue ??

  • platform: icloud2
    username: #########
    password: ########
    account_name: Suds32
    filter_devices: ‘phone’

What directory does icloud2.py go into?

I tried /use/share/hassio/homeassistant/custom_components but when I run a check configuration, it’s not liking the icloud2 directive.

/custom_components/device_tracker/icloud2.py

As in right off the root?

In your homeassistant directory folder

~/homeassistant/custom_components/device_tracker/icloud2.py

after I red the whole post still cannot get access to the folder where the .py file should go.
Any good hints how to see all flders (as root maybe)?
hass.io instaled clasic methond via image
ssh works, ssh on 22222 not so much (access restricted)
so how exactly do I copy that python file (removeing the sd?::slight_smile:

Can you access your homeassistant installed folder? If you can then create folder name custom_component in homeassistant folder and create folder device_tracker folder inside custom_component folder. The icloud2.py is in device_tracker folder.

Is this still a issue for the original icloud component?

I use original icloud component now. Everything works fine.

@walt do you know if your code has been incorporated into the official release? I’m other words, is your “fix” still needed or can we use the default?

2 Likes

I use HASS.IO not home hasistant install. the SD card is unreadable , and the only folders are those as standard shared by hass.io via ssh. SO how do i see the whole folder structure and write on them for HASS.IO?
share, addons, backup, config are the only ones shared by hassio as mountable.

the icloud2.py will be in config/custom_components/device_tracker/icloud2.py

then add in your configuration.yaml

device_tracker:
  - platform: icloud2
    username: !secret icloud_username
    password: !secret icloud_password
    account_name: !secret icloud_descriptive_name
    filter_devices: 'phone'

I don.t understand why someone will give just part of info to help another…
Let’s try again so everybody understand all the pieces of info scattered all over and incomplete…

  1. What is the complete method to access HASSIO ssd/drive/ENTIRE folder structure? (Hassio NOT another install of HA).
  2. HOW do one uploads the script to that folder (ssh, putty, rubberduck etc\0
  3. What is the COMPLETE path to put the script in? (as in the WHOLE path from the root of the drive, not just from a specific folder, and if there are any folders to create )

Please explain as for a janitor :slight_smile: to understand, do not assume everyone knows what you know (unix, ssh etc)

Right now I cannot access any folder of hassio (unlike Hasbian), I cannot ssh into it, ftp to it, not even mounting the sd card on a mac, I can ony access yaml files via “configurator addon” in hassio page.

thank you