I had some issues with my “how many family members are home” (advanced) flow.
Many times it somehow miscounted although I was quite sure I had done everything to avoid miscounts.
I have a single advanced flow that has multiple triggers points.
Example:
Person X goes away => subtract 1 from numberOfResidentsAtHome
If numberOfResidentsAtHome changed => subtract 1 from numberOfPeopleAthome
Where it seemed to go wrong was when two people left the house at the same time, then it seemed to miscount (or don’t trigger twice)
I then focused on how and when my variables are set/changed and found the following.
Here the variable TestLogicVar is set twice (at least that is what I think should happen). I would expect it to then also create two separate triggers.
When I change the wait time between one and the other set, it works fine.
Thanks Wim, though no, this is exactly what I’m trying to do.
I’m trying to show that if you change a (the same) variable twice in a timeframe that’s very close, it doesn’t trigger twice.
If you add a delay of 1 second it does trigger twice.
To me that’s not correct. It should trigger twice as you make 2 changes.
This is the code that started my problem search… I now added 3 delays, all 1 second apart.
Without the delay and if two people left at the same time and somehow both triggered this flow at the same time (?) it only triggered once at time.
Did you only simulate the flow, or does the problem also occur in real life?
Because my wife and I often left the house together and go away together in the same car. Since 2019 it has never happened that the status “Has gone” was set at the exactly same time.
Thanks Peter, you showed it works like that.
Partially I agree that having those two set commands are in parallel and suppose to happen at the same time, but still I think of them being two separate actions. Apparently not, so I’ll adjust my flow to make them happen in sequence.
I had it in real life.
We are at home with 3, at time my “PeopleHome” counter was -1 other times it was 4.
So either fired double or not as many times as I would expect.
With a forced wait that is different for each event it seems to solidly stay within the zero to 3 range.