Sending multiple values to single InitialState bucket

Hi Everyone,

first post, so bear with me…

got a sparrow kit with 2 nodes.

attempting to send multiple sensor values to a single Initial State bucket and unsure what I am doing wrong

I have the following in my JSONata expression but only 1 value shows up (temperature) on the dashboard, and there are no routing errors etc

“key”: “temperature”, “value”: $round(body.temperature,1),
“key1”: “sensor”, “value1”: $split(file,“#”)[0],
“key2”: “humidity”, “value2”: $round(body.humidity),
“key3”: “pressure”, “value3”: $round(body.pressure/1000,2),
“key4”: “voltage”, “value4”: $round(body.voltage,2),
“key5”: “time”, “value5”: $fromMillis(when * 1000)

am I missing something on the side or should I be doing something on the side of things?


1 Like

any suggestions from anyone?

Hey @therockster,

Welcome to the Blues community! And sorry you ran into issues here.

Below is what your JSON payload looks like after the JSONata expression gets applied, which all seems fine at a glance.

Can you verify that Initial State is expecting a format where additional sensor readings come through as key1 / value1, key2 / value2, etc? That’s my first suspicion since the temperature is coming through but the other readings aren’t.

Another thing you can try doing is looking at the response Initial State is returning for these events. You can see those on the Route log tab for the event in Notehub. Sometimes these logs have hints about what might have went wrong.

My gut says this is a problem where you’re just not sending data in the format Initial State is expecting it. Let me know if you figure it out.

I have to finish one thing up today, but if you’re still having issues I’ll resurrect my Initial State account later and see if I can get this data to come through.


1 Like

Hi @tjvantoll thx for getting back with some helpful pointers…

I found the following and I am unclear what format Initial State wants the data to be sent in especially when sending in multiple values in single route to single bucket, check out Initial State Streaming API · Apiary (obviously I am reading this wrong…)

the “response” notehub is getting from this route to InitialState is as follows:

hopefully I dont have to create a dozen or two notehub routes!!

and for context, I originally followed the following Blues Tutorial on setting up this route for Initial State:

I manually created the IS bucket during this test and attempted to use this tutorial for sparrow dev kit and the many data points collected via this dev kit to be visualized on the IS visualization platform.

what I would like to avoid if at all possible, is create dozens of routes in Notehub and have matching buckets on InitialState platform just to visualize the data


Ok, based off that documentation InitialState wants an array of all of the values, so you’ll need to switch your route’s JSONata to this approach.

    {"key": "temperature", "value": body.temperature },
    {"key": "humidity", "value": body.humidity}

I just tried this in with my own Sparrow setup and was able to get temp and humidity to come through.


thx @tjvantoll , so heres what I did:

changed my JSONata expression to the following:

and on the next event, ended with this error as follows:

Try this. Initial State seems to want each individual entry in the array to have an attribute named key and another named value.

    { "key": "sensor", "value": $split(file, "#")[0] },
    { "key": "humidity", "value": $round(body.humidity) },
    { "key": "pressure", "value": $round(body.pressure / 1000, 2) },
    { "key": "temperature", "value": $round(body.temperature) },
    { "key": "time", "value": $fromMillis(when * 1000) }

thx @tjvantoll that fixes it!! for whatever reason I assumed each key name had to be unique…