If I replace the entity in the template to a hardcoded one it works perfectly fine. (I did not try hardcoding the first entity in the button config though). Might be caused by lovelace_gen though I am not certain yet. I will play some more tonight when I get home and I’ll let you know the results.
Thanks for your great work (and thanks for the help).
ah ok, first problem is that you’re passing {{ entity }} to the entity field. Which means that the template won’t work because it doesn’t have an entity. It’s a chicken/egg scenario.
So how can I explain this better: the primary field that populates the ‘entity’ variable in templates is provided by the entity field. So you might have to supply 2 separate fields, the template (for all the other fields), and the entity_id.
Or, if you can explain more in full (I might have missed it) what your end goal is, I might be able to come up with a different solution. I’ve spent way too much time with lovelace_gen and these button cards its almost like second nature now.
Is it possible to (probably with a template?) set the friendly name of an entity as the name variable? And the label to the area in HA? Basically, I’m trying to find a way where I can use auto-entities card with button card and populate all lights from a specific room. The name should be the friendly name of the entity automatically and the label the area name where that entity is located within HA (eg Living Room). Can this be done with button card?
You are right, I see that now. If I create a light group within configuration.yaml (already have those anyway to control all lights per room). Then it should be possible to use the name of that group light (which is a single entity) as the label automatically with a template right?
Maybe its easier to create separate templates for button cards for each room and then just set the label hardcoded in each template for every room. I think that works with auto-entities as well.
As far as I know, there is no way to retrieve that from the frontend without doing api calls (Doesn’t seem to be provided though the websocket API, but I might be wrong). So unfortunately, I don’t think it’s possible for now.
That’s too bad, thanks for confirming this! I think I’ll just create separate templates for each room and set the label there per room. After the one time setup, all will be automatically either way.
Hi, I have a different question. I tried different variables, but I think I’m not having the correct code to begin with. Basically, I want to add a horizontal-stack (containing button cards) as a custom_field. That part works. However, I’m having issues with the styling. I can’t seem to position the custom_field (called it day) whatever I try as options.
I have tried different stuff, like position: absolute but I just can’t seem to change the location of the custom_field. Basically I want that to be at the top center (above the icon). Do you see anything missing from my code?
The letters in the middle is the custom_field (containing a horizontal-stack with 7 button-cards). And you see the icon, name and label there as well under eachother.
Thanks! That does work, however it is too much at the top. As I make my windows smaller, the card goes more to the top. On mobile it’s hard to read because it’s going out of bounds almost because of border radius on my cards. Can I set some kind of padding to the custom_fields so it’s a little more down?