Sorry if this is covered somewhere but I haven’t found a working solution. I have used declutter cards with great affect but using stack-in cards and entity cards I am making different pages for individual bulb management.
I have tidied the switches up using the following code:
The issue is I have to repeat the style section for every switch and I wanted to be able to apply it with an anchor or other to save on 100s lines of code. Everytime I try and build an anchor and save, HA seems to replace the anchor with the target, If I can get it work at all, as most the time it just removes the &… Additionally I have to make 10 different cards with varying numbers of entities, which rules out the benefit of declutter cards. I was hoping for something like this:
This happens in a storage mode of a dashboard since a content is converted from yaml to json and vice versa. Anchors should only be used in yaml mode.
If you prefer the storage mode - then you should put reusable card-mod code into decluttering cards (if possible).
There is no “switch”.
Dashboards in yaml-mode are initially written in yaml.
Ofc you can migrate a storage-mode-dashboard to a yaml-mode one, this a a manual operation (create yaml files, copy-paste a content from “raw yaml config” of a dashboarfd, etc). There are other threads about yaml-based dashboards, and there are docs (cannot give a link though).
FYI you’re also delcaring the anchor wrong. So if you do switch to yaml mode, the declaration needs to be before you use it. Secondly, you need to declare it the first place you use it.
Understood, but sometimes it is more convenient to move reusable parts to a separate place of a file - as I said some parts may be commented / excluded etc…
If you are comfortably with YAML mode, then you should look into Lovelace_gen also.
It can do some wild things that will make situations like this much easier.
This happens in a storage mode of a dashboard since a content is converted from yaml to json and vice versa.
I have managed to make the suggestions work by editing the raw config file. I have saved it and all is good, when I look through gui side it replaces it with the target but the raw config still has the anchors.
Does the yaml to json conversion happen for the gui side of things and this works or is what I am doing pointless unless it is done in yaml mode?