-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
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 - "Timeout getting route" Trying to Add New Route #100417
Comments
Hey there @eifinger, mind taking a look at this issue as it has been labeled with an integration ( Code owner commandsCode owners of
(message by CodeOwnersMention) waze_travel_time documentation |
Hi @mathmaniac43. Sometimes the Waze servers are overloaded. I just tried your route manually with pywaze and it succeded. Can you try again? |
Thanks for the tip. Just tried again, same failure. It is possible that the servers are overloaded again. I can wait, hope, and try again... but would love to see a more robust solution if possible. |
The timeout should be 10s. Do you have the feeling that it takes that long or does it error out after 3-5s already? |
Tried a few more times and timed it. Definitely not 10s. I'd say approximately 5 or 6 typically.
Sep 15, 2023 07:50:51 Kevin Stillhammer ***@***.***>:
…
The timeout should be 10s. Do you have the feeling that it takes that long or does it error out after 3-5s already?
—
Reply to this email directly, view it on GitHub[#100417 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAHAHYONSPVB225VXWMUJ5TX2Q6JVANCNFSM6AAAAAA4ZCZI74].
You are receiving this because you were mentioned.[Tracking image][https://github.com/notifications/beacon/AAHAHYNGEW7DQ47ZBWZHO2TX2Q6JVA5CNFSM6AAAAAA4ZCZI76WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTGS2QBW.gif]
|
Default timeout was 5 not 10. Raised a PR to change that. |
Making it configurable is a lot more work and can be done at a later time |
Totally get it, and hopefully this will work for most folks anyways. I appreciate the rapid response and fix! |
Hello! Upgraded to 2023.9.3 today, which updated the timeout to 10s. Wanted to share my status. The route I tried still timed out. I decided to work around the issue by making source and destination text helpers, using close-to-one-another addresses in them to allow me to add the Waze entity using those helpers, then set the helpers to the actual far-apart addresses. Each time I try to manually update the entities, I get a warning about the 10s timeout. So for my case at least, a higher and/or configurable timeout will be needed. I assume this is a future and potentially low-priority task, which I understand. Let me know if you would like me to make a new issue for that. Thanks. |
Hi. Thank you for your fast feedback. Would you be willing to run a python script to give me more insight into your timeouts? |
Steps for linux/macOS are as follows (let me know if you are in Windows and can't use WSL):
mkdir waze_test
cd waze_test
touch time_it.py
python3 -m venv venv
source venv/bin/activate
pip3 install pywaze
python3 ./time_it.py #!/usr/bin/env python3
import asyncio
import time
from pywaze import route_calculator
async def get_times(start: str, end: str) -> list[float]:
"""Return the travel time home."""
durations = []
async with route_calculator.WazeRouteCalculator(timeout=60) as client:
for _ in range(20):
try:
start_time = time.time()
await client.calc_route_info(start, end)
duration = time.time() - start_time
print(f"Duration: {duration}")
durations.append(duration)
except Exception as e:
print(f"Error: {e}")
await asyncio.sleep(0.5)
print(f"Average: {sum(durations) / len(durations)}")
print(f"Min: {min(durations)}")
print(f"Max: {max(durations)}")
start = "50.00332659227126,8.262322651915843"
end = "50.08414976707619,8.247836017342934"
asyncio.run(get_times(start, end)) |
Yes, will try to run that later today and get back to you. I will first try to run it in my HA Docker container if I can to capture the runtime as accurately as possible. |
Ran a few times from inside my container, as promised. Thanks again for taking another look. Results from the original script (with what I assume are lat/long):
Modified script (with the example addresses I used in the issue description): #!/usr/bin/env python3
import asyncio
import time
from pywaze import route_calculator
async def get_times(start: str, end: str) -> list[float]:
"""Return the travel time home."""
durations = []
async with route_calculator.WazeRouteCalculator(timeout=60) as client:
for _ in range(20):
try:
start_time = time.time()
start_coords = await client.address_to_coords(start)
end_coords = await client.address_to_coords(start)
start_coords_str = f'{start_coords["lat"]},{start_coords["lon"]}'
end_coords_str = f'{end_coords["lat"]},{end_coords["lon"]}'
await client.calc_route_info(start_coords_str, end_coords_str)
duration = time.time() - start_time
print(f"Duration: {duration}")
durations.append(duration)
except Exception as e:
print(f"Error: {e}")
await asyncio.sleep(0.5)
print(f"Average: {sum(durations) / len(durations)}")
print(f"Min: {min(durations)}")
print(f"Max: {max(durations)}")
start = "1600 Pennsylvania Avenue NW, Washington, DC 20500"
end = "351 West 31st Street, New York, NY 10001"
asyncio.run(get_times(start, end)) Modified Script Results:
Maybe I am paranoid, but the fact that the time changes so arbitrarily makes me wonder if there is some kind of cycle where the servers are being hammered... maybe I'll try a few seconds of offset from the "every 5 minutes" update automation I have, instead of at zero seconds... |
This is really odd. It never comes close to the 10s timeout. Do your requests in HA always time out or just "sometimes"? |
The HA timeouts are consistent, every single time using the addresses I provided. I have no idea what's causing it to time out at this point... |
Can you run my original script again but use the addresses from your modified example? Maybe this yields different responses.... |
The problem
Hello,
I have a few Waze Travel Time Entities working well in HA. I want to add another one, but for a much longer route (several hours). This fails during setup (as in, I try to add the Entity, but cannot because it times out and errors), presumably because it is taking too long for the Waze API to return the result and a timeout occurs.
Here are example settings that demonstrate the timeout problem:
Origin: 1600 Pennsylvania Avenue NW, Washington, DC 20500
Destination: 351 West 31st Street, New York, NY 10001
Region: North America or USA
Is there a way to optionally increase the timeout for a Waze Entity when setting it up? I think that keeping the timeout relatively short by default makes sense, but it would be great to have the option to increase it for known long routes (and perhaps have that setting persist for each time the entity updates).
Thanks!
Nick
What version of Home Assistant Core has the issue?
core-2023.9.2
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Waze Travel Time
Link to integration documentation on our website
https://www.home-assistant.io/integrations/waze_travel_time
Diagnostics information
N/A
Example YAML snippet
N/A
Anything in the logs that might be useful for us?
This is from the log, copied from the web UI.
Additional information
N/A
The text was updated successfully, but these errors were encountered: