Hi everybody,
my purpose is , inside a custom:config-template-card , having a custom:button-card with an entity to toggle from my frontend.
For this reason,this entity is retrieved from the config-template-card container, where a list of entities is available, and, according to some conditions that belong to another thread, when a entity from the list is selected, this one becomes the main entity of the nested custom:button-card which is enabled to be toggled.
I have the evidence of the correct selection of the entity,I tried both the ways to select it as a text ( ‘switch.entity_name’) and as a config template card variable (var[0].entity_id) but it doesnt work.
where is the mistake?
the card:
- type: custom:config-template-card
variables:
- states['input_select.icona_smart_plug_1'].state
- states['input_select.icona_smart_plug_2'].state
- states['input_select.icona_smart_plug_5'].state
- states['input_select.icona_smart_plug_6'].state
- states['input_select.icona_smart_plug_7'].state
- states['input_select.icona_smart_plug_9'].state
- states['input_select.icona_smart_plug_room_1'].state
- states['input_select.icona_smart_plug_room_2'].state
- states['input_select.icona_smart_plug_room_5'].state
- states['input_select.icona_smart_plug_room_6'].state
- states['input_select.icona_smart_plug_room_7'].state
- states['input_select.icona_smart_plug_room_9'].state
- states['switch.smart_plug_1']
- states['switch.smart_plug_2']
- states['switch.smart_plug_5']
- states['switch.smart_plug_6']
- states['switch.smart_plug_7']
- states['switch.smart_plug_9']
entities:
- input_select.icona_smart_plug_1
- input_select.icona_smart_plug_2
- input_select.icona_smart_plug_5
- input_select.icona_smart_plug_6
- input_select.icona_smart_plug_7
- input_select.icona_smart_plug_9
- input_select.icona_smart_plug_room_1
- input_select.icona_smart_plug_room_2
- input_select.icona_smart_plug_room_5
- input_select.icona_smart_plug_room_6
- input_select.icona_smart_plug_room_7
- input_select.icona_smart_plug_room_9
- switch.smart_plug_1
- switch.smart_plug_2
- switch.smart_plug_5
- switch.smart_plug_6
- switch.smart_plug_7
- switch.smart_plug_9
element:
type: custom:button-card
show_name: false
show_state: false
show_label: true
size: 90%
entity: >-
${vars[6] === '18' ? vars[12].entity_id : vars[7]
==='18' ? vars[13].entity_id : vars[8] == '18' ?
vars[14].entity_id : vars[9] == '18' ?
vars[15].entity_id : vars[10] === '18' ?
vars[16].entity_id : vars[11] === '18' ?
vars[17].entity_id : 'none'}
card_mod:
style: >
@keyframes my-blink { from {opacity: 0;} to
{opacity: 100;}
from {opacity: 100;} to {opacity: 0;} }
@keyframes rotation{
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
tap_action:
action: toggle