Virtual Switch with delay on turn off

Dear community,

I am completely new to Home Assistant and only use it as a simple hue bridge for controlling my tplink switches with my logitech harmony hub. My entertainment system draws its power from a socket that is controlled by a switch. When I hit the Watch TV action on my harmony, the switch is turned on and then TV etc starts. So far so good. However the harmony hub doesn’t support a delay for home automation, so when I hit “off” the power is instantly turned off so that the TV can’t be shut down properly.

Is there an option to define a virtual switch which turn ons instantly but has a delay of a certain seconds when its told to turn off? If yes, how can I easily implement such a thing?

Thanks in advance!

John