Closed reidprichard closed 1 year ago
Have you tried this: ` variables:
What works for me: call variable by name:
`
or call it by index: `
Yeah, I tried that, and the quotes are auto-removed when I save the changes. It seems that pure text does not work as a variable.
This works:
type: custom:config-template-card
variables:
STATE: states['light.bedside_lamp'].state
entities:
- light.bedside_lamp
card:
type: entity
entity: light.bedside_lamp
name: ${STATE}
but this breaks everything, as the single quotes around the NAME value are removed when I click save:
type: custom:config-template-card
variables:
STATE: states['light.bedside_lamp'].state
NAME: 'light.bedside_lamp'
entities:
- light.bedside_lamp
card:
type: entity
entity: light.bedside_lamp
name: ${STATE}
Actually, I figured it out. Strangely it appears that text variables must be entered as a list, as shown below:
type: custom:config-template-card
variables:
STATE: states['light.bedside_lamp'].state
NAME:
- light.bedside_lamp
entities:
- ${NAME}
card:
type: entity
entity: ${NAME}
name: ${STATE}
Not sure if this is intended behavior, but I didn't see it in the docs.
Edit: Hmm, I'm also seeing weird behavior with templated entities. I'd like to use {{areaentities(Bedroom)}} to get all the entities in my room. However, when I click save, that template string is replaced with '[object Object]': null_.
Another working case is (I always use it) - using tripple '
:
- type: custom:config-template-card
variables:
- '''test'''
entities:
- sun.sun
card:
type: entity
entity: sun.sun
name: ${vars[0]}
Same with a named variable:
- type: custom:config-template-card
variables:
VAR: '''test'''
entities:
- sun.sun
card:
type: entity
entity: sun.sun
name: ${VAR}
This is a better way than using a list to represent ONE value...
I wonder why this issue is still open. It seems to be resolved.
Checklist:
Release with the issue: 1.3.6
Last working release (if known): n/a
Browser and Operating System:
Firefox 91.3.0esr, Edge 96.0.1054.43, Android app version 2021.10.0-full Windows 10 Enterprise 20H2, Oxygen OS 11.0.3.1.GM21AA
Description of problem:
Variables don't seem to be working at all. I've tried a very simple card: an Entity card where the config-template-card simply sets the name. No matter what I try, the card shows nothing at all. If I manually specify the name (so config-template card is nothing but a functionless wrapper around the Entity card), it works perfectly.
I've tried a few different syntaxes demonstrated in the documentation:
Doesn't work
Works
Javascript errors shown in the web inspector (if applicable):
Additional information: