Waiting for a condition to become true, new flow needed?

Post your questions and help other users.

Moderator: Martin

Post Reply
snovvman
Posts: 4
Joined: 30 Jul 2015 14:47

Waiting for a condition to become true, new flow needed?

Post by snovvman » 30 Jul 2015 14:55

I created a flow that automatically turns on WiFi when power is plugged in, then waits a bit, then checks to see if the device is connected to the specified WiFi APs. If not, it turns off WiFi. This part works fine.

If it successfully connects to my specified AP, then goes to an action block to check if the power is *unplugged*, if yes, then it will turn off WiFi.

The intent is that, when I plug in my phone at night, WiFi will be turned on so the device can sync, etc. When I unplug in the morning, WiFi will be turned off.

The problem is that when it goes to the block that checks to see if the power is unplugged, it does not wait for the condition, but rather it simply checks and exits. Is there a "wait" or "wait until condition becomes true" function? Or, do I need to create a new flow that is triggered by power unplugged in order to turn off the WiFi?

Thanks.

User avatar
kintrupf
Posts: 257
Joined: 10 Sep 2013 08:59

Re: Waiting for a condition to become true, new flow needed?

Post by kintrupf » 31 Jul 2015 06:09

You'll need a new flow!

Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

Re: Waiting for a condition to become true, new flow needed?

Post by Wibbly » 31 Jul 2015 07:37

If you want to do this in one flow, try a flow that uses the Power Source trigger, but have both the Connected and Disconnected versions of that trigger in the trigger block. It will fire when the selected power sources are connected OR disconnected - i.e. every time there is a change in power source. The flow can then determine the detail and act accordingly by using the Power Source Connected condition to test what's actually connected.

snovvman
Posts: 4
Joined: 30 Jul 2015 14:47

Re: Waiting for a condition to become true, new flow needed?

Post by snovvman » 31 Jul 2015 15:09

Wibbly wrote:If you want to do this in one flow, try a flow that uses the Power Source trigger, but have both the Connected and Disconnected versions of that trigger in the trigger block. It will fire when the selected power sources are connected OR disconnected - i.e. every time there is a change in power source. The flow can then determine the detail and act accordingly by using the Power Source Connected condition to test what's actually connected.
Your suggestion caused me to learn something new. The Power Source trigger was in fact what I previously used. When I select it, the Connected/Disconnected were exclusively selectable via radio buttons. I then realized that I can select both triggers via a checkbox in a different menu, which enacts the scenario you described. I'll give it a try. Thanks!

snovvman
Posts: 4
Joined: 30 Jul 2015 14:47

Re: Waiting for a condition to become true, new flow needed?

Post by snovvman » 31 Jul 2015 15:18

Follow up to my previous post, I was able to create a trigger with both Connected and Disconnected, but how do I branch from the trigger so that each condition will perform different tasks? As far as I can tell, I can create actions using the + coming off of the trigger, but there is no way for me to define whether the branch is for Connected or Disconnected. Thanks.

snovvman
Posts: 4
Joined: 30 Jul 2015 14:47

Re: Waiting for a condition to become true, new flow needed?

Post by snovvman » 31 Jul 2015 15:21

snovvman wrote:Follow up to my previous post, I was able to create a trigger with both Connected and Disconnected, but how do I branch from the trigger so that each condition will perform different tasks? As far as I can tell, I can create actions using the + coming off of the trigger, but there is no way for me to define whether the branch is for Connected or Disconnected. Thanks.
Do I use a condition Power Source block after the trigger to branch off to True/False?

Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

Re: Waiting for a condition to become true, new flow needed?

Post by Wibbly » 31 Jul 2015 15:22

That sounds right, yes :)

Post Reply