Need Help with Automation And/If

I have my lighting set on a schedule. My living room lights are on 100% during the day, and at 7:00 pm, they go to 50%, and at 8:00 pm they go to 15%.

A couple of scenarios:

  1. I sit down to watch a TV show at 6:00 pm and select the 15% dimmer automation for the room lights. Unfortunately, at 7:00 pm, the lights come up to 50%, and I need to manually select the 15% lighting automation to cancel it out.

  2. I sit down to watch a movie at 6:00 pm and select an automation that turns the lights off in the living room. At 7:00 pm, they come up to 50% and I need to manually select lights off. Then again at 8:00 pm, the lights come up to 15% and again, I need to manually select lights off.

How can I set up an automation that recognizes the states that the lights are in as an And/If to bypass the 7:00 pm and 8:00 pm scenes, keeping the lights in the state I left them for viewing? I don’t know the proper condition to select for this, and I don’t know how to script.

Thanks ahead!

You might want to add a condition that checks on the brightness attribute of the lights, so that they are only set to 50% if they actually are set to above 50% and the automation is not executed if that condition is not fulfilled.

I’m using a condition like this - in my case it checks for below rather than aboe:

  - condition: numeric_state
    entity_id: cover.shutter_office
    attribute: current_position
    below: 70

Should be reasonably easy to translate for your use case.

This looks like it might work. I’ll try it and respond back! Thanks!