If you mean can I create an equivalent solution as a YAML automation, with an appropriate template, the answer is no. Maybe it’s possible but, over the 11 months I’ve been hanging around this forum, I’ve never seen it done.
The issue is you can’t iterate (loop) in a YAML automation. It lets you define a sequence of steps, where each step can be tweaked with a template, but you can’t loop through those steps.
I thought i would just pop in here… I have 200 lines of code for turning on my 19 lights of IKEA… Turn on … delay… turn on… delay and it works brilliant.
Even though the automation is long, it is still very easy to see exactly what it does
I have similar automations that I could combine at the expense of mere mortal (me) understanding, but this is not the way to go for maintainability.
Anecdotally, there’s bugger all gain to be made other than the satisfaction of solving the puzzle. The hardware we run HA on is more than capable of a few inefficiencies, even if configuration length equated to efficiency (I’m guessing it does not, much).
It’s your home automation system. Write it so you can understand it and maintain it.
I’ll be the first to admit that out of necessity I have been guilty of using provided configuration I do not fully understand. But it’s rare.
The worst thing about 5500+ lines of automations is… bugger all. Ctrl+F in most editors will get you there.
I think ‘most’ of us here suffer from it (to a greater or lesser degree or we wouldn’t be obsessing about when it’s appropriate to “turn a light off”). A good coder is hard to find. They need the right level of OCD, but not tooooo much as some of them have to turn the light off 23 times before they leave a room.
"BUT testing is a valuable use of time !!! " ; - ))))))))))))))))
Cheers
True, if your clients dont need Alibi’s, you’ll get a bonus if that’s the case. i.e. you can’t let your ego get in the way and cause extra complications even if they are semi-intoxicated e.g. “on exiting one pub we engaged in a physical difference of opinion versus another pub”
English is a bastardisation of other languages, that’s why it’s so flexible.
I had a friend who was thinking of buying a fortiori (though he decided it was a foible excuse) he bought a lamborghini instead. (french fencing derivation from the same root).
and as for ejusdom generis, I think you can get pills for that ! or is that too generic ?
Seriously - I had to look up those words