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

Waze error seems to kill all tracking #1

Closed
jcollas opened this issue Nov 19, 2019 · 19 comments
Closed

Waze error seems to kill all tracking #1

jcollas opened this issue Nov 19, 2019 · 19 comments

Comments

@jcollas
Copy link

jcollas commented Nov 19, 2019

Seeing this in the logs:

2019-11-19 07:51:30 ERROR (SyncWorker_2) [custom_components.icloud3.device_tracker] ►►INTERNAL ERROR-RETRYING (_get_distance_data:WazeError-unsupported operand type(s) for /: 'NoneType' and 'int')
2019-11-19 07:51:30 WARNING (MainThread) [homeassistant.components.device_tracker] Could not parse gps value for iphone: (None, None)

Things work fine for a while, then this error pops up, and tracking seems to freeze for all phones.

@gcobb321
Copy link
Owner

gcobb321 commented Nov 19, 2019

The log file will(May) show some line numbers on statements around the one you posted. That will help fixing the problem.

Edit: Line numbers are not available but I have briefly looked at that piece of code. I’ll add a bit more error checking to catch the error (whichIs actually no location data is available to calculate distances from home) before it creates problems. I’ll let you know when it is available an how to download it.

@jcollas
Copy link
Author

jcollas commented Nov 20, 2019

The log is gigantic. Here's some tidbits I see.

2019-11-19 08:14:15 DEBUG (SyncWorker_19) [custom_components.icloud3.device_tracker] ◆iphone◆ ___ Write Attrs ___ (DetIntlErrorRetry)

I think this one is ok, it's just handling a retry. There are no apparent errors before this. It shows up 7-10 times before the larger failure.

2019-11-19 08:19:51 INFO (SyncWorker_5) [custom_components.icloud3.device_tracker] Waze Server Error=Internal Error, Retrying (#1)
From: 41.728912,-72.582838 - to: 41.728912,-72.582838
2019-11-19 08:19:57 INFO (SyncWorker_5) [custom_components.icloud3.device_tracker] Waze Server Error=Internal Error, Retrying (#2)
From: 41.728912,-72.582838 - to: 41.728912,-72.582838
2019-11-19 08:19:58 INFO (SyncWorker_5) [custom_components.icloud3.device_tracker] Waze Server Error=Internal Error, Retrying (#3)

This one looks a little more serious. This also happens 7-10 times.

2019-11-19 08:41:50 DEBUG (SyncWorker_14) [custom_components.icloud3.device_tracker] ◆iphone◆ ►GET CURRENT ZONE END, Zone=park, GPS=(42.345900, -71.10900), StateThisPoll=park, LastZone=park_dr_condo, ThisZone=park
2019-11-19 08:41:50 ERROR (SyncWorker_14) [custom_components.icloud3.device_tracker] ►►INTERNAL ERROR-RETRYING (_get_distance_data:WazeError-unsupported operand type(s) for /: 'NoneType' and 'int')

Nothing untoward until this error. Looks like it was scanning zones until the error showed up.

If you need more detailed logs, please let me know.

@gcobb321
Copy link
Owner

I added some additional error checking into iCloud3 to try and catch this error before it occurs. I've uploaded it to the prerelease directory i the iCloud3 repository.

@jcollas
Copy link
Author

jcollas commented Nov 21, 2019

I tried the prerelease version (device_tracker.py), I'm getting the same error (but slightly different)

2019-11-20 18:53:17 WARNING (MainThread) [homeassistant.components.device_tracker] Could not parse gps value for phone: (None, None)
2019-11-20 18:53:20 ERROR (SyncWorker_18) [custom_components.icloud3.device_tracker] ►►INTERNAL ERROR-RETRYING (_determine_interval:SetLocation-local variable 'calc_dist_last_poll_moved' referenced before assignment)
2019-11-20 18:53:20 WARNING (MainThread) [homeassistant.components.device_tracker] Could not parse gps value for iphone: (None, None)

@gcobb321
Copy link
Owner

I’ll fix that tomorrow. Question-has Waze ever worked for you or are you in a location where it is not available? I ask because the error msgs look like they are showing the Waze program that I call blowing up.

@jcollas
Copy link
Author

jcollas commented Nov 21, 2019

So I see several waze attributes for tracked devices. I use fmf because of 2FA, but once a device settles in a zone for a while, I think waze gets bored and stops returning data.

I have about 15-20 zones. Devices are talking to icloud on a 30 minute interval. I'd love to get all users on HomeAssistantiOS 2, but that's going to be a while yet, and so iCloud3 is the primary mechanism for tracking right now.

@gcobb321
Copy link
Owner

ICloud3 will not use Waze if a device is within 1km of a zone. The reason is the calculation method is just as useful calculatingThe polling interval that close to a zone. Since it seems that the errors deal with Waze, you can turn Waze off with the ‘dist_method: calc’ parameter. I don’t know if that will work for you but wanted to mention it.

How many devices are you tracking?

@jcollas
Copy link
Author

jcollas commented Nov 21, 2019

I'm tracking 5 phones. I've got 23 active zones, which overlap (are within 1k of each other)

@naseemr
Copy link

naseemr commented Nov 21, 2019

I am seeing the followin error.
2019-11-20 22:50:35 INFO (SyncWorker_18) [custom_components.icloud3.device_tracker] FmF update started
2019-11-20 22:50:35 ERROR (SyncWorker_18) [custom_components.icloud3.device_tracker] ►►INTERNAL ERROR-RETRYING (_get_distance_data:WazeError-unsupported operand type(s) for /: 'NoneType' and 'int')
2019-11-20 22:50:35 WARNING (MainThread) [homeassistant.components.device_tracker] Could not parse gps value for yee: (None, None)

@jcollas
Copy link
Author

jcollas commented Nov 21, 2019

I've set distance_method: calc in my configuration, and I'm still getting

2019-11-21 05:42:55 ERROR (SyncWorker_19) [custom_components.icloud3.device_tracker] ►►INTERNAL ERROR-RETRYING (_determine_interval:SetLocation-local variable 'calc_dist_last_poll_moved' referenced before assignment)
2019-11-21 05:42:55 WARNING (MainThread) [homeassistant.components.device_tracker] Could not parse gps value for iphone: (None, None)

@gcobb321
Copy link
Owner

I am suspecting that it is either trying to determine theCurrent zone out no location data is available at the time. Let’s Turn on debug logging. Put ‘log_level: debug,interval’ in your iCloud3 config andRestart ha. After you get the error, email your complete ha log file to geekstergary@gmail.com. I need the whole file so I can see how it initialized and then how it got the error.

@gcobb321
Copy link
Owner

I just uploaded v2.0.1b to the 'prerelease' directory. It contains additional location validation checks to make sure the gps coordinates are available before any calculations are made to try an ctch the errors you are getting.

@gcobb321
Copy link
Owner

gcobb321 commented Nov 21, 2019

naseemr, jcolla My wife rn into a 'gps (none, none)' error today similar to the one you have been experiencing. The sequence of events was (1) Same location for more than 8-minutes and a Stationry zone was created, (2) the gps location was old so it set the next poll to 15-secs, (3) it was still old so it went into an error recovery and used the last location while resetting the attributes. There is a check to see what last location data should be used during the reset (if in a zone-use that zones data, if was in a zone nut not now-use the previous zones data, otherwise use the current data that is old). I do not know what condition was triggering the condition but one of them was the (none, none).

I have uploaded a test version (device_tracker_v2.0.1c-gps_trace_logger.py) that has a lot of traces and will log debug into to the ha log file. I'm hoping I can catch the condition to see what is causing the error. I have also add checks for the (none, none) that is different from the others to catch the error and just continue. Rename your current device_tracker.py, rename the above one to device_tracker.py and restart ha.

Could you run this for a day and send me your complete ha log file. Email it to geekstergary@gmail.com

BTW - I am headed out of the country for 7-weeks on Dec 1st. I'll be able to very minor mods but nothing major. I'll also have internet so will be able to look at stuff if anything pops up. Naturally, I'd like to nail this down before I leave.

Thanks
Gary

@jcollas
Copy link
Author

jcollas commented Nov 21, 2019

This is new, in v2.0.1b. I'm going to install your new gps_trace_logger now and do what you asked.

2019-11-21 18:07:49 WARNING (MainThread) [homeassistant.components.device_tracker] Could not parse gps value for iphone: (None, None)
2019-11-21 18:07:50 ERROR (SyncWorker_10) [custom_components.icloud3.device_tracker] unsupported operand type(s) for /: 'NoneType' and 'int'
Traceback (most recent call last):
File "/config/custom_components/icloud3/device_tracker.py", line 3723, in _get_distance_data
this_lat, this_long)
File "/config/custom_components/icloud3/device_tracker.py", line 7058, in _calc_distance_km
d = distance(from_lat, from_long, to_lat, to_long) / 1000
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
2019-11-21 18:07:50 ERROR (SyncWorker_10) [custom_components.icloud3.device_tracker] ►►INTERNAL ERROR-RETRYING (_get_distance_data:InitializeDist-unsupported operand type(s) for /: 'NoneType' and 'int')
2019-11-21 18:07:50 WARNING (MainThread) [homeassistant.components.device_tracker] Could not parse gps value for iphone: (None, None)

@gcobb321
Copy link
Owner

gcobb321 commented Nov 22, 2019

I’ll look at that error. It happens during the calculation of distance moved since the last poll using the current gps and the last gps values. One of them is not set and generating the error. Which one and why is the question.
Can you send me your zone.yaml file (or post it here) and I’ll try it on my system to see if I can duplicate the error.

@jcollas
Copy link
Author

jcollas commented Nov 22, 2019

I did a little debugging, and last_lat and last_lon are None.

2019-11-22 15:25:16 ERROR (SyncWorker_13) [custom_components.icloud3.device_tracker] last_lat is none
2019-11-22 15:25:16 ERROR (SyncWorker_13) [custom_components.icloud3.device_tracker] last_long is none
2019-11-22 15:25:16 ERROR (SyncWorker_13) [custom_components.icloud3.device_tracker] unsupported operand type(s) for /: 'NoneType' and 'int'
Traceback (most recent call last):
File "/config/custom_components/icloud3/device_tracker.py", line 3760, in _get_distance_data
this_lat, this_long)
File "/config/custom_components/icloud3/device_tracker.py", line 7111, in _calc_distance_km
d = distance(from_lat, from_long, to_lat, to_long) / 1000
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
2019-11-22 15:25:16 ERROR (SyncWorker_13) [custom_components.icloud3.device_tracker] ►►INTERNAL ERROR-RETRYING (_get_distance_data:InitializeDist-unsupported operand type(s) for /: 'NoneType' and 'int')
2019-11-22 15:25:16 WARNING (MainThread) [homeassistant.components.device_tracker] Could not parse gps value for iphone: (None, None)

@gcobb321
Copy link
Owner

As it turns out, it was caused by saving the Stationary zone location. It was saving it as 'gary_iphone_stationary' but retrieving it as 'stationary'. Since just 'stationary' was incorrect, it had no value, thus the 'None' error.

I just uploaded v2.0.1d into the prerelease directory (device_tracker.py) which fixes this. If it doesn't, add the 'log_level: debug, interval' parameter or turn it on using the icloud3_update command to log some debug info.

@jcollas
Copy link
Author

jcollas commented Nov 23, 2019

Running v2.0.1d, still have the error. I will confirm which if it's last_lag/last_long that are still None.

2019-11-22 20:57:01 WARNING (MainThread) [homeassistant.components.device_tracker] Could not parse gps value for iphone: (None, None)
2019-11-22 20:57:05 ERROR (SyncWorker_4) [custom_components.icloud3.device_tracker] unsupported operand type(s) for /: 'NoneType' and 'int'
Traceback (most recent call last):
File "/config/custom_components/icloud3/device_tracker.py", line 3808, in _get_distance_data
this_lat, this_long)
File "/config/custom_components/icloud3/device_tracker.py", line 7170, in _calc_distance_km
d = distance(from_lat, from_long, to_lat, to_long) / 1000
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
2019-11-22 20:57:05 ERROR (SyncWorker_4) [custom_components.icloud3.device_tracker] ►►INTERNAL ERROR-RETRYING (_get_distance_data:InitializeDist-unsupported operand type(s) for /: 'NoneType' and 'int')
2019-11-22 20:57:05 WARNING (MainThread) [homeassistant.components.device_tracker] Could not parse gps value for iphone: (None, None)

@gcobb321
Copy link
Owner

I uploaded v2.0.1e-traceon with a check in the calculation routine to set the calculated distance to 0 if latitude or longitude = None (None, None) in error msg. Trace is also on that I can use to see where it is getting set to None. It may not give the error msg but I would like the ha log file this time to see what is really going on.

thanks for your help. Email to geekstergary@gmail.com. I won't do any else until I get the log file. You will see an error in the Event Log when the error occurs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants