Whats the best site you recommend for trying to learn better YAML code / more complex actions?
One of the reasons why I have issues with YAML, and why I didn’t become a coder, is the spacing and the inability to figure out why something isn’t working when its in code…
If you use the automation editor, automations are reloaded when you click ‘save’. If creating automations directly in .yaml, you need to reload automations.
That was all done with the mouse, except the switch name that I had to copy paste since that entity isn’t mine, and the ID ‘on’ and ‘off’ in the time triggers.
I actually copied yours into the GUI just to see how it formatted it.
Once i figured that out, went back into the yaml and edited my original. I think it’ll work now, I"ll let you know when the fan kicks on tonight.
Thanks for your help. as @tom_l mentioned, I’ve since started using the Visual Studio editor with the rainbow tabs and that really helps me visualize the code better…
Just to point out, the automation can be further simplified by simply adding an id to the other trigger too. If the one that turns the fan on has the id ‘on’ and the one to turn the fan off has the id ‘off’ then you can use:
service: switch.turn_{{ trigger.id }}
And then you don’t need to do any of the if stuff.