I just installed v 1.0.1 of this component on hass.io 0.90.1. Everything configured according to documentation. When I restart HA, I get a 2FA notification from iCloud which I approve (so my credentials obviously works), but there is nowhere in the GUI where I can enter the OTP. Consequently, no entities get generated.
Any pointers to where I should look?
After two months, memory is a bit hazy. Have you looked at notifications on the Overview page?
Where the failed login notifications and similar stuff go? Yep, thatās where I expected to find it, but no such luck.
Update: I missed something in the logs that is probably significant:
Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File ā/usr/local/lib/python3.7/concurrent/futures/thread.pyā, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File ā/config/custom_components/icloud3/device_tracker.pyā, line 1231, in _polling_loop_5_sec_device
self.iosapp_update_flag[devicename] = False
UnboundLocalError: local variable ādevicenameā referenced before assignment
I found those same errors in my log being generated every 15 secsā¦ Downgraded to previous version for now until this gets fixed.
Did a reinstallation of this component. Same issue:
Sat Mar 23 2019 11:00:45 GMT+0100 (sentraleuropeisk normaltid)
Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/icloud3/device_tracker.py", line 1233, in _polling_loop_5_sec_device
self.iosapp_update_flag[devicename] = False
UnboundLocalError: local variable 'devicename' referenced before assignment
My environment:
arch | x86_64 |
---|---|
dev | false |
docker | true |
hassio | true |
os_name | Linux |
python_version | 3.7.2 |
timezone | Europe/Oslo |
version | 0.90.1 |
virtualenv | false |
Lovelace
mode | storage |
---|---|
resources | 3 |
views | 13 |
configuration.yaml:
device_tracker:
- platform: icloud3
username: !secret icloud_user_ragnar
password: !secret icloud_pass_ragnar
account_name: ragnar_icloud
custom component:
root@doffen icloud3]# pwd
/usr/share/hassio/homeassistant/custom_components/icloud3
[root@doffen icloud3]# ls
device_tracker.py __pycache__
[root@doffen icloud3]# md5sum device_tracker.py
ee331652f3472c35b87e02c0ae1e9c6c device_tracker.py
I just updated iCloud3 to v1.0.2.
A brief description of the changes:
- If you are a long way from home, it appears Waze times out and doesnāt return any route information. But if you try again, it might. I am now retrying getting waze route data. and generates an error if it doesnāt return anything after 4 retrys.
- A message in the Waze Distance field will be displayed if there were any problems, waze is paused, waze is off, etc rather than leaving it blank.
- Sharing Waze data between devices on the same iCloud account to reduce the number of calls to the Waze Route Calculator.
- Fixed some issues with the _badge where if you defined a template for a badge, the entity_picture data was getting destroyed.
- Optimizing some code related to sensors.
See the ChangeLog for details on the changes and breaking changes to the ā_badge Sensorā.
Hi,
I have a problem with configuration. I canāt confirm the code. Still have info that configuration service canāt start.
Any thought?
Errors log:
list index out of range
19:14 custom_components/icloud3/device_tracker.py (ERROR) - message first occured at 19:10 and shows up 6 times
iCloud Acount Reauthorization Needed
19:14 custom_components/icloud3/device_tracker.py (ERROR) - message first occured at 19:10 and shows up 17 times
robertpe
Try taking a look at this in the Readme
Solved, thanks. Now is working OK.
1.0.2 fixed the log errors, just as advertised. It also made the configuration dialog show up in persistent notifications. Great work!
I was working well on 1.0.1 other than sometimes it seemed to take a while to leave my home zone, I thought it might be related to timing of a restarts? Anyway, just upgraded to 1.0.2, left home, was gone for a few hours, and the icloud3 showed me as home the whole time. Even entered another zone. This was both my icloud devices.
Edit: Well I did drive past my house at the very end, and it went from home to away, and then back to home (where I am now). Weāll see, maybe it just needs to have a few zone changes after a restart?
ptdalen
Go into the IOS app Settings page, scroll down and look at the Events List. Look at each item and see if there were any Geographic Region Enter/Exit items. That is what I use to trigger a zone change. The HA log file might also show something. If I get a Background Fetch when outside of the zone without first getting an Exit notification, it throws the Fetch away and puts you back in the zone.
Also, turn on the iCloud3 debugger which writes a lot of stuff to the log file (See the end of the readme) There was a script that would do that in the config files. If you installed the script, you can turn the debugger on and off without restarting HA.
Shouldnāt need any zone changes after a restart to get synced up.
Bad GPS and old icloud records will also cause retries. Are you looking at the device_tracker.state changes or the sensor.zone changes?
I didnāt make any changes there. But the one area I did change was the Waze data history. If the phone saved some waze data that was in a zone and then reset it at a later time, it might that might have put it back into the zone. The log file would indicate the waze history was being used to rather than calling waze again. But I think waze is paused when in the home zone. If it still acts weird and you want me to look at the log file, let me know. Or send it to [email protected]
Keep me posted on what happens. Always get concerned about issues just after an update.
Gary.
Here is my icloud 3 info this morning
source type
gps
latitude
36.xxxx
longitude
-75.yyyy
gps accuracy
8
battery
100
zone
home
last zone
home
zone timestamp
03/24/19, 5:27:42
trigger
iCloud
timestamp
2019-03-25T07:29:30.249
interval
2 hrs
travel time
distance
0
calc distance
0
waze distance
last located
7:29:27
last update
7:29:30
next update
9:29:30
poll count
4:0:16
dir of travel
in_zone
travel distance
0
info
āBattery-100%
speed
0
altitude
0
battery status
NotCharging
device status
online
low power mode
false
authenticated
03/25/19, 7:29:17
tracking
pauls_icloud/paulsiphone, pauls_icloud/tracy_siphone
icloud3 version
1.0.2
account name
pauls_icloud
and here is my ios app info
source type
gps
latitude
36.differentxxx
longitude
-76.differentyyy
gps accuracy
65
battery
98
timestamp
2019-03-25T08:39:28.120-0400
course
-1
trigger
Background Fetch
altitude
1.2575989961624146
speed
-1
vertical accuracy
10
floor
2146959360
I traveled about 20 miles over 30 minutes.
I restarted HA last night. I was at home at the time, and had not left home until this morning. My wifeās phone has similiar results at the moment.
It did change to my current zone (both me and my wife at the same time) at the Next Update time.
ptdalen
From the attribute screenshots, it looks like the ios app issued:
7:58 Background Fetch
8:05 Zone Exit
8:15 device_tracker.see (this can change the device_trackerās state)
8:23 device_tracker.see
8:23 Background Fetch
8:27 Zone Enter
iCloud3 Attributes:
5:27 changed Home Zone, Last Zone is also Home
7:29 next_update time reached, did iCloud trigger
Poll count of 4:0:16 says there were 4 iCloud location updates, 0 updates from the IOS app and 16 notifications from the IOS app that were discarded. The reasons for discarding the IOS app notification are:
- the location data was more than 2 minutes old (and could be wrong)
- the gps location on a Background Fetch was outside of the zone.when the deviceās zoneā attribute was still in the zone so it was probably because the gps wandered.
Seeing the IOS transaction count of 0 says that all of the IOS app notifications were thrown away. The IOS app triggeres a state change (device_tracker.see) before iCloud3 gets the data . iCloud3, by using itās own Zone attribute that it maintains can avoid wrong state changes and correcting them when it finds them in a short period of time.
I think that is what is happening, the d_t.state is changed by the IOS app and changed back by iC3. But the Zone attribute remains the same.
In your first post, you left home and it never went to not_home. If you leave home and the IOS app doesnāt issue an Exit notification, iC3 will never change the zone. If you are always having this issue, you have two options:
- set up another ānear_zoneā down the road a bit that might wake the IOS app up (see the Readme Special Zones for more info about a ānear_zoneā.
- put a beacon in your garage and use that to also trigger a zone exit via the IOS app.
Iām thinking about adding an āevent_logā attributeā that be updated on significant events. Then you can just scroll through the āLogā entries on the HA Frontend and it will give you a sense of the iC3 events without going through the HA Log file.
Hope this helps.
Iāll continue to check on this, but just saying that, I have not changed or added zones in quite a while. I donāt think my gps data was stale, but who knows. I have three GPS device based trackers plus this one.
the iOS app, life 360 and google location sharing. These three all changed to away (not_home) within 1 minute or less of each other. Life 360 showed me as moving, and updated itās info as expected.
The iOS app showed me entering my work zone, immediately upon entering the zone. I have another automation that I use to calculate commute times from zone to zone, and it ran right on schedule, as I pulled up.
1.0.1, worked, 1.0.2 does not seem to be getting updated zone change info from my iOS app. My other iphone (wife) is acting the exact same way.
Of course I dont change zones often, so Iāll have to see what happens when I leave work today.
Do I need to sign out and back in with the iOS app, is there some cache somewhere that should have been deleted?
I wonder if iC3 is throwing away an IOS notification that it shouldnāt be. If it gets a Background Fetch and is in a zone, it looks at the distance from the zone ā¦
- distance<.05, it puts it back in the zone
- distance<1km, discard transaction
- distance<2km, relocate via iCloud location services.
Question, what changed to away, the device_tracker.paulsiphone state or the sensor.paulsiphone state?
The HA log file with the debugger on is the only way to know for sure. If you want to turn it on and email to [email protected], Iāll see if I see anything.