Waze travel time update

I get the same error as @ptdalen. My configuration:

platform: waze_travel_time
name: Time To XXX (Waze)
region: 'IL'
origin: !secret home_address
destination: !secret xxx_address

The secrets are just regular strings with the relevant addresses

Iā€™m not sure the waze resource that is being used supports south africa. You could trying switch your region to EU

Thx! I did that and it workedā€¦ yay!

Good to know, I wasnā€™t sure where Africa would fall.

I get the same error using zones, gps, or device trackers.

As of now, it show travel time in minutes, is it possible to show it in hours AND minutes when itā€™s more than 59 minutes?

No this is not possible because of the nature of time. It would not plot in history properly if the units were hours and minutes. It would have to be hours or minutes, not a combination of both.

Yesterday (September 4) at around 13:45 central time the Waze route calculator stopped for me. I restarted my HA docker as that has fixed the issue in the past, but this time it did not. Almost 20 hours later, Iā€™m still getting the following error.

018-09-05 09:13:23 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.home_to_work fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 196, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 319, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/util/__init__.py", line 318, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/sensor/waze_travel_time.py", line 204, in update
    routes = params.calc_all_routes_info()
  File "/usr/local/lib/python3.6/site-packages/WazeRouteCalculator/WazeRouteCalculator.py", line 142, in calc_all_routes_info
    routes = self.get_route(npaths, time_delta)
  File "/usr/local/lib/python3.6/site-packages/WazeRouteCalculator/WazeRouteCalculator.py", line 92, in get_route
    response_json = response.json()
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 896, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.6/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.6/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Anyone else experiencing this, or know what I can do to fix it again?

Itā€™s quite possible that waze changed their API again, that happend about 2 months ago. What version of HA are you running?

0.73.2 but I have the updated waze_travel_time.py file from 0.75 in my custom_components folder.

I donā€™t remember which version it went into. Do you have the required resource in the custom_components too?

It was 0.75 the PR got pushed into. I do not have any other resource for Waze in my custom_components folder. However, it was working for the past few weeks with no issue.

Yeah, thatā€™s surprising. The fix for your error was done in the resource, not the component. You need to use the updated resource.

Ok thanks. Iā€™m holding out on updating due to the user system implementation and the iOS app (waiting for that update). Iā€™m sure it works, and I have a development docker to test it, but I havenā€™t had time to test things yet. Iā€™ll go extract the new Waze component and resource files and try again.

Just go to 0.75, thatā€™s where Iā€™ve been sitting until all this user stuff blows over

You can also go out and get the resource and just plop it in the custom_component folder

Yep thatā€™s my plan. wait for the user stuff to blow over and bugs to be hammered out and just update the components as needed for now.

Updated to 0.76.2 and cleared out my custom_components and deps folder of anything for Waze and it is working now. Thanks.

1 Like

id be interested to try that, how is that done?

take this: https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/sensor/waze_travel_time.py and place it in
/config/custom_components/sensor/ ?

Go out to git and get the version thatā€™s required, which should be the latest anyways. I believe itā€™s called WazeRouteCalculator. and you need to get version 0.6. Download the files and place the whole required file structure in the custom_components root directory, not sensor. Although I could be wrong about that, it might need to be in sensor.