-
I’m poking around at my next round of work in HA and trying to figure out the right toolset to work with before getting started. One aspect I’m looking for is more programmatic control of my dashboards. With pyscript it seems like I can access the file system, so I can always parse the json and just write it back, but I’m wondering if there’s a more elegant way so I can offload more of the work to hass. Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
In my case, I don't need to read the Lovelace YAML, I just output it based on logic in pyscript and my pyscript config. However, if I had to read it, the YAML tools available in python are excellent and easy to use, so, even if there was a way to offload it to HASS, there's no real advantage to doing so that I can see. |
Beta Was this translation helpful? Give feedback.
-
Just writing this in here in case it helps someone else. If you want to programmatically work with dashbaords WITHOUT switching lovelace to yaml mode (which will deactivate all gui controls for dashboard) you can call HA's websocket api like so. There are update commands similar that you can sort out (awkwardly) by reading through the lovelace api code
|
Beta Was this translation helpful? Give feedback.
In my case, I don't need to read the Lovelace YAML, I just output it based on logic in pyscript and my pyscript config. However, if I had to read it, the YAML tools available in python are excellent and easy to use, so, even if there was a way to offload it to HASS, there's no real advantage to doing so that I can see.