I’m very curious though what the use case is for this since creating a dashboard is something you don’t do that often and most likely there are (a lot) modifications done over time which you would mean you also have to maintain your script as well.
If you can write in Javascript instead of python you can implement a dashboard strategy, that would allow you to create a dynamically generated dashboard in code.
But I’m not aware of any way you can make this work in python.
I agree, that you will not change that often, once it is done properly. Currently I am migrating to HA and therefore do lots of stuff step by step. Also having >800 entities to deal with.
Therefore I did a python_script to build my views based on code that uses labels, areas etc. of the entities.
Currently I am running the script like 5 times a day while making changes to entities ….
So I will stick with that process for now, as I do not what to use js to dynamically create views while opening.