Trigger different script with push and hold

I am trying to trigger a different automation for on and off state.

I have a button which I use, Push and hold to turn on, Push and hold to turn off. What i’m trying to achieve is to turn on two devices with a single button, so I am using a script to achieve this. I have a script fot turning on 2 devices and a script for turning off 2 devices.

How can I trigger the TURN ON script when the button is in the off position and is held down, Then tirgger the TURN OFF script when the button is already on and held down again to turn off.

Thanks

I created an automation that just follows the state of the other device.

eg, automation trigger when harmonyhub.xxxx change to ON

activate remote.androidtv ON

The same applies for off, then using my switch I just switch the harmony activity, which then switches both.

I then used ADB to call the application I wanted in the same automation to launch the freeview app for TV. am start nz.co.dishtv.FreeviewLiveTV