Success from CLI but not from Recipe


#1

I have a function on my Core and I have just tested it successfully from the CLI by calling spark call *Core_name *function_name

I created a Recipe in IFTTT with the coming_home as the Function Input. This is what I have as an argument passed in via a web page I made which also works successfully. Testing the Recipe from IFTTT did not trigger my Core.

I guess maybe I am unclear as to what should be entered in the Function Input box within IFTTT.


#2

@jasonhodges, I successfully triggered my core using function. I am not sure what you are trying to do, can you give more information, your function is a trigger or an action?


#3

I have Spark.function("coming_home", coming_home); in my *void* setup()

all this function does is make a servo turn back and forth a number of times and then it stops.

When I call the function from the CLI it works.
When I send "coming_home" as the arg through the API via web it works.

IFTTT sees my Core name and this function when I create Recipe but I have not had success with calling the function. Do I need to enter anything in the Function Input box of the Recipe in IFTTT? if so I guess this is where I am stuck. I have tried "coming_home" and coming_home


#4

If you have a function which does not require an input for the ‘String command’, then you shouldn’t put anything in the input box. Simply leave it empty, and try again :slight_smile:


#5

thanks @Moors7, I have tried leaving the box blank as well with no success. When I run spark list from CLI it returns the name of my Core, ID and that it is online. Next is the following Functions: int coming_home(String args)


#6

Would you mind sharing your full code (or at least the coming_home part)? Also, could you perhaps try to rename it to something without the underscore (ComingHome)? It could be that that causes some unforseen problems, which can then be avoided.


#7

The IFTTT box should show your list of cores, and let you select that function on your core. Are you using a “trigger”, or an “action” on IFTTT to call the function? Can you provide a screenshot of your ifttt form?

Thanks,
David


#8


#9

Also got reading a published variable to work but can’t get calling a function with parameters to work. I works through CLI but think I don’t have the right function input on IFTTT. How should you write the arguments as inputs from the functions below in IFTTT properly?

curl https://api.spark.io/v1/devices/DEVICE-ID/rgb
-d access_token=ACCESS-TOKEN
-d "args=202,230,20"
and
curl https://api.spark.io/v1/devices/DEVICE-ID/led
-d access_token=ACCESS-TOKEN
-d “args=l1,HIGH”


#10

Hi All,

If you wanted to call your spark function “hello_world” with some arguments, you’d just provide the desired input in the function input field:

Function Name: The name of the function to call
Function Input: The raw input sent to your function

for example:

Function Name: Hello_world
Function Input: Hi Dave! :) 

No extra quotes or parameter names or anything are required. :slight_smile:

I hope that helps!

Thanks!
David


#11

Oke it works! I was trying a recipe that used gmail as input and it just took like 30 minutes to refresh. Input from spark to output on android notification seems to go quite quick but always notifies double. Maybe because of only having one boundary…


#12

@Dave Thanks, I did try my “Function Input” with and without quotes with no success. For now I am just triggering via original web app I made. Perhaps I’ll have better luck with other IFTTT/Spark projects


#13

Have you tried leaving the Function Input field blank? Not all functions need params passed to it - I have a recipe working great that merely calls the Function Name…


#14

Did anyone figure this out. I am new to Particle and ifttt and im having the same problem. Just trying to turn D7 on I can get this to work from web browser, but not from call a function. Function list does show up correctly and I can select the function, but it never runs. I have it setup without function input and same issue. Note that it does work from publish an event if I rewrite the Particle code.