Mqtt monitoring / syncing states, need bit of help

that's what I was occasionally experiencing with my first flow.
I hope that this new sophisticated one will not suffer from this behaviour.

Previous issue was kind of reproducable when wifi went off and one of the switches was turned ON while others remained OFF, after wifi regain it started rapid switching.

It's not very common and I tried to simulate it with these new flows and looks like it's working properly.

I was thinking to add some kind of delay into the reading, but then it can cause issue when network will be bit laggy or so and switches would be unsynced. Not really sure how to solve this, maybe some kind of internal delay+gatherer of the states and then continue to the function after 1s or so, what do you think?