Waze Travel Time [origin attribute] not accepting value / template?

I am trying to input dynamic value to origin attribute of Waze Trave Time with no success…

  • Tried lot’s of variations with ’ / " / {{ }} etc.

  • Tried playing with lot lat from device tracker / with the interpreted address produce using google travel time component (I tried taking the origin_addresses attribute from the google component and stick it in the waze component…

None seem to work - the component only seems to accept static address text (even if parsed exactly as the google travel attribute returns them) or lon,lat as static text…

is this an issue with the component or am I missing something ?

Can you post your code?

templateing ({{}}) only works in template sections.

Just from looking at the sensor, it appears as if it does not accept templating at all.

This means you will have to create a bunch of waze platforms. Each one with a with the same origin and a different destination.

Then create a template sensor that dynamically chooses and shows the correct one.

Having some trouble with templating myself: Waze Travel Time - error

1 Like

I saw your thread @Bob_NL - seemed like a dead end just as I hit it :frowning:

on Discord I got a hint from Dale saying

This is the type of code that the Waze Travel Time Sensor is missing: core/homeassistant/components/sensor/google_travel_time.py at 2cb9e2dc7c7ca9cb7cfa2f59abe7f1a084be09f8 · home-assistant/core · GitHub

So I guess you are correct @petro
however - my trying to play around with the code was unsuccessful due to my limited python skills…
seems like it’s only doing static routing until someone can augment the existing waze code with the relevant parts from google_time_travel component or something like that.

Yes, you’d also need this func in there, granted some changes would be needed:

    def _get_location_from_entity(self, entity_id):
        """Get the location from the entity state or attributes."""
        entity = self._hass.states.get(entity_id)

        if entity is None:
            _LOGGER.error("Unable to find entity %s", entity_id)
            self.valid_api_connection = False
            return None

        # Check if the entity has location attributes
        if location.has_location(entity):
            return self._get_location_from_attributes(entity)

        # Check if device is in a zone
        zone_entity = self._hass.states.get("zone.%s" % entity.state)
        if location.has_location(zone_entity):
                "%s is in %s, getting zone location",
                entity_id, zone_entity.entity_id
            return self._get_location_from_attributes(zone_entity)

        # If zone was not found in state then use the state as the location
        if entity_id.startswith("sensor."):
            return entity.state

        # When everything fails just return nothing
        return None

and a change to update would be required.

It would be a lengthy change.

@Amir974 @Bob_NL you guys willing to test out a new version?

I rewrote the bulk of the component, need a few testers for it before I attempt to put the change in github.

It’s working for me with device trackers and zones. Just need other people to verify.

Of course :wink:
Would it work if I put it in custom components folder or does it involve some other steps?

(I’m on hassio, no dev env at the moment)

Sure! No problem.


if you place it in hass_loc/custom_components/sensor/ it will override it.

Heres a link to the source. Paste the code into a file named waze_travel_time.py in the directory above. Here’s a link to the code:

I made a PR, so it should get into the regular HA build in the next release.

1 Like