Creating a toggle switch for on and off scripts

I used to be the laziest when it came to controlling my bedroom fan. I just had on/off buttons in the Home Assistant dashboard. Sounds fine, but it got messy real quick, especially when I tried to use it from different places. A real headache!

The answer? A toggle switch! Yeah, I know, not the fanciest thing, but it’s a game-changer. Now, I’ve got this handy toggle switch that does the fan magic for me. No more fumbling with buttons, no more confusion. I know many people have read about it in the community, but the solutions are just all over the place, and it’s hard to find a quick and short guide on how to do it - so I’ve spilled the beans on how I did, basically:

Step 1: Create custom scripts to control your devices.

Step 2: Set up a toggle switch helper for a more intuitive user interface.

Step 3: Craft an automation that responds to the toggle switch’s state changes.

You can get the YAML configurations and read about it in my latest blog post - Creating a Smart Home Toggle Switch for Home Assistant.


1 Like

thanks super helpful

Yes, Thanks for this.
After some playing around though, you don’t need to create the scripts. You can do the service call directly in the automation configuration.