Do x for y minutes then return to previous state

I find myself often wanting to blast the ac for 20 mins when I get home from exercising or something else like stepping outside in the NC summer humidity.

I don’t really know where to start with automating this idea but I want a button that puts the AC onto the coldest setting possible for 20 mins and then returns to whatever it was set to before I hit the “chill out” button.

Ideally it’s going to be a dynamic automation that can take a variable length of time into consideration via a parameter from each button or a slider or a bot (@hassbot ac20 for example).

Help please!

Write a script that stores your current AC state (see: https://www.home-assistant.io/integrations/scene/#creating-scenes-on-the-fly )

Then sets the AC cool values you want.

Then delays for the amount of time set in an input number. (last example here Script Syntax - Home Assistant )

Then restores the previously saved scene.

Assign this script to the tap action of a Lovelace button.