Need help with a combination of 2 automations


I have 2 automations that i need to combine, the first one turns on a some lights when the sun is set. The second one is activated with a button helper to tell that i am going to bed and turns off some lights and device’s that need to go off.

Now sometimes i activate the second one and im going to bed before the sun is set, so when the sunsets it turns on the lights that where turned off when going to bed.

How can i make it so that the sunset automation wont trigger if the going to bed automation was triggerd in the last 2 hours?

With a condition, and a state from the(a) helper

How to help us help you - or How to ask a good question.