Can you show your code?
Are you really exposing a function 3on by calling Particle.function("3on", someFn); in your setup()?
Does that mean that you have eight distinct functions 1on, 1off, … 4on and 4off?
If I wanted to control four relays via a Particle.function() I’d have a single function (e.g. setRelay) and then control which relay and what state in the parameter/argument sent to that function (e.g. 1:0 = 1off, 3:1 = 3on).
Hi, all I’m trying to do is mirror what I had setup using IFTTT directly - see example below which is the “then that” portion following a day/time “if this” command. I have a few more commands than the 8 (off/on etc.)
Sorry, I don’t quite understand, being a non-programmer myself. When you say "are you exposing a function 3on by calling Particle… well yes I am trying to i.e. trying to mirror what I had programmed in the IFTTT applet but getting confused with what to enter in the Webhooks parameters, including device ID and access token etc. How am I supposed to send an input command of “3on” to my particle-1 board as this is the command it requires to turn relay #3 on?
You may want to test the function via console.particle.io before moving on to IFTTT.
Only after you established that the function is accessible on the device with that device ID there is any point to move on. Otherwise you’d need to find out why you cannot reach that device.
I’m not convinced 123456789... is your device ID and hence the URL (with an invalid device ID) would have to cause a HTTP 400 (bad request).
(since it’s good practice to not disclose your device ID we were not sure whether this is the actual URL or just a “redacted” substitute)
Hi ScruffR - that device ID is fake as you suggested I don’t expose it on this forum. If I simply enter https://api.particle.io/v1/devices/4b***************3433/?access_token=6b******************************1215fd
into a webpage I receive the below which shows that I’m connecting to the board… (edited)
If you give it a try you’ll find Particle Console is pretty self-explanatory
When you just go there, log in (if you aren’t already) and find yourself on the devices page.
There you find and click your desired device to go to the page for that device.
There you should find a section ‘FUNCTIONS’ with an entry for your controlRelay.
In the respective input box, you enter your command (e.g. 3on) and hit CALL.
However, looking at the device descriptor you posted above, it appears that device is part of a PRODUCT and for that I’m not sure whether the bearer access on IFTTT works the same way as for sandbox devices. Maybe @rickkas7 can chime in on that.
Hi All, I’m still stuck in the same place i.e. recieving an error “Action failure message: Your server returned a 404. Unable to make web request to https://api.particle.io/v1/devices/123456789xxxxxxx/controlRelay” when trying different parameters in the webhooks fields. As per above I can successfully call function “3on” via Particle Console so this argument / input definitely works. Can someone perhaps help me populate all the webhooks fields correctly please?
Right. The Particle Cloud docs suggest that putting the token in the URL is a bad idea since I assume these go out in the clear. The Additional Headers format with the Authorization: Bearer XXXX form works. Either way, the token appears in the IFTTT logs for the “applet”.