Need Help with an automation

Hi guys… Please… I need some help with an automation…
A have a sonoff zigbee (zigbee2mqtt) mini connected physicly to a switch on the second floor.
On the first floor I have a 3 gang tasmota switch and I wish to make one of those gangs to trigger the sonoff zbmini upstairs. As this 3 gang switch has a led state, i wish to that state represents the current state of the light connceted the zbmini…
Both of them are configured on HA as light entities.
I tried to create a light group and created two automations:
1: Trigger by both 1st gang off tasmota and by the zbmini on to turn on the light grooup.
2: Trigger by both 1st gang off tasmota and by the zbmini off to turn off the light grooup.

First tests was ok… but when one of the switchs are triggered on and off quickly, the automations enter on a loop state, trggering on and off many times per second…

Probably there is a simpler way to make the magic but i`m very confused on how to achieve that!

Please, can anybody help me?
Thanks!!