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.
bln_light_on
. Set its default value to false
Conditons > New Condition for Boolean
. Call it cnd_light_on
. bln_light_on
with a required state of True
.name
create a name of lgc_light_on
with conditon cnd_light_on
, with Condition Linking set to Simple AND
Action Chains > Actions for Positive Result
enter button_on
Execution Mode
select Immediate
. Under Advanced Options > Automatic Evaluation
select Evaluate this logicblock when any connected variable changes
.
Now, in IFTTT, create a New 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 the bln_light_on
Boolean Variable you set up in Apilio. You can see this by clicking Boolean Variables > bln_light_on > show
from the menu.
Lastly, in the Nordic Thingy Web App, send the event button_press