Closed mathgim closed 1 year ago
Both your variants are wrong. The 2nd variant MAY work with https://github.com/iantrich/config-template-card/pull/110 (have not checked). Use smth like:
${"climate.radiator_" + RADIATOR}
Yes it works, thank you! Is there a way to transform the variable in that way:
Otherwise, HA does not recognize the entity id. Last solution would be to modify the names in the dropdown list but I wanted to keep them as they are for aesthetic reasons 😊
Mathieu
From: ildar170975 @.> Sent: Monday, May 29, 2023 11:10:49 PM To: iantrich/config-template-card @.> Cc: flouck @.>; Author @.> Subject: Re: [iantrich/config-template-card] Use variable in entity id (Issue #130)
Both your variants are wrong. The 2nd variant MAY work with #110https://github.com/iantrich/config-template-card/pull/110 (have not checked). Use smth like:
${"climate.radiator_" + RADIATOR}
— Reply to this email directly, view it on GitHubhttps://github.com/iantrich/config-template-card/issues/130#issuecomment-1567520661, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOK7FD7LXFJMLZR57KVNIO3XIUGFTANCNFSM6AAAAAAYTFCB7M. You are receiving this because you authored the thread.Message ID: @.***>
Is there a way to transform the variable in that way:
Use JS to make required transformations. All templates in the card are based on JS.
OK, i have something similar but cant get it to work. I created a select template with the values of my remotes. I want to
type: vertical-stack
cards:
- type: entities
entities:
- entity: select.chromecast_devices
name: Select Chromecast
show_header_toggle: false
- type: custom:config-template-card
variables:
- states['select.chromecast_devices'].state
entities:
- select.chromecast_devices
card:
type: entities
entities:
- entity: ${"select.chromecast_devices"}
How do I get it to make the entity the value of the select?
Strongly suggest to ask similar questions in an already present dedicated config-template-card
thread in Community and leave GitHub for reporting bugs & proposing FRs & PRs.
I was actually able to figure it out.
The Template is
- select:
- name: "Chromecast Devices"
state: >
{% if is_state("input_text.chromecast_device", "") %}
living_room_tv
{% else %}
{{ states('input_text.chromecast_device') }}
{% endif %}
options: >
{{ states.remote
| map(attribute ='entity_id') | list | replace('remote.', '') }}
select_option:
- service: input_text.set_value
target:
entity_id: input_text.chromecast_device
data:
value: "{{ option }}"
And in the view
type: custom:config-template-card
variables:
DEVICE: states['select.chromecast_devices'].state
entities:
- select.chromecast_devices
card:
type: vertical-stack
cards:
- type: entities
entities:
- entity: select.chromecast_devices
name: Select Chromecast
show_header_toggle: false
- entity: ${"remote." + DEVICE}
this way I was able to use it dynamically.
Then please close the issue if resolved.
Then please close the issue if resolved.
I would if I opened it
Answers to the initial question were provided here - https://github.com/iantrich/config-template-card/issues/130#issuecomment-1567520661
I have many radiators having a dedicated name each of them. I have a dropdown list for users to select the radiator they want to visualize. I would like the vairable to be inside the entity id. Is it already possible?
entity: ${climate.radiator_RADIATOR}
or something like that :entity: climate.radiator_${RADIATOR}