Waze travel time update


#81

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


#82

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


#83

Thx! I did that and it worked… yay!


#84

Good to know, I wasn’t sure where Africa would fall.


#85

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


#86

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?


#87

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.


#88

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?


#89

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


#90

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


#91

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


#92

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.


#93

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


#94

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.


#95

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


#96

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


#97

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.


#98

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


#99

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/ ?


#100

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.