Integrating Particle devices with website

I’m trying to get started creating a website that will integrate with my Particle devices, and it looks like I’m falling into a knowledge gap that others have been in before. I have a Boron LTE running firmware, which correctly exposes variables to, and initiates function calls from, the Particle Console. I’d like to do the same with the Spark Helper example created by JFlasher (yes, I realize this example has been around longer than this company has been called Particle, let me know if there’s a more modern version). I have created an OAuth Client from the console, and entered the Client ID and secret, but I’m so far only receiving error messages.

Is there any reason to believe this example won’t work with the Particle Cloud anymore? Is there another example or tutorial I should be starting from?

I’m posting a similar issue to the Spark-Helper GitHub.

Related posts:



General thoughts here, if I knew a bit more about what you’re trying to do, I will reply more specifically. Think you have two options if you want to deal with the device data. If you want to be able to look at historical data (what did the temperature do over the last three days?) you need to write the data from the device, to some storage that you manage. I’d use a webhook, publishing the data maybe every hour, somehow encoding it so you’re sending as little data as possible. Once stored (for example… mysql), you can report the data.

For a variable as it exists right now, your webpage would have something like:

https://api.particle.io/v1/devices/" . $row[‘device_id’] ."/curr_battery?access_token=" . $row[‘particle’]

where it says $row[‘device_id’] it’s being pulled from a database ( the device id) and then later the access token.

If I’m way off the mark, sorry. Provide some more data and I’ll take another swing.

Hi Bill, thanks for the reply.

Historical data is something we plan on adding down the road, but at this point live data and function control are enough for us.

From what I have read so far your advice is spot on, I was just hoping to see a live working example, and it looked like some effort had been put into that here.

JFlasher has informed me on his GitHub that he’s no longer supporting his repo.

I’ve moved on to try to get BDub’s Remote-Spark Web App working, but I can’t get the code to upload to my Boron. I have changed all instances of “Spark” to “Particle” in the sketch, which should help handle the name change, but I still get an error when trying to upload (see pastebin below). I am able to upload my own firmware which should be of comparable size (two functions and four variables).

Bill, I’m looking at index.html in the Remote-Spark repo; there’s a line that sets a variable baseURL to “https://api.spark.io/v1/devices/”. I’m pretty sure changing ‘spark’ to ‘particle’ here will be incorporating your feedback.

Once I have the firmware uploaded, and I have my webpage requesting data from the right place, I think I have some questions about name discrepancies in the OAuth credentials. When I try to get Client Credentials from particle Console I get a Client ID and Client Secret; however, other documentation I see refers to an accessToken and a Core ID. I’m assuming the accessToken is the Client Secret, but I’m not quite sure if the Core ID is the Client ID or the ID I get from the Device page on the Particle console.

I got help on this issue at the Remote-Particle GitHub repo. Just needed to use some particle CLI commands to get my Device ID and token:

$ particle list
$ particle token list
1 Like