Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Every few second is a poll icloud.find_my_iphone service #5421

Closed
geo903 opened this issue Jan 18, 2017 · 10 comments
Closed

Every few second is a poll icloud.find_my_iphone service #5421

geo903 opened this issue Jan 18, 2017 · 10 comments

Comments

@geo903
Copy link

geo903 commented Jan 18, 2017

Home Assistant release (hass --version): 0.35.3
Python release (python3 --version): Python 3.5.2
Component/platform: iCloud
Description of problem:
I use component device_tracker.icloud
Every few second is a poll icloud.find_my_iphone service

My logs:
17-01-18 14:00:48 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"shouldLocate": true, "fmly": true, "selectedDevice": "all"}}
17-01-18 14:00:49 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"shouldLocate": true, "fmly": true, "selectedDevice": "all"}}
17-01-18 14:00:49 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"shouldLocate": true, "fmly": true, "selectedDevice": "all"}}
17-01-18 14:00:49 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"shouldLocate": true, "fmly": true, "selectedDevice": "all"}}
17-01-18 14:00:49 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"shouldLocate": true, "fmly": true, "selectedDevice": "all"}}
17-01-18 14:00:50 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"shouldLocate": true, "fmly": true, "selectedDevice": "all"}}

all repeats every few second
It drains the battery very

@partofthething
Copy link
Contributor

Probably related to #4081. Looking at the code it looks like icloud.Icloud.determine_interval sets an interval to 1 second if the device is <=10 miles from home. That seems like a pretty rapid interval. @Bart274 can probably best help.

@Bart274
Copy link
Contributor

Bart274 commented Jan 18, 2017

@partofthething the interval is in minutes, not in seconds.

@Bart274
Copy link
Contributor

Bart274 commented Jan 18, 2017

@geo903 no idea what triggers this every second, the only repetitive part of the code is this:

        randomseconds = random.randint(10, 59)
        track_utc_time_change(
            self.hass, self.keep_alive,
            second=randomseconds
        )

it only triggers every minute :s

@geo903
Copy link
Author

geo903 commented Jan 18, 2017

@partofthething my device is > 10 miles from home.
@Bart274 Is it possible set update interval manually? Service icloud_set_interval is not effect it.

@geo903
Copy link
Author

geo903 commented Jan 18, 2017

POST request is performed 9 times in 3 seconds and goes to sleep for exactly one minute, then everything is repeated again.
Extended log

17-01-18 18:04:16 pyicloud.base: Authenticating
17-01-18 18:04:16 pyicloud.base.http: POST https://setup.icloud.com/setup/ws/1/login
17-01-18 18:04:17 pyicloud.base.http: {'hasMinimumDeviceForPhotosWeb'
17-01-18 18:04:17 pyicloud.base: Cookies saved
17-01-18 18:04:17 pyicloud.base: Authentication completed successfully
17-01-18 18:04:17 pyicloud.base: {'clientId
17-01-18 18:04:17 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"fmly": true, "shouldLocate": true, "selectedDevice": "all"}}
17-01-18 18:04:17 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"fmly": true, "shouldLocate": true, "selectedDevice": "all"}}
17-01-18 18:04:17 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"fmly": true, "shouldLocate": true, "selectedDevice": "all"}}
17-01-18 18:04:17 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"fmly": true, "shouldLocate": true, "selectedDevice": "all"}}
17-01-18 18:04:18 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"fmly": true, "shouldLocate": true, "selectedDevice": "all"}}
17-01-18 18:04:18 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"fmly": true, "shouldLocate": true, "selectedDevice": "all"}}
17-01-18 18:04:18 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"fmly": true, "shouldLocate": true, "selectedDevice": "all"}}
17-01-18 18:04:18 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"fmly": true, "shouldLocate": true, "selectedDevice": "all"}}
17-01-18 18:04:19 pyicloud.services.findmyiphone.http: POST https://p42-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {"clientContext": {"fmly": true, "shouldLocate": true, "selectedDevice": "all"}}

...... sleep time ........


17-01-18 18:05:16 pyicloud.base: Authenticating as

@balloobbot
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍

@martimarkov
Copy link

I don't want to open a new question for this as it seems pretty stupid to me.

In this https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/device_tracker/icloud.py#L309

What does the if clause do exactly (mainly the second part of it)?

Like if have this:

currentminutes = 1348
interval = 112

the condition will be successful so we will update the device? Why would we want to update it then?

Also I was thinking of introducing another config variable to allow manual increase of the update intervals. Would that make sense?

@geo903
Copy link
Author

geo903 commented Apr 27, 2017

The manual update interval would be very useful!

@balloobbot
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍

@balloobbot
Copy link

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍

@home-assistant home-assistant locked and limited conversation to collaborators Dec 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants