Editing complex automations in UI gets slow and messy quickly

I am now unable to edit all but the most simple automations in the UI. Opening embedded if-then and choice actions seems to be the thing that makes my UI freeze up, but it also has a problem on embedded not, and, or conditions.

I’m using a proxmox server on a HP elitedesk with an i7 processor and 16gb of ram running off a 500gb SSD drive. The attached screenshot is from the companion app. I will upload examples from a separate and fully juiced up pc running chrome which should demonstrate that the problem is not due to my hardware.

If anyone has encountered this problem and found a solution, I would really appreciate some guidance.

This has nothing to do with your server specs and is all about your display size. It could also be something to do with your custom theme.

Try using the default theme.

Or try using a desktop PC.

Or learn YAML config. Well-structured YAML code is much easier to read than a bunch of collapsing boxes.

2 Likes

And this is a good tip…
Why and how to avoid device_ids in automations and scripts.

I am experiencing the same hangs and expansion errors on my PC. I am using the default theme

I don’t use device triggers in any of my automations

Or use Node Red

I use VSCode, it goes just fine. syncs with GitHub. Checks my syntax. Life is good. And I have A LOT of yaml… (24, 532 lines of live, lots more that’s parked and not counted)

And that’s 1 of 3 HA instances…

I wonder how you count number of lines?
Cannot say that number of lines (and number of packages) is a useful info - just interesting.
(using packages myself)

it’s in there…
None of it’s useful, just use it for this kind of thing.

I reconsidered my pov. It IS useful and shows growing your project.
Will check your code, thanks a LOT.

Found it:

command: 'find . -name "*.yaml" -not -path "*/custom_components/*" -not -path "*/Purgatory/*" | xargs wc -l | grep "total" | grep "[0-9]*" -o'
1 Like

@Sir_Goodenough
Mind sharing where this screenshot comes from? I also use VS Code Studio and would love to see this info for my system. I too, have a ton of YAML code, with over 300 automation and scripts (600+ total). Thanks!!

This could be achieved by auto-entities with using a “template” option (or even with a simple “include” option with “entity” filter) to show an Entity card inside a Grid card for some defined set of sensors (here - sensors containing number of smth).

Auto entities won’t count lines of code. I understand that I could do it like that, but I am really interested in how he counted the lines of code. I assumed it was some sort of VS Code add in. Hopefully he can elaborate.

If you asked about lines of code - that was exactly my question and I posted an answer , scroll up a bit.

Look for yaml files , ignore dead paths that you don’t want to count, count the lines…
I didn’t come up with it, but it’s there.

1 Like

I have the same issue with the Automations UI editor being completely unusable. With 101 lines (including empty ones) of Yaml (turning on/off 5 lights to specific states based on time and sun elevation), the opening of the Automation Editor UI takes about 1 second, but every subsequent UI operation takes a lot longer. Opening the menu for Yaml editor takes 5-10 seconds, as well as opening any of the condition/operation expanders.

I ran profiler on opening the editor and expanding two conditions. Most of the time is spent doing QuickSort and positioning items.

Browser used is MS Edge Version 131.0.2903.51 (Official build) (64-bit)
HA

  • Core 2024.11.2
  • Supervisor 2024.11.2
  • Operating System 13.2
  • Käyttöliittymä 20241106.2

Browser resolution does affect a bit. In a smaller window, about 1080p equivalent the initial render was faster, but did not improve overall as a UX.

Almost full-screen 4K:

The tab takes about 1 CPU core and memory consumption keeps increasing steadily with no network traffic. It becomes completely unresponsive in about 1 minute.

As a result you basically cannot open any menu in editor or even exit reliably, as the left-arrow and save-button do not seem to react for several, even tens of seconds.

2 Likes

I’m running into the same issue. I have an automation with over 2,000 lines of YAML, and it’s basically uneditable in the visual editor. The problem is browser-independent (chrome, firefox, edge) and OS-independent (different windows PCs and macOS).

I’d really prefer not to edit entirely in YAML or learn Node-RED. The collapsing / expanding boxes of the visual editor allow me to navigate large blocks of code efficiently. Does anyone know what’s causing this and what potential solutions might be?

If you think you have an automation that is especially bad:

  • Try to simplify as much as possible so that someone could reproduce it (doesn’t require 100 entities, doesn’t rely on service calls to obscure components, etc).
  • If it still is bad after as much simplification as possible, file a frontend github issue and attach the complete automation that someone else could try to reproduce.

I wonder if any automation should ever become so large.

The action sections can usually become reusable scripts that take parameters.

Complex triggers can be delegated to firing events that trigger your automation.

Judicial use of labels can help reduce complexity for instance to target ceiling, primary or ambient lights in a room

Complex jinja can be delegated to custom template macros.

For instance, light level based on time of day can be implemented in a template sensor.

Of course this approach may not work for everyone, but I prefer small concise modular components that are reusable and more easily updated and unit tested when HA Updates the way things work

1 Like