Create Scripts in Home Assistant
A script is a sequence of actions that takes place when the script is activated. When turned on, they run through their sequence of actions, then turn themselves off.
Create a Script
- Navigate to the Script Editor.
- Configuration -> Scripts
- Click +Add Script on the bottom right-hand corner of the screen.
- Give your script a name.
- Add an icon. Icons can be found https://materialdesignicons.com/ and https://mdi.bessarabov.com/.
- Add actions. You can add as many as you want.
- This example will turn off two devices, and each device/entity and action is added separately.
- Remember to save your changes!
Execute Your Script
- You can test your new script from the Script Editor window by pressing the play button.
- If it doesn’t work the way you want it to you can always make changes.
Add Scripts to the Lovelace UI
- Open the Edit Dashboard settings, in the top right-hand corner of the screen.
- Click the +Add Card in the bottom right-hand corner to add a new card.
- Scripts work well in Entities cards when you’re getting used to how things work.
- Title the card, add your script, and save your changes.
- After you save your changes, you will see your new Scripts card.
- Exit the editing mode when you are finished making changes.
Conclusion
Scripts are easy to build and add a lot of functionality to your smart home.