Closed SeLLeRoNe closed 4 years ago
I think the problem is here:
temperature:
card:
type: custom:config-template-card
entities:
- [[entity]] # <<<<----
You're missing quotes.
temperature:
card:
type: custom:config-template-card
entities:
- '[[entity]]'
No, that's the entity definition and it is working fine, the problem is here:
variables:
- states['sensor.[[entity]]'].state
That part generates a vars[0] that I then use here:
icon: "${vars[0] > 30 ? 'fas:thermometer-full' : vars[0] > 25 ? 'fas:thermometer-three-quarters' : vars[0] > 20 ? 'fas:thermometer-half' : vars[0] > 10 ? 'fas:thermometer-quarter' : 'fas:thermometer-empty' }"
Surely there is something wrong with the "[" and "]", I tried using "(" and ")" but doesn't help
states['sensor.[[entity]]'].state
Still, what I pointed out is valid.
This - [[xxx]]
without the quotes means, in yaml:
-
-
- xxx
I'm going to check the other part.
Yes I know but that part it is actually working because even if I set an entity there without quotes works ;)
How do you instantiate the card? Can I see the config please?
Sure, here it is:
- type: custom:decluttering-card
template: temperature
variables:
- entity: sensor.studio_andrea_temperature
Well the problem is that:
states['sensor.[[entity]]'].state
results in states['sensor.sensor.stufio_andrea_temperature'].state
Note the double sensor.sensor
Oh wow.. and I am sure I did test that....
Thanks for spotting it!
I am trying to use this card to cleanup my code, but I am facing an issue with the "variables" configuration inside the config-template-card
This is my code:
The problem seems to be caused by this:
The decluttering card doesn't seems to replace the [[entity]] because wrapped around other []
The error I receive in the console is:
Please note, if I use actual entities values instead of [[entity]] (ex. sensor.living_room_temperature) it does work as expected.
Thanks