I have just two light I want to work together.
To track whether a light is on or off, I need flow for each state each light is in, that will assign a variable. Indicating the light state. I'm tracking the state of a light with 4 values.
0 = off
1 = on
-1 = wifi off
2 = wifi on
So the flow is I turn on the power switch at the top of the stairs. The a trigger sets the light to state 2. At that point I set the other light state to on. Once and then I set the triggered light to on. When each light is set to on, the triggers for the on state are thrown, so in this simple scenario that is just 3 triggers...
Only, there is an indeterminate amount of time between when the light is connected to wifi and when it will accept the connection. So I need to repeat in a loop with a five second delay. On average, this is just long enough for me to reach the bottom of the stairs. My 3 triggers is now 9 triggers. But I, I find the ITFFF bridge is flaky. If I want 95% reliability I need to call it 3 times. So I'm now up to 27 triggers. I also need to use a similar procedure to turn the lights off. That is 54 triggers. That means if I go up and down the stairs more than 9 times a day, the lights stop working...
And that is just controlling two lights. Imagine what would happen if I tried to connect my whole house.
I actually have to do a bit of logic to determine if the light is connected or wifi or not. I wanted just to send the raw data to stringify, so it could use that data along with known light states. But that works out to 17280 triggers per day... Yuck. I can't even reliably just control the lights when I'm doing the processing on my own server using Stringify and ITFFF, let alone something more sophisticated.
I ended up going back to my pure ITFFF solution. Which is I do not try and keep track of the state of the lights, I just toggle them on and off with the wifi on and off. It is faster and simpler. But, it means I can't control the lights with Alexa, because my server will just come along with 15 seconds and toggle the light back to the state it think's they should be in.
I'm wondering if SmartThings might be a more appropriate solution for automation. Presumably if it is my own hub, it shouldn't throttle my number of triggers...