Switch Rest loop scenario

Hi I’m using a rest switch to determine status of sky q. Then want to also hook automation to that switch when from off to on then turn on skyq, when from on to off turn off skyq.
turn on and off is same signal :power
On it own works fine however when manually turning on skyq, switch get updated to onn sending power signal, that will turn off and then switch get updated to off and we got a loop.
is there a way to resolve it? Only way I can think of is a script that will do another rest call to assess before sending signal.
Unless I can use rest in condition (some templates?)