-
Pimatic phone icloud error
This post is deleted! -
So, I have a Problem with the actual Version:
After the initial adding of two devices (one with 2-factor-auth, one without) both devices update their location.
I set the interval to 1200 seconds, but when they try to update i get this error:Device update of “iphone” failed, ICloudError: Unknown error [450]
I had one device activated today with a interval of 600, wich worked, but then i changed the interval to 1200 and now it doesnt update.
i will wait if it successfully updates once in the next hours and if not set it back to 600 and report back -
@theslashy , thanks for the report. I’ll try to reproduce the error. I remember, I got the 450 response during testing when deleting the cookie of an established session…
-
@bstrebel said in Pimatic phone icloud error:
@theslashy , thanks for the report. I’ll try to reproduce the error. I remember, I got the 450 response during testing when deleting the cookie of an established session…
Perhaps something related to this:
when I edit the Phone Device it doesnt show any location but in the debug info I see[pimatic-phone] debug: Update location for iPhone-5: GPS:xxxxxxxxxxxxxxxxx,xxxxxxxxxxxxxxxxxxxxxxx
(with the real coordinates)
-
@bstrebel said in Pimatic phone icloud error:
I have experienced that, even with 2FA enabled, the verification code is not really required. 2FA is activated for my account but the plugin is able to establish a iCloud session and retrieves location updates for the device without any verification code. I just ignore the notification email and the 2FA pop up on the device. The notificatians are generated only once, wenn the session is established on pimatic startup. I think you should give it a try …
One thing to this:
Just create a code on your iphone and add the code to the end of your password, works for me
-
@theslashy said in Pimatic phone icloud error:
@bstrebel said in Pimatic phone icloud error:
I have experienced that, even with 2FA enabled, the verification code is not really required. 2FA is activated for my account but the plugin is able to establish a iCloud session and retrieves location updates for the device without any verification code. I just ignore the notification email and the 2FA pop up on the device. The notificatians are generated only once, wenn the session is established on pimatic startup. I think you should give it a try …
One thing to this:
Just create a code on your iphone and add the code to the end of your password, works for me
Could you pls. provide a step-by-step description how you manage this? How do you create a verification code? I get the verifaction code popup after log in (without code) during device initialization. I’m not able to use this code for the next client session (with other ID, cookies, etc. …) by appending it to the password. I get a failure on login …
-
@theslashy said in Pimatic phone icloud error:
@bstrebel said in Pimatic phone icloud error:
@theslashy , thanks for the report. I’ll try to reproduce the error. I remember, I got the 450 response during testing when deleting the cookie of an established session…
Perhaps something related to this:
when I edit the Phone Device it doesnt show any location but in the debug info I see[pimatic-phone] debug: Update location for iPhone-5: GPS:xxxxxxxxxxxxxxxxx,xxxxxxxxxxxxxxxxxxxxxxx
(with the real coordinates)
I could reproduce the error in my environment and found that an idle session has to be refreshed every 10 minutes. Unfortunately this refresh call doesn’t work with 2FA enabled accounts. As a short term fix, I could implement the session refresh for 2FA disabled accounts with location update intervals > 10 minutes. Until I found a suitable solution to handle the interactive management of a verification code in a background task like the pimatic-phone plugin, we stick with high update rates (interval < 10 minutes) for 2FA accounts. Curious enough, the the location updates are working without any verification code.
-
@bstrebel
Great, thank you for your work.
I’ll try to sum up what I’m doing.
I have two devices, one with 2FA, one without.
To Generate a Code for 2FA:
Go to the Settings App->icloud->Tab the top button(your icloud account)->Password&Security->Last Button (Get Verification Code)I append this Code directly to the password in the Device setting in Pimatic, as described by apple in the link I provided a few posts up.
I’ll try to set both devices to refresh every 9 minutes and see what happens.
The Problem is that calling the location every 9 minutes will likely drain the battery of the phone, and a interval of 60 or 30 minutes would be enough I think
-
@theslashy said in Pimatic phone icloud error:
@bstrebel
Great, thank you for your work.
I’ll try to sum up what I’m doing.
I have two devices, one with 2FA, one without.
To Generate a Code for 2FA:
Go to the Settings App->icloud->Tab the top button(your icloud account)->Password&Security->Last Button (Get Verification Code)I append this Code directly to the password in the Device setting in Pimatic, as described by apple in the link I provided a few posts up.
I’ll try to set both devices to refresh every 9 minutes and see what happens.
The Problem is that calling the location every 9 minutes will likely drain the battery of the phone, and a interval of 60 or 30 minutes would be enough I think
Thanks for the explanation. I didn’t recognize the option to generate the code in advance on the iOS device. With password+code the login works without a popup on my iPad. But I’m still not able to use validate() or refreshWebAuth() on such a 2FA session to keep the client idle without requesting the iPhone . I also found that none of the public available Javascript or Python examples work as expected if you have a closer look on them. At the moment, after testing several clients I cannot login with password+code but also the warning popups are missing. The iCloud API is going to drive me crazy …
-
@daice said in Pimatic phone icloud error:
I have another question. Would it be possible to trigger the position of an device by a rule and not with a interval? This could save a lot of accupower on the phone. I’m thinking of situations like, when i’m at home and my phone is connected by wifi i don’t need the gps location service and use this service only when i’m not connected to my wifi.
regards daice
Assuming you are talking about an iOS device, I would take this as an interesting feature request. I see at least two different solutions: (a) let the pimatic-phone plugin check if the device is available and suspend iCloud requests in this case (b) use pimatic-ping plugin to check device presence and trigger a rule to suspend location updates through a new API call to pimatic-phone. Both require you to configure your DHCP-Server/WLAN-Router to use a static IP address for your phone.
The situation looks completely different for Android devices where the phone itself updates it’s location directly via an API call to your pimatic server. You can use tools and apps as described in the documentation to handle location updates with very low power consumption.
Maybe, someone develops an iOS app which uses the pimatic-phone API for efficient location updates without the need of periodically iCloud pushes.
-
@bstrebel I’m looking at a few alternatives at the moment. Thought I’d be nice to share them.
-
Owntracks
I tried setting up a MQTT server because I did not want my location to be shown to everyone who uses Owntracks. This was pretty complicated and the mqtt had to be opened to everyone which I don’t really like. -
IFTTT
With the maker channel you could create a web request to your Pimatic which alters a phone variable when you leave / enter a place. At first I thought this was the perfect solution, but then I realized I had to add my pimatic credentials in the URL. This did not feel safe. -
HomeKit
@Lex has homekit based solution: https://forum.pimatic.org/topic/2753/solution-for-ios-location-based-automation/2 but this does not work for me because I don’t have a iPad or AppleTV
All of them are not perfect solutions, I’m wondering if I missed something.
-
-
@bstrebel
I had it running the whole day and it worked and my location was logged the whole day.
Unfortunately it completely sucked my battery dry … -
@theslashy said in Pimatic phone icloud error:
@bstrebel
I had it running the whole day and it worked and my location was logged the whole day.
Unfortunately it completely sucked my battery dry …Sorry for that … Which settings did you use for the iCloudInterval? With the old default settings of 1 minute I have no problem with my iPad while the iPhone6s of my wife gets sucked. BTW, just published Rev. 0.7.2 which may be of interest for you. You will find my comments on iOS devices at the beginning of the documentation
-
@bstrebel
No Problem! I’m very happy that someone does care for this feature!!
I used 540seconds, so 9 Minutes as I have 2FA
Just installing 0.7.2 -
So it is possible to stop the continuous polling in Version 0.7.2?
-
@daice said in Pimatic phone icloud error:
So it is possible to stop the continuous polling in Version 0.7.2?
Yes. But you have have to set the suspend flag by your own rules. E.g. create a ping presence device for your iPhone and create two rules:
- if iphone is present then execute curl … /api/device/iphone_id/suspend?flag=true
- if iphone is not present for 10 minutes then execute curl …//api/device/iphone_id/suspend?flag=false
Please look at the documentation for details
-
@theslashy said in Pimatic phone icloud error:
@bstrebel
No Problem! I’m very happy that someone does care for this feature!!
I used 540seconds, so 9 Minutes as I have 2FA
Just installing 0.7.2That’s strange. Pushing a few bytes to the iCloud every 10 minutes should not consume so much power. I’ve removed 2FA for the iPhone6s and are going to use an idle session and the new suspend feature to enhance battery lifetime.
The best solution would be a native iOS App that updates the location with a web request directly in pimatic-phone like I have realized this for my Android device: If connected to WiFi it sends the SSID which is mapped to a location. On the road updates are triggered by mobile network cell id changes. Accuracy depends on my GPS settings on the phone. Very flexible, very low power consumption, very open and, at the moment, a very good reason for me not move to an iPhone but stay in this open Android ecosystem.
But maybe, you’re experienced in iOS App development? -
@Tim said in Pimatic phone icloud error:
@bstrebel I’m looking at a few alternatives at the moment. Thought I’d be nice to share them.
- Owntracks
I tried setting up a MQTT server because I did not want my location to be shown to everyone who uses Owntracks. This was pretty complicated and the mqtt had to be opened to everyone which I don’t really like.
Agree …
- IFTTT
With the maker channel you could create a web request to your Pimatic which alters a phone variable when you leave / enter a place. At first I thought this was the perfect solution, but then I realized I had to add my pimatic credentials in the URL. This did not feel safe.
Would be very nice if you could use at least basic authentication over SSL/TLS. And, of course, you have to trust the IFTTT platform …
- HomeKit
@Lex has homekit based solution: https://forum.pimatic.org/topic/2753/solution-for-ios-location-based-automation/2 but this does not work for me because I don’t have a iPad or AppleTV
No personal experience but looks Apple-like: Cool devices but a very very closed proprietary eco system. Not very flexible or extensible…
All of them are not perfect solutions, I’m wondering if I missed something.
I’ve tried to overcome these limitations for my own devices by the pimatic-phone plugin. It implements the concept of “well known locations” (mapped to SSIDs, CIDs, or GPS position+range) which can be easily used in location based rules. And it provides an open API to realize very flexible and power saving solutions where the device updates its location directly in pimatic. Using basic authorization over SSL/TLS fits my security requirements.
- Owntracks
-
@bstrebel
I don’t know why this uses so much battery, the iphone search doesnt even appear in my list of apps which use much battery.Unfortunately I’m a android developer, I’m in the progress of learning swift but I think that is beyond my possibilites yet
but I think there would already be an app who does this: locative.
Somenone mentioned it in this forum, it can push a http request when leaving a geofence.
My concern with this is: you have to open your pimatic installation to the internet.the best thing would be a url with a certificate so you can encrypt your communication to your pimatic installation and push your request directly to the pimatic api
but I’m still not very happy with opening pimatic to the web… -
@theslashy said in Pimatic phone icloud error:
@bstrebel
I don’t know why this uses so much battery, the iphone search doesnt even appear in my list of apps which use much battery.Unfortunately I’m a android developer, I’m in the progress of learning swift but I think that is beyond my possibilites yet
but I think there would already be an app who does this: locative.
Somenone mentioned it in this forum, it can push a http request when leaving a geofence.Sounds good. I will have a look on it …
My concern with this is: you have to open your pimatic installation to the internet.
the best thing would be a url with a certificate so you can encrypt your communication to your pimatic installation and push your request directly to the pimatic api
but I’m still not very happy with opening pimatic to the web…My pimatic server is exposed to the internet behind a firewall/router. Only SSH and one NAT’ed high port for the HTTPS connection is open. I’m using Let’s Encrypt certificates which work well with any kind of client. The connection is as secure as the firewall and as secure as basic auth over SSL is. It works for me. I’m running an alarm system which definitely has to be reachable through an external connection.