How to simulate "not" (else) in advanced flows?

EDIT2: Well, I guess it just boils down to preference, then - and maybe I should rather go the scripting route? I, and it seems I’m pretty much alone in that position, miss something like AND/!AND or if/else - but that’s probably just the programmer in me.

Also, updating the logic for something like the image below will be a nightmare, cluttered as…well…yeah…you know and just a pain. In my not so humble opinion :wink:

— original —
I understand the arguments people have for why it’s not there. I understand the flow of things, but what I don’t understand is why there has to be a limitation :slight_smile:

Ok, so I have this using the “all” card, but…if not “all” are true, then I want to do something else. There are no “not” (invert) card, no “else” output on the “all” card.

Am I blind? Anyone found a solution (either tell me I’m blind and what I haven’t been able to spot or a solution would be great for me)?


EDIT: So, while it’s possible to do something like this, it’s just messy when one would expect to find another output from the all-card…Please note the “any” function won’t be synchronized with the “all” function, but rather fire as soon as any of these are false.

1 Like

Why can’t you use the ANY and the ALL card in the same flow?

It’s just not futureproof, and I think it’s bad engineering not offering this the way other logic does. For this example it’s not very complicating, but when adding more layers it will start to get really inconvenient and hard to follow and debug the logic.

It is technically really hard to implement such a thing, and keep it user friendly, as the ALL card doesn’t have a timeout, it will just wait until the flow is fully finished for all inputs to be active.
So to add such a thing the ALL card would have to have a timeout value, but what would such a value be? some flows can take several minutes to finish with the wait card.

@Tiwas, Can you Edit your message again and paste the image self? The link does not work.

And please past a example of the flow where you want to have that “NOT / Else” output on a ALL condition to follow, I guess it is pretty easy to make what you want. but I need to know the inputs.

Why a timeout? If the all-card doesn’t have a timeout, the not output shouldn’t either. That’s just the point - if you can wait for the all-card to become true, then why can’t you wait for it to be false? I’m guessing the flow cards have an uncertain state until they’ve executed…?..

Cause the flow isn’t finished if the flow would still have to activate everything behind the ALL card, so the ALL card will keep on waiting and thus never trigger the “not all”.

Ok, I managed to upload the image with another browser.

The problem here is that the “any” card will be true as soon as the first one of these are false. The “all” card will wait for all inputs. That’s a huge difference, even though the logic is the same.

1 Like

My point is that if the inputs are 0, 1, 1 and 0, the else output should become true. If the inputs are , 1, 1 and 0, the neither of them should be true. In my alternate solution, the any and all functions won’t be synchronized, and the any function could fire even if the all function later changes.

The logic should be:
Output 1: if allInputsSet() { and(inputs{}); }
Output 2: if allInputsSet() { not(output1); }

…or something like that.

So how do you expect the flow to continue behind the “Not ALL” card?
when the flow has to be fully finished to even trigger everything behind the “not ALL” card the flow has stopped/not running anymore, as that’s what it would be waiting for.

It is a chicken and egg issue, the flow will either never finish, cause it could be that everything behind the “not ALL” needs to be activated, or not trigger anything behind the not all card, like now is the case, because the flow has to be stopt running (what it is waiting for).
You can’t have a flow running, and finish running at the same time.

As soon as the first one is false and continues the Any Route, the ALL card will stop processing as that one can’t become true in anytime. So, this is the way to go!

I’m usure of what you’re saying. It’s not about the flow stopping or not stopping, it’s about being able to select different routes. If all inputs are true, go left. If one of the is false, go right.

The “ALL” card stays active/waiting until the flow has finished running, and thus nothing can/will happen anymore in said flow, that would also mean everything in the wanted “not all” line if it would actually come of off the “ALL” card won’t be run as the flow has already stopped running.

Flows and ALL cards are not binary logic, it are triggers like “A switch turned on” or anything that triggers.
The All waits until ALL incoming triggers are ready, the ANY continues ONLY ONCE on FIRST incoming trigger.
When there are no more triggers running in the flow it stops,
although fe 3 of 5 inputs of an ALL where ready, the other will never come then.

I’m thinking about a logic calc which value has to reach the n# of inputs. In fact a memory function.

Create numvar “myInputs” with value 0

Say we have 3 inputs
If 1 triggered
Then calculate var “myInputs” as {{[myInputs] + 1}}
If 2 triggered
Then calculate var “myInputs” as {{[myInputs] + 1}}
If 3 triggered
Then calculate var “myInputs” as {{[myInputs] + 1}}

If var [myInputs] has changed
And value equals 3
Then continue the rest of the flow
And then set logic var “myInputs” to 0

When one or more inputs don’t trigger, the rest of the flow doesn’t run.
And it can wait forever, while the numvar keeps its number until it is altered.

No it can’t wait, if one startin trigger starts the flow, it evaluates within seconds + in the executing lines delays. Then, when it is done, it stops. It can’t continue an ALL that has had not all inputs and inputs that didn’t trigger (fe where the ELSE was folowed) will never come in that same run again.

I’m thinking more in the lines:

If (allInputsSet() || isAnyInputNegative()) {
	if (allInputsSet()) {
		if (allInputsPositive()) {
		} else
	} else

So…the logic would continue as soon as either all inputs are set or at least one of the is false. If any are false, then the “other” output would be true and the conditions in that part of the flow could continue. If all are true, then the “main” flow could continue.

Yes. So adding a any logic to look for !X+!Y+!Z would not be the same as a negative output from the all logic.

There is no “logic” in Homey in that way,
an output of a card isn’t True or False,
An output of a Card Triggers and follows all connected lines to trigger one or more other cards,
These cards execute (Actions) and or evaluates (a condition) to follow thru a single output (Actions) or one of two outputs “True” and False (Conditions)

Only exceptions are ALL and ANY,
where ANY CARD just does nothing, (created by Athom because we in AATP used Delay 0 Seconds :wink: )
And ALL CARD just wants all inputs to be triggered (once in one RUN) before it triggers the output.

Any CARD in a Flow in one RUN can be triggered (execute) exactly ONE time maximum.

Something analogue to your !X+!Y+!Z should be connecting the ELSE (lower nipple) of all previous Conditions (and not the THEN (Upper Niple)) to the ALL.

1 Like

No, not really - because to execute something if one or more of the conditions fails and something else if all of them are true would require two separate functions - for each layer of logic. It would be better if you could choose between “all” and “not all” as outputs from the all function/logic. And I see what you say about the “all” function, but if that’s the case there should be an AND function just to evaluate output from logic comparisons.

In any case, I would say they are indeed true or false in the sense that you have two outputs from most cards - one if the condition is met and one if it’s not. That means the two outputs are either “true” or “not set” - which means the whole flow, in my view, is flawed from a programming point of view. The should then be a boolean output which could be true, false or not set.