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

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.