particle electron example for multiple vars463

micromet private msg quote post Address this user
Could anyone refer me to an example on how to route multiple variables from a particle electron/photon to GS ?

I worked through the simple example - no problem

However, now I need to publish and webhook multiple floating point variables (like data from a weather station).

My main issue is correctly formatting the publish command and webhook on the particle side so its compatible with GS.

A good example of something similar would be REALLY useful.

Post 1 • IP   flag post
MikeMills private msg quote post Address this user
I see you posted on the Spark Forum too (

@ctmorrison 's solution in that thread will work if you are familiar with the Spark command line tool to create the webhook.

Otherwise, I think you could still use the technique in the GS example. The Spark webhook, under the covers, is creating a GS "All on the URL" HTTP Feed PUT call. The URL, with multiple values, would look like this:

The device lets you push up one value so push up a bunch of data in one shot as a single string like this:

Spark.publish("f", "3&g=4&h=4.0&i=sw" , 60, PRIVATE);

I haven't tried this, but in theory, the webhook parser will plug-in the published string into the URL it generates.
Post 2 • IP   flag post
MikeMills private msg quote post Address this user
Just tweaked the code above from "=3&g=4&h=4.0&i=sw" to "3&g=4&h=4.0&i=sw"
Post 3 • IP   flag post
micromet private msg quote post Address this user
Thanks Mike,

I was able to get this working using the examples and generous help from @ctmorrison

I used the CLI based approach to create the webhook (described in the links in particle forum ) - I found this much easier than the hook builder in particle - IMO.

Did find that using the sprintf command to be a bit tricky - follow @ctmorrison syntax very carefully .

I worked up a nice example to webhook multiple variables to GS for a BME280 sensor (T,RH,P) connected to a particle electron - if anyone is interested.
Post 4 • IP   flag post
micromet private msg quote post Address this user
We have run into some problems with the above-mentioned approach when the strings we get very large. For example, we need to upload 23 temperatures to the same time series table on a GS dashboard (via our Particle electrons). I was not able to publish and webhook this large string to Grovestream without getting a webhook error (401). I checked the string published to partitcle io and it looked fine. However, when I broke the data into two strings - half the size (and two webhooks) it worked fine . The problem is the data comes into GS with two different time stamps (not fine -makes a mess on the times series table).

Is there a http limitations on string size comming into GS via a put command ?

Any ideas
Post 5 • IP   flag post
MikeMills private msg quote post Address this user
401 usually indicates an authentication error. I wonder if your large string was assembled incorrectly and GS couldn't parse out the api_key.

GS allows for very large strings. Was there an error inside your GS Organization System notifications? If so, can you post it? If not, then GS couldn't extract the api_key from the URL or the URL was corrupt. Email me the api_key and I'll search our logs to see if it even made it to our servers and if so, what the error was.
Post 6 • IP   flag post
2565 6 6
Log in or sign up to compose a reply.