I have used HA quite a bit and been burned. I think in the choice between graphical "no code" or "low code" and yaml, I choose yaml. But to do imperative logic there is just one useful way: a proper programming language.
This is just like when writing CI scripts for GitHub actions or Azure pipelines: the right amount of yaml (if it must be used at all) is to just invoke a program in some more expressive language than yaml.