sure, its a bit complex, but works well:
- unique_id: here_destination
state: >
{% set select = states('input_select.destination') %}
{% if select == 'Thuis'%} {% set destination = 'zone.home' %}
{% elif select in ['Marijn','P2','P3','P4','P5','P6'] %}
{% set destination = 'person.' ~ select|lower %}
{% else %} {% set destination = 'zone.' ~ select|slugify %}
{% endif %}
{{destination}}
picture: >
{% set select = states('input_select.destination') %}
{% if select in ['Marijn','P2','P3','P4','P5','P6'] %}
{% set destination = 'person.' ~ select|lower %}
{{state_attr(destination,'entity_picture')}}
{% else %} /local/travel/destination.png
{% endif %}
attributes:
latitude: >
{% set select = states('input_select.destination') %}
{% if select == 'Thuis'%} {% set result = 'zone.home' %}
{% elif select in ['Marijn','P2','P3','P4','P5','P6'] %}
{% set person = 'person.' ~ select|lower %}
{% set result = 'zone.home' if states(person) == 'home' else
'person.' ~ select|lower %}
{% else %} {% set result = 'zone.' ~ select|slugify %}
{% endif %}
{% set lat = state_attr(result,'latitude') %}
{{lat}}
longitude: >
{% set select = states('input_select.destination') %}
{% if select == 'Thuis'%} {% set result = 'zone.home' %}
{% elif select in ['Marijn','P2','P3','P4','P5','P6'] %}
{% set person = 'person.' ~ select|lower %}
{% set result = 'zone.home' if states(person) == 'home' else
'person.' ~ select|lower %}
{% else %} {% set result = 'zone.' ~ select|slugify %}
{% endif %}
{% set lon = state_attr(result,'longitude') %}
{{lon}}
and the same for
- unique_id: here_origin
state: >
{% set select = states('input_select.origin') %}
{% if select == 'Thuis'%} {% set origin = 'zone.home' %}
{% elif select in ['Marijn','P2','P3','P4','P5','P6'] %}
{% set origin = 'person.' ~ select|lower %}
{% else %} {% set origin = 'zone.' ~ select|slugify %}
{% endif %}
{{origin}}
etcetc
so this relies on having those input_select’s, and person device_trackers with lat/long (which I have also set as possible from/to options in the input_select). Got to realize that person trackers in zone home do Not have a lat/long, so that is a reason I base those off the custom component Composite, which always sets the lat/long correctly, even when in zone home.
the final Here sensors are made by the integration,
and I have a script that updates the entities, so it doesnt have to poll constantly
script:
update_routeplanner_dynamic:
sequence:
service: homeassistant.update_entity
target:
entity_id:
- sensor.here_route_planner_distance
- sensor.here_route_planner_duration
and I can push the button in the dashboard.
originally, I had the route (itinerary below in the commented section) I the map, but that has been taken from us… and never replaced by anything alike.
crd now is this:
type: entities
title: Routeplanner
card_mod:
class: class-header-margin
entities:
- input_select.origin
- input_select.destination
- entity: script.update_routeplanner_dynamic
action_name: Hernieuw
- type: custom:fold-entity-row
head:
type: section
label: Routebeschrijving
card_mod: &label
style: |
.label {
margin-left: 0px !important;
}
padding: 0
entities:
- type: custom:hui-element
card_type: markdown
card_mod:
style: |
ha-card {
box-shadow: none;
margin: 0px -16px;
}
content: >
{% set duur = states('sensor.here_route_planner_duration') %}
{% set afstand = states('sensor.here_route_planner_distance') %}
Van: {{states('input_select.origin')}} Naar: {{states('input_select.destination')}}
Duur: {{duur}} minuten, Afstand: {{afstand}} km.
- type: custom:fold-entity-row
head:
type: section
label: op Kaart
card_mod: *label
padding: 0
card_mod:
style: |
div#items {
margin: 16px -16px -16px -16px;
}
entities:
- type: custom:hui-element
card_type: map
card_mod:
style: |
ha-card {
box-shadow: none;
}
entities:
- sensor.here_origin
- sensor.here_destination
- type: custom:fold-entity-row
head:
type: section
label: Details
card_mod: *label
padding: 0
entities:
- entity: sensor.here_origin
name: Van
- entity: sensor.here_destination
name: Naar
# - sensor.here_route_planner_route
- entity: automation.update_travel_sensors
secondary_info: last-triggered
state_color: true
- entity: automation.update_travel_options
secondary_info: last-triggered
state_color: true
# - type: custom:fold-entity-row
# head:
# type: section
# label: Itinerary
# padding: 0
# entities:
# - type: custom:waze-card
# card_mod:
# style: |
# ha-card {
# box-shadow: none;
# }
# title: ''
# entities:
# - entity: sensor.here_route_planner