this post was submitted on 19 Feb 2026
51 points (98.1% liked)
homeassistant
18474 readers
112 users here now
Home Assistant is open source home automation that puts local control and privacy first.
Powered by a worldwide community of tinkerers and DIY enthusiasts.
Home Assistant can be self-installed on ProxMox, Raspberry Pi, or even purchased pre-installed: Home Assistant: Installation
Discussion of Home-Assistant adjacent topics is absolutely fine, within reason.
If you're not sure, DM @GreatAlbatross@feddit.uk
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Scripts are used for a lot of things! Generally any time I want to do the same thing under multiple automations, I use a script as the middleman.
For example, I built a script for turning off all of my lights each night but it has to be fed a time scaling variable to determine specifically how quickly to turn them off (sometimes I want them turned off quickly vs slowly). Automations trigger said script with the right scale factor.
I have air purifiers that I ramp up and down conditionally, they don't have a built in ramping function so I built a script to ramp them to a target % in their allowed 10% increments, over a variable time period. This can be then be called in one line from any automation or script.
When I'm turning off lights each night, I want them to ramp down to a specific level/color/temperature before turning off but only if they are currently on. Rather than build an if statement for every light, a script takes a input list of lights and runs through each one to determine whether or not to ramp.
Finally, my Google Home device is able to call scripts directly, ("hey Google, activate Cozy Time" triggers the "Cozy Time" script) so some things I use Google Assistant to trigger use scripts directly since that was at least easier at the time than using an automation. If I automate the same thing (e.g., a "Cozy Time" button above), I can just call the script from the automation in one line, easy peasy.
Thank you, that's food for thought at least.
Can I ask about your light script? I have a bunch of smart bulbs that either don't support or don't expose the 'power-on behaviour' option, so in a power cut they come on full bright when power is restored, often in the middle of the night.
My HA is on a UPS so I've been trying to have it store the states of lights when the UPS switches to battery power (before they go to unavailable) and then restore those states when power comes back, but it's apparently way beyond my skill set. Curious as to how your "input list of lights" works and whether it could help me...