Bonjour,
J’ai un problème dans auto entitie. Je cherche à affciher des lieux sur une custom map card mais surtout avoir pour chacune de mes entités un détail quand je clique dessus.
J’ai tout essayé mais je ne m’en sors pas.
Voilà mon code:
type: custom:auto-entities
filter:
include:
- entity_id: sensor.eloisa_loc(.*)
options:
tap_action:
action: call-service
service: browser_mod.popup
data:
title: Details
content:
type: vertical-stack
cards:
- type: custom:auto-entities
card:
type: grid
columns: 1
square: false
card_param: cards
filter:
template: >
{% set ns = namespace(select=[]) %} {% set SENSOR
="sensor.eloisa_loc_leisure_library" %} {% for attr in
states[SENSOR].attributes %}
{% if state_attr(SENSOR, attr).detail is defined %}
{% set secondary = "" %}
{% set linkAction = "none" %}
{% if state_attr(SENSOR, attr).detail2 is defined %}
{% set secondary = state_attr(SENSOR, attr).detail2 %}
{%endif%}
{% if attr == "link" %}
{% set linkAction = {
"action": "url",
"url_path": state_attr(SENSOR, attr).detail2
} %}
{%endif%}
{% set ns.select = ns.select + [
{
"type": "custom:mushroom-template-card",
"primary": state_attr(SENSOR, attr).detail,
"secondary": secondary,
"multiline_secondary": "true",
"icon": state_attr(SENSOR, attr).icon,
"icon_color": state_attr(SENSOR, "color"),
"tap_action": linkAction
}
] %}
{% endif %}
{% endfor %}
{{ns.select}}
exclude: []
card:
type: custom:map-card
history_start: 24 hours ago
Pour tester j’ai mis un nom d’entité en dur:
{% set SENSOR ="sensor.eloisa_loc_leisure_library" %}
Ca marche très bien. mais maintenant j’aimerais pouvoir le rendre dynamique et récupérer le nom de l’entité provenant du premier custom entities
Avoir un truc de ce style:
{% set SENSOR = current_entity %}
Mais comment je peux récupérer ce current entity?
merci,