Use python_script to create a dashboard

Hello, I have managed to create a py file that is used by python_script to output the yaml code for my dashboard

I input some labels and other stuff via jinja templates and this python file creates the dashboard definition in the output object.

I can see this output while using devtools.

Is there anything I could do to get this into the dashboard definition directly

Hi, welcome to the forum!

Sorry, I can’t answer your question.

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.