# Wishing AND cards could be used as IF cards in flows

Sometimes I can find the perfect AND and THEN flow cards for my use case, but there doesn’t seem to be a fitting trigger/IF card.

For example: I want my curtains to open earlier in the morning if it’s sunny and the temperature in my room is below 20, and not if it’s above 20. That should be easy enough. I can create the AND cards for my lux sensor and the thermometer, but then I struggle to find the trigger card. I can have a “the time is between … and …” as an AND card, but not as a trigger (IF) card. Both logic cards for lux and temp are also only AND cards; there is no “the temperature is greater than” IF card. I tried to have it run every day by selecting the IF card “every 1 day” and AND “time is between … and …” but that doesn’t seem to work.

There’s more examples like this. There are IF cards for when a device is turned on, but not for when it IS on or off. For when someone wakes up or goes to sleep, but not for when someone IS either awake or asleep. Now often it’s possible to just program the flow differently; have a different IF card and then use the AND cards for more possibilities. But not always.

Would there be a way around this? Am I missing possibilities?

An IF card can only work when something changes as they are event driven. If the information is static then the only way an if card could detect it is if all the flows were constantly polled, and that would be processor intensive.
So in your first example, you would use an IF card form the lux becomes greater than.
E.g. you need to think about what changes to start the flow.

Edit: if there is no ‘becomes grater than’ card for the device then use the ‘has changed’ card.

Ah. I thought it must be deliberate, as any loophole I could think of just didn’t work. I was looking for an IF=always true in a way (if that makes sense) but I get the processing issues that might cause. So the only way I could think of in this example to make it work, is to program flow after flow between the times of say… 0630 and 0900 to have one start every five minutes. So one flow starting at 0630, one at 0635, etc. I wish there was a way to automate that and create a loop in a flow to do exactly this, but apparently there isn’t?

And to be honest, I don’t think I understand how the “has changed” card works. The reason I haven’t used it yet, is that I thought it meant the sensors would be constantly polled to check if a value has changed. So I thought that would cause the precise processing problem we’re discussing here, and was afraid it would drain the batteries. That’s probably not true, but what exactly does it do? And if I would use the “has changed” card, how would I use it in this particular case?

(Also: wow, you are fast. Thanks for the help, man!)

Homey doesn’t poll`***`. A sensor only sends a changed value on its own. And to prevent trigger flooding or battery drain, f.i. motion sensors often have a “blind time” of 1 minute

`***)` Afaik only Hue sensors are being polled for status changes, but that is a continuous process, flow independent.

.

The flow I would use would be something like this:
(Note: values are just some examples)

When…
Lux sensor A brightness has changed
And…
(Logics card) [[Brightness]] value is greater than 90
And…
(Logics card) [[Brightness]] value is less than 100
And…
The time is between X and Y
And…
(Logics card) [[Temperature]] is less than 20
Then…
Open curtains

Note:

• I prefer to use a range, otherwise the flow would run at every lux change above 90
• [[Temperature]] is the tag/variable of your selected temperature sensor;
[[Brightness]] is the tag/variable of your selected Lux sensor.
You can find them by pressing the tag icon*

Logics explained:

Ah, thanks! I have the dashboard open on my laptop now, which makes it much clearer and noob-friendly. In the app, there is the “if a variable has changed”, which I never selected because I thought it meant that if any variable had changed, while I was looking for a specific variable. On the PC dashboard, it’s much clearer that you have to select which variable you are looking for. (Should’ve just tried it of course, in retrospect )

Thanks for the tip to input a range, as well. I haven’t tried it yet because I’m a bit pressed for time this week (hence the late reply) but you did help me understand Homey a bit better, so that’s always a good thing