问题描述
我有一个简单的设备(
我想出了一种方法,可以通过名为 apilio .
过程:
前往apilio.io并注册一个帐户.
- 在用户个人资料页面中输入您的IFTTT令牌.
- 转到布尔变量",然后输入一个名为
bln_light_on
的变量.将其默认值设置为false
- 转到
条件>布尔条件的新条件
.将其命名为cnd_light_on
. - 在变量下,选择状态为
True
的bln_light_on
. - 在
name
下创建一个条件为cnd_light_on
的lgc_light_on
名称,并将条件链接设置为Simple AND
- 在
操作链下>积极结果的操作
输入button_on
- 在操作链下>负结果操作输入button_off
- 在
执行模式
下,选择立即
.在高级选项>下自动评估
选择在任何已连接变量更改时评估此逻辑块
.现在,在IFTTT中,创建一个New Applet>网页挂钩>如果是制造商事件"button_press"
,则>Web挂钩>发出网络请求
在URL字段中,您将输入在Apilio中设置的bln_light_on
布尔变量中的切换URL.您可以通过单击Boolean Variables>看到此内容.bln_light_on>从菜单中显示
.最后,在Nordic Thingy Web App中,发送事件button_press
I have a simple device (Nordic Thingy 52) with a push button which can trigger the Maker Webhooks service in order to pass an event (button_press
), which I am currently using to then trigger the Smart Life service's "Turn Off" or "Turn On" action.
The problem is that, since I can only pass the one event (button_press
), I have to choose whether that event triggers either "Turn Off" or "Turn On". But what I want is to add some logic to say, "If the previous request was to turn off the Smart Life device, make the next one turn on the smart life device."
Wasn't sure how to do this. An AWS Lambda function? Chaining some other preexisting service? A filter that utilizes local storage or somehow handles state logic?
Any pointers for where to start searching would be appreciated.
I figured out a way to do this with a service called apilio.
Process:
Head to apilio.io and register for an account.
- Enter your IFTTT token in your user profile page.
- Go to Boolean Variables and enter a variable called
bln_light_on
. Set its default value tofalse
- Go to
Conditons > New Condition for Boolean
. Call itcnd_light_on
. - Under variable select
bln_light_on
with a required state ofTrue
. - Under
name
create a name oflgc_light_on
with conditoncnd_light_on
, with Condition Linking set toSimple AND
- Under
Action Chains > Actions for Positive Result
enterbutton_on
- Under Action Chains > Actions for Negative Result enter button_off
- Under
Execution Mode
selectImmediate
. UnderAdvanced Options > Automatic Evaluation
selectEvaluate this logicblock when any connected variable changes
.Now, in IFTTT, create aNew Applet > Web Hooks > If maker Event "button_press"
, then >Web Hooks > make a web request
In the URL field you’ll enter the Toggle URL from thebln_light_on
Boolean Variable you set up in Apilio. You can see this by clickingBoolean Variables > bln_light_on > show
from the menu.Lastly, in the Nordic Thingy Web App, send the eventbutton_press
这篇关于在IFTTT中的两个动作之间创建切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!