kovacsbalu / WazeRouteCalculator

Calculate actual route time and distance with Waze api
GNU General Public License v3.0
144 stars 57 forks source link

HA reports an error in WazeRouteCalculator #61

Closed vlebourl closed 2 years ago

vlebourl commented 2 years ago

Hey, I'm using the waze component in Home Assistant that uses this package. The component reports the following:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/waze_travel_time/sensor.py", line 238, in first_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/waze_travel_time/sensor.py", line 264, in update
    self._waze_data.update()
  File "/usr/src/homeassistant/homeassistant/components/waze_travel_time/sensor.py", line 320, in update
    routes = params.calc_all_routes_info(real_time=realtime)
  File "/usr/local/lib/python3.9/site-packages/WazeRouteCalculator/WazeRouteCalculator.py", line 203, in calc_all_routes_info
    results = {route['routeName']: self._add_up_route(route['results'], real_time=real_time, stop_at_bounds=stop_at_bounds) for route in routes}
  File "/usr/local/lib/python3.9/site-packages/WazeRouteCalculator/WazeRouteCalculator.py", line 203, in <dictcomp>
    results = {route['routeName']: self._add_up_route(route['results'], real_time=real_time, stop_at_bounds=stop_at_bounds) for route in routes}
TypeError: list indices must be integers or slices, not str

Is it coming from your side? cheers.

MarkRK commented 2 years ago

I am getting the same error since yesterday. Good to know i'm not the only one.

kovacsbalu commented 2 years ago

Hi, can you please provide some details about this issue? Which WRC version? What was the requested route?

vlebourl commented 2 years ago

Home Assistant uses version 0.13: https://github.com/home-assistant/core/tree/dev/homeassistant/components/waze_travel_time

In my case the route is between the current phone location to the home. Home Assistant is in charge of translating that, I don't know yet how that translates into a request.

vlebourl commented 2 years ago

I just updated to the latest beta version of Home Assistant, and the error disappeared... I'll close this and will reopen in case it happens again. Cheers.