Not going to believe this … but i think this error was caused by a single dot that was missing from the original script and then the revised automation
Old entry switch_master_bedroom_tv_b
New Entry switch.master_bedroom_tv_b
Will do some testing and see if that single character caused all these problems
Yes, now that I look at it more closely, I even have it listed in my own post because I just copy/pasted what you shared (without closely examining each entity).
switch_master_bedroom_tv_b is not a valid entity reference and will cause a problem.