My goal is to create my own standardized dashboard for a room and I want to parametrize it on the room name.
So ideally something like this
set a variable in the beginning called ‘room-name-fragment’
then the rest of the dashboard will have a bunch of templates for various sensors that will be constructed using the room-name-fragment to e.g. have light toggling, light scenes, humidty and temperature displays, etc etc. All my sensors and lights are named in a standard pattern so this would work great.
This would be incredibly useful to avoid duplication and to also allow me to quickly make a single change that will ‘ripple’ through all the rooms. Eg if I decide to set up my mini graph cards in a specific way and change a few parameters now I need to udpate 7 more cards. Ideally I should make a single change and it will all propagate through the rest.
Basically I kind of need a dashboard template in HA terms I guess.
It is somewhat possible, but I am not sure it is worth it.
You can make a card where you can select the room name and then store it in a helper variable and then refresh the page.
The page can then read the variable and use that for the cards, but there are things to be aware of.
First the variable will be global, so if one user looks at a page and another use change the variable, then the view will change for user one too.
a solution could be to have a different view for each user, but if a user might use multiple devices simultaneously, then each of these devices will then have to have a separate user.
Secondly you can autogenerate the values in a card, but not the entire card, which means you will have to the same number of entities in the room or make some cards with conditional cards that take this into account. It is possible, but it will be hard and probably end up in a nightmare administrative mess.
There is a solution extra, but it is only for really advanced user.
That solution is the Lovelace_gen integration, but this integration requires that all dashboards will have to be made directly in YAML.
state-switch shows a particiular card (set of cards) based on that helper. Each card - decluttering template with a “ROOM” variable. Related entities are composed based on this variable.
OR
same
A card (set of cards) placed inside config-template-card; a variable “state of that helper” is used to compose a room’s name (as well as names for related entities).
Frankly speaking, I have not read your post, just listed SOME possible variants.
Other alternatives are auto-entities with swipe and probably lovelace_gen (which you mentioned but I never tried).
this in fact what you can do with decluttering templates and even build on that using auto-entities. Unless you go hugely complex, I suggest to have a look at that card.
Just to revisit an old topic.
The thing I had in mind is exactly
I’m going to slowly replace a ton of duplication with it. I wish the native dashboard in HA supported this as it’s quite a natural thing to want once you start building out your rooms (you tend to follow the same pattern).
I’ve also started using auto-entities for a slightly different use case but they are absolutely incredible and should 100% be folded into the native HA core cards.
The folding card is super interesting and I’ll look into it as well but for now I do not need it.