Im trying to accomplish a dynamic waze time updater ,
I have in zone.yaml several zones .
i separate waze to waze,yaml
where i try to implement @petro suggestion for the templates
and also @Mariusthvdb for the sensors .
Im not sure i define the the input_select correctly as actually they are duplicated,
with just different name.
What is the automation that calculate the origin to destination ?
Is that correct if I want to use the zones i have in zone.yaml?
How
second, I’m working on some telegram actionable notifications
which later i want add the option to get the expected arrival time
from the current location to desire destination ,
is some1 done something similar?
my waze.yaml
sensor:
- platform: template
sensors:
destination_address:
friendly_name: Destination
value_template: >
{% set entity_id = states('input_select.waze_destination') %}
{% set lat = state_attr(entity_id, 'latitude') %}
{% set lon = state_attr(entity_id, 'longitude') %}
{{ lat }}, {{ lon }}
icon_template: mdi:map-marker-path
origin_address:
friendly_name: Origin
value_template: >
{% set entity_id = states('input_select.waze_origin') %}
{% set lat = state_attr(entity_id, 'latitude') %}
{% set lon = state_attr(entity_id, 'longitude') %}
{{ lat }}, {{ lon }}
icon_template: mdi:map-marker
- platform: waze_travel_time
name: 'Select Origin Destination'
origin: sensor.origin_address
destination: sensor.destination_address
region: 'IL'
input_select:
waze_origin:
name: waze_origin
options:
- Home
- Avi Work
- Karin Work
waze_destination:
name: waze_destination
options:
- Home
- Avi Work
- Karin Work
Imitate available variables:
{% set entity_id = states('zone.karin_Work') %}
{% set lat = state_attr('zone.karin_Work', 'latitude') %}
{% set lon = state_attr('zone.karin_Work', 'longitude') %}
{{ lat }}, {{ lon }}
The lan and lon are {{ lat }} {{ lon }}
return:
"The lan and lon are xx.82405 yy.081299"
so it does work with zone correctly
The problem from some reason the sensor don’t get this values
sensor:
origin_address:
friendly_name: Origin
value_template: >
{% set entity_id = states('input_select.waze_origin') %}
{% set lat = state_attr('entity_id', 'latitude') %}
{% set lon = state_attr('entity_id', 'longitude') %}
{{ lat }}, {{ lon }}
icon_template: mdi:map-marker
now both sensors destination and origin holds the lan,lon values,
and select_origin_destination - return the time and destination.
But it’s not being refresh in reasonable time (about ~3-4 minute),
is there an way get trigger it faster?
I want to create automation which send notification automatically when i leave predefined zone.
Can you change the log level to warning or even info? if it is expected than it is not probably error. I can suppress the error but then I will not see real errors …
@Mariusthvdb thank you for sharing your amazing card.
I do wonder if it is possible to change the fields to a friendly_name of a sort,
meaning zone.XXXX will show a zone name instead.
Origin - will show full address, instead of coordinates,
and under Travel time Name will be presented origin location and destination location?
I guess anything is possible… you need to create a few ‘mappers’, ie, template sensors that map the name to the state (for the zone), and maybe you can do the same for the frontend representation of the gps coordinates.
about the name: I only now notice that doesnt change indeed hmm. must have a look when I can find the opportunity…anytime soon. This is a Waze-card issue with the Waze sensor, so will have to go back to that (havent seen it in a while now). As I see it now, it show this sensor:
@Mariusthvdb Thank you for explaining, i did not know about the mappers option, so thank you for education me about it, though working a long while on making it work was unsuccessful.
could you please point me to where should i use mappers in this case?
changing sensor template using mapper return the name instead {{ lat }}, {{ lon }} and break the results of waze, as far as i know lovelace yaml cannot have template, there for i am a bit lost on the how to…
as for my config - it is basically similar to your implantation above.