connect by 循环_如何与Connect一起循环或链接多个String化流

connect by 循环

connect by 循环

Stringify is a crazy powerful tool that lets you automate complex tasks with minimal effort, even if you don’t know any code. One of Stringify’s most powerful tools is called Connect: Flow. This “Thing” lets you use one Flow to activate another, or even create a Flow that loops itself.

Stringify是一个疯狂的功能强大的工具 ,即使您不知道任何代码,也可以使您以最小的努力自动执行复杂的任务 。 Stringify最强大的工具之一称为Connect:Flow。 这种“事物”使您可以使用一个流程激活另一个流程,甚至创建自己循环的流程。

Connect: Flow is one of Stringify’s built-in Things. Like the previously covered Mode Thing, Connect: Flow isn’t used to directly control the stuff in your house. Instead, you can use it to make your Flows do more complex things with fewer steps. Connect has one trigger and one action:

连接:Flow是Stringify的内置Things之一 。 就像之前介绍的Mode Thing一样 ,Connect:Flow不能用来直接控制房屋中的东西。 相反,您可以使用它来使Flow以更少的步骤完成更复杂的事情。 Connect具有一个触发器和一个动作:

  • WHEN Trigger — “Start whichever Flow this is included in”: This is a confusingly titled trigger, but it’s really easy to use. Simply add this trigger to the start of a Flow and that makes it available to any of your other Flows. For example, you could create a flow named “Bedtime Lights” that turns off your living room lights and turns on the bedroom light using this trigger. Then, you can create multiple other Flows that use this action.

    WHEN触发器—“启动包含在其中的任何流程”:这是一个标题混乱的触发器,但确实非常易于使用。 只需将此触发器添加到Flow的开始,即可将其用于任何其他Flow。 例如,您可以创建一个名为“ Bedtime Lights”的流,使用此触发器关闭客厅灯并打开卧室灯。 然后,您可以创建其他多个使用此操作的流。

  • THEN Action — “Run the selected Flow”: This action is how you call other Flows. Put it at the end of a Flow and you can activate a different Flow. To continue the example above, you could create one Flow that activates “Bedtime Lights” whenever it’s 8:00PM. You could create another Flow that uses a Stringify widget to activate “Bedtime Lights” that you can trigger manually. This way, you can turn on or off a set of lights with multiple flows, but you only have to set up the actions for the lights once.

    THEN操作-“运行所选流”:此操作是您调用其他流的方式。 将其放在流程的末尾,您可以激活其他流程。 要继续上面的示例,您可以创建一个流程,该流程在晚上8:00激活“ Bedtime Lights”。 您可以创建另一个使用Stringify小部件的流程来激活可以手动触发的“ Bedtime Lights”。 这样,您可以打开或关闭具有多个流的一组灯光,但是您只需设置一次灯光操作即可。

Connect: Flow can also reference itself. So, if you want a Flow to run on a loop, you can put a Connect Thing at the start and end of the Flow and it will continue running constantly. Note, Stringify may add a delay to your loops if they run constantly, since that takes up precious server power, but for a Flow that uses timers and takes a while to complete each loop, this can be a handy solution.

连接:流也可以引用自身。 因此,如果要让Flow在循环上运行,可以将Connect Thing放在Flow的开头和结尾,它将连续不断地运行。 注意,如果Stringify持续运行,则可能会增加循环的延迟,因为这会占用宝贵的服务器功能,但是对于使用计时器并花一些时间才能完成每个循环的Flow,这可能是一个方便的解决方案。

To demonstrate how this works, we’re going to create a looping Flow that turn some Philips Hue lights on and off every so often to make it look like someone is in your house while you’re away. To create this, you’ll need the Connect: Flow Thing enabled, as well as a smart light Thing like Philips Hue. We’ll also be using Date & Time and Timer.

为了演示它是如何工作的,我们将创建一个循环流,该流会经常打开和关闭一些Philips Hue灯,以使其看起来像是您不在时有人在您家中。 要创建此对象,您需要启用Connect:Flow Thing ,以及像Philips Hue这样的智能灯。 我们还将使用Date&TimeTimer

To get started, open the Stringify app and tap the plus icon, then select “Create a new flow.”

首先,打开Stringify应用并点击加号图标,然后选择“创建新流程”。

At the top of the screen, give your Flow a name. If you’re going to call this Flow later on from a different Flow, make sure to give it a short, descriptive name so you know what it does.

在屏幕顶部,为您的流程命名。 如果以后要从另一个Flow调用此Flow,请确保给它一个简短的描述性名称,以便您知道它的作用。

Next, tap the plus icon at the bottom of the screen. This is where you can add the Things you’ll need for your Flow. For now, add Connect: Flow and Date & Time.

接下来,点击屏幕底部的加号图标。 您可以在此处添加流程所需的事物。 现在,添加“连接:流和日期和时间”。

Drag the Connect: Flow icon to the circle grid and tap the gear icon.

将“连接:流”图标拖到圆形网格,然后点击齿轮图标。

Under the Triggers tab, choose “Start whichever Flow this is included in” which should be the only option on the list. On the next page, tap Save.

在“触发器”选项卡下,选择“启动其中包含的任何流”,这应该是列表上的唯一选项。 在下一页上,点击“保存”。

This trigger allows you to call this Flow from any other Flow you create. Our example will use a loop that references itself, but you can also call it from any other Flow using the Connect Thing.

此触发器允许您从创建的任何其他流中调用此流。 我们的示例将使用引用自身的循环,但是您也可以使用Connect Thing从任何其他Flow调用它。

Back on the grid screen, drag Date & Time out to the circle below Connect: Flow and tap its gear icon.

返回到网格屏幕,将“日期和时间”拖出到“连接:流量”下方的圆圈,然后点击其齿轮图标。

Under the ONLY IF section, choose “Time is between.” Set From Time to 6:00PM and To Time to midnight. Make sure the Start Date is some time after the current date, and set it to repeat every day. We’ll control which days this Flow activates later, but for now we want to make sure this loop only continues running between 6:00 PM and midnight when it is activated.

在“仅中频”部分下,选择“时间介于两者之间”。 将时间设置为下午6:00,将时间设置为午夜。 确保开始日期比当前日期晚一些,并将其设置为每天重复。 我们将控制此Flow稍后激活的日期,但现在,我们要确保此循环仅在激活后的6:00 PM和午夜之间继续运行。

Back on the grid screen, add one of your Philips Hue lights and a Timer from the Things menu. Drag the Hue Thing to the screen next to the Connect icon, as shown below. Tap the Hue light’s gear icon.

返回到网格屏幕,从“事物”菜单添加一个Philips Hue灯和一个计时器。 将Hue Thing拖到Connect图标旁边的屏幕,如下所示。 点击色相灯的齿轮图标。

On the Hue screen, tap “Turn on the light.” On the next page, tap Save.

在“色相”屏幕上,点击“打开灯”。 在下一页上,点击“保存”。

Back on the grid screen, connect the Date & Time and Hue things by quickly swiping between the two. Then, swipe from the Connect icon to the yellow link icon you just created, as shown by the arrows in the left picture below. The result should look like the picture on the right.

返回到网格屏幕,通过在两者之间快速滑动来连接日期和时间以及色相。 然后,从“连接”图标滑动到您刚创建的黄色链接图标,如下面左图中的箭头所示。 结果应如右图所示。

Next, drag the Timer you grabbed earlier and place it to the right of the Hue light you just added, then tap the Timer’s gear icon.

接下来,拖动您之前抓取的计时器并将其放置在刚添加的Hue灯的右侧,然后点击计时器的齿轮图标。

Tap the countdown timer box and set the timer for 45 minutes (or whatever interval you prefer). We’re going to use this to leave one light on for 45 minutes before shutting it off and turning on a different light for a while. When you’re done setting the timer, tap Save.

点击倒数计时器框,并将计时器设置为45分钟(或您想要的任何间隔)。 我们将使用它在关闭一盏灯并打开另一盏灯一段时间之前,先将其打开45分钟。 完成计时器设置后,点击“保存”。

Back on the grid screen, swipe to connect the previous Hue light and the Timer icons you just added to create a link.

返回网格屏幕,滑动以连接先前的Hue指示灯和您刚刚添加的创建计时器的计时器图标。

Tap on the Things menu at the bottom of the screen to add more lights. For the next step, we’re going to turn off the light you just turned on and then turn on a different light, so grab two Hue lights. In my example, I want to turn off the Office light that I just turned on and turn on the Living Room light.

点击屏幕底部的“事物”菜单可添加更多灯光。 下一步,我们要关闭刚刚打开的灯,然后再打开另一个灯,因此请抓住两个Hue灯。 在我的示例中,我想关闭刚刚打开的办公室灯,然后打开客厅灯。

Place the light you want to turn on directly to the right of the Timer, and place the light you want to turn off below that, as shown below. Tap the gear icon for each one and choose either “Turn on the light” or “Turn off the light” as you did for the first light earlier.

将要打开的灯直接放在计时器的右侧,然后将要关闭的灯放在其下方,如下所示。 点按每个齿轮图标,然后选择“打开照明灯”或“关闭照明灯”,就像之前的第一个照明灯一样。

Swipe from the Timer icon to each Hue light to link them together. The result should look like the picture below.

从“计时器”图标滑动到每个“色相”指示灯,即可将它们链接在一起。 结果应如下图所示。

Add another Timer from the Things menu and set it to 45 minutes (or whatever duration you want). This time, it will leave your second light (in this example, the living room) on for 45 minutes before restarting the loop. Swipe to connect the Living Room light and the new Timer, as shown below.

从“事物”菜单添加另一个计时器,并将其设置为45分钟(或所需的任何持续时间)。 这次,它将在重新开始循环之前将您的第二个灯(在本例中为客厅)打开45分钟。 滑动以连接起居室灯和新的计时器,如下所示。

Next, add another copy of the Hue Thing for your second light, and one more copy of the Connect: Flow thing. We’re going to cap off the loop here and refer it back to itself (and turn off the second light). Place the Connect: Flow Thing next to your last Timer, and place the Hue light below it, as shown below. Then, tap the gear icon next to Connect: Flow.

接下来,为您的第二盏灯添加另一张Hue Thing副本,以及另一份Connect:Flow物件。 我们将在这里结束循环,并将其返回给自己(并关闭第二个灯)。 将Connect:Flow Thing放置在最后一个计时器旁边,并将Hue灯放在其下方,如下所示。 然后,点击“连接:流量”旁边的齿轮图标。

Tap the Actions tab along the top and choose “Run the selected Flow” which should be the only action in the list.

点击顶部的“操作”选项卡,然后选择“运行所选流程”,这应该是列表中唯一的操作。

On this page, you’ll see a dropdown where you can choose which Flow you want to trigger. Since this is the first Flow you’ve created using Connect, it will default to “This flow.” This option means that when this Flow reaches this action, it will start back over with the first Connect trigger at the beginning of the Flow. Keep this option selected and tap Save.

在此页面上,您会看到一个下拉菜单,您可以在其中选择要触发的流程。 由于这是您使用Connect创建的第一个流程,因此默认为“此流程”。 此选项意味着,当此流程到达此动作时,它将从流程开头的第一个连接触发器重新开始。 保持选中此选项,然后点击“保存”。

Back on the grid screen, tap the gear icon next to the final Hue action and set it to turn your second light (in this case Living Room) off, just as you’ve done with the previous lights.

回到网格屏幕上,点击最后的“色相”动作旁边的齿轮图标,然后将其设置为关闭第二个灯(在本例中为“客厅”),就像处理前一个灯一样。

Once you’re done, connect the last Timer to the Connect: Flow and Hue icons separately by swiping quickly from Timer to each of the actions. The result should look like the image on the right below.

完成后,通过快速从Timer滑动到每个动作,将最后一个Timer分别连接到Connect:Flow和Hue图标。 结果应类似于下面的右图。

At this point, you’re finished with the loop. When activated, this loop will alternate two lights every 45 minutes. Every time the cycle finishes, it will start over unless it’s after midnight. This should give any onlookers the impression that someone is inside your home.

至此,您已经完成了循环。 激活后,此循环将每45分钟交替显示两盏灯。 每次周期结束时,除非从午夜开始,否则它将重新开始。 这应该给任何围观者以某人在您屋内的印象。

While this Flow can loop back on itself, it needs an initial trigger to set it off. To do that, we’ll create a Flow that will activate every day at sunset for a specific week. This is useful if, for example, you’re going on vacation. Since this Flow is separate from the loop you just created, the loop won’t be affected. You could leave the loop active (or even temporarily disable it) and update your vacation Flow when you need it.

虽然此Flow可以自己循环返回,但它需要一个初始触发器将其关闭。 为此,我们将创建一个流程,该流程将在日落的每一天每天激活特定的一周。 例如,如果您要去度假,这将很有用。 由于此流与您刚刚创建的循环是分开的,因此该循环将不会受到影响。 您可以将循环保持活动状态(甚至暂时禁用它),并在需要时更新休假流程。

To get started on the next phase, create a new Flow and give it a name. In this case, we’ll use “Away From Home.”

要开始下一阶段,请创建一个新的Flow并为其命名。 在这种情况下,我们将使用“出门在外”。

Next, add a Date & Time and Connect: Flow Thing to the grid. Place Date & Time on the left and Connect: Flow on the right. Tap the gear icon next to Date & Time.

接下来,添加日期和时间并连接到网格。 将日期和时间放在左侧,将“连接:流”放在右侧。 点击日期和时间旁边的齿轮图标。

In the list of WHEN triggers, choose Sunset.

在“ WHEN”触发器列表中,选择“日落”。

On the next page, set the start and end dates to your vacation and make sure “Repeat” is set to “Every day.” Add a location to the bottom to make sure Stringify uses the correct time zone. This doesn’t have to be your home address, just a city or zip code within your time zone. When you’re done, tap Save.

在下一页上,将开始日期和结束日期设置为假期,并确保将“重复”设置为“每天”。 在底部添加一个位置,以确保Stringify使用正确的时区。 这不必是您的家庭住址,只要是您所在时区的城市或邮政编码即可。 完成后,点击保存。

Back on the grid screen, tap the gear icon next to the Connect: Flow icon.

返回网格屏幕,点击“连接:流量”图标旁边的齿轮图标。

Under the Actions tab, choose “Run the selected Flow.” Click the drop down menu and choose the looping Flow you created earlier. Tap Save.

在“操作”选项卡下,选择“运行所选流程”。 单击下拉菜单,然后选择您之前创建的循环流。 点击保存。

On the grid screen, swipe to connect the Date & Time and Connect: Flow icons. Then, tap Enable Flow at the bottom of the screen.

在网格屏幕上,滑动以连接日期和时间和连接:流图标。 然后,点击屏幕底部的“启用流”。

As you can see, the second Flow you created is much, much simpler. Now if you want to start switching lights for a few hours, you can use just a couple Things to create a Flow that will activate that loop. The next time you go on vacation, you can simply change the dates in the Away From Home Flow or create an entirely new one and you don’t have to build your loop from scratch. This is just one example of how you can use the Connect: Flow feature to compartmentalize your Flows, connect multiple Flows together, or even create a Flow that loops as often as you need it to.

如您所见,您创建的第二个流程要简单得多。 现在,如果您要开始几个小时的开关灯,则可以仅使用几个事物来创建将激活该循环的流。 下次度假时,您只需在“离开家中流”中更改日期或创建一个全新的日期,而不必从头开始构建循环。 这只是一个示例,说明如何使用“连接:流”功能划分流,将多个流连接在一起,甚至创建需要循环的流。

翻译自: https://www.howtogeek.com/312831/how-to-loop-or-chain-multiple-stringify-flows-together-with-connect-flow/

connect by 循环

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值