Best way to restore brightness at end of script

I have an automation set up to bring my exterior lights on dim at sunset. I would like to add an automation that brings the lights up for five minutes when the door is opened and then returns the light to its previous brightness at the end of the script.

It doesn’t look like this can be done directly from a script (there appears to be no way to remember the previous brightness). I’m trying to decide if I should use a command line script or register a python service. Are there tradeoffs here?

Scenes would be a good place to start with this - use a scene at sunset then you could call it again at the end of the 5 minute period. If you really wanted it to restore the exact state, this would be easy to do using AppDaemon.

I took the appDaemon approach. I love being able to do automation with python :). Thanks!

1 Like