Is there a way to remember a light's state

An example: When someone opens my front door or triggers the motion sensor on my front porch, I brighten the porch and foyer lights. After a bit, I’d like to return them to whatever state and brightness they were (off, on but dimmed to 50%, etc.)

Is there a way to store that info to refer to it later?

This could probably be accomplished using a template sensor to store the old state value, but I’m not really sure on what condition you’d update it.

For example:

Light A is on and is set to 50%.
You get home so it triggers an automation where it saves the current value of Light A to the template sensor, then turns the lights to 100%.
After 15 mins, another automation sets the lights to the current value of the template sensor.

Because you want to account for other factors, like brightness and color temperature in addition to on/off, you’d either need to have separate sensors or have those values as attributes for the template sensor.

1 Like

I started trying to work this out, but then found this post that said that sensors are read-only. So I’m not sure how this would work. If the “storage” sensor uses the state of the lamp as it’s value, it’ll change whenever the lamp changes. So I can’t really use it for storage.

I had been thinking that I’d create a dummy sensor, then change its value from automations.

I know someone (can’t remember who :() was already working on this together with @balloob .
I have no idea about the status but hopefully it will be in a new version soon.
I think you shouldn’t put too much time in it because a solution will probably be there soon anyway.

Thanks. It did occur to me today that I could probably save the on/off in an input_boolean and the brightness in an input_slider. But I’ll put that on the back burner for now and see if something better manifests.

Here’s what I eventually put together to address my need. I use a single input_slider to remember the state of a light. Zero = off, otherwise it’s a brightness level.