Hi.
I’m trying to create a grid card that is auto populated with buttons.
Each button is a hue scene for a specific light.
The code works fine in Developer Tools → Template, but when I try to create a card, I’m getting the error:
Configuration errors detected:
missed comma between flow collection entries (4:2)
You can’t use templates like that. Templates can only be used in a single field. Also, the frontend typically does not accept templates.
Your best option is to use the template to generate your yaml, then paste the yaml into the page. You can also attempt to use lovelace_gen, however it does not have access to hass jinja. So functions like state_attr will not work.
Lastly, you could also use auto-entities, which should handle something similar to your current configuration but you have to change the yaml to work with the auto-entities format.
I appreciate that you are answering, but just saying that I’m wrong isn’t helpful at all.
It should be clear now that I’m out of my depth, but you seem to have a grasp on this. So why not come with an example instead of simply saying I’m wrong? Or better yet; the solution
Because you aren’t reading the example in the documentation. You’re just making things up. I already told you that you can’t template outside a field, yet you tried it again.
type: custom:auto-entities
card:
type: entities
filter:
template: |
{% for light in states.light %}
{% if light.state == "on" %}
{{ light.entity_id}},
{% endif %}
{% endfor %}
Thank you for this:
However it gives me the error “No filters specified”.
But then again, I’m not sure this would ever work, since it does not list the entity_id of the scenes, only the parent light.
But based on your input, I was actually able to make a card that lists what I want. It still needs some tweaking, and I need to figure out how to use different picture for the different buttons, but:
We still need to figure out how to use different pictures for different scenes somehow.
I have created pictures for different scenes and name them the same as the scene name
Maybe it is possible to strip the scene entity name so only the scene name remains.
Example: strip scene.kontor_hr_golden_pond so only golden_pond remains
That way we could create something like this
entity_picture: /local/hue-icons/hue-icon_{{stripped_entity_name]]_lyst.png
I also think it would be wise to remove the text from the picture and use a stripped show_name instead.
That way the icons could be used by others than me
I’m not sure where to put this discussion.
It it surely not a jinja2 discussion.
I have gotten som answers in the Auto-Entities discussions. Maybe I’ll continue the discussion there.
Although we are probably in the custom:button-card area now
Thanks again for helping out, I really appreciate it