Webhook and Librato: values always zero

Hi,

I am trying to post my sensor values to Librato. Therfore I have created a webhook and use Spark.publish in my code.

JSON

{
“eventName”: “data”,
“url”: “https://metrics-api.librato.com/v1/metrics”,
“requestType”: “POST”,
“auth”: {
“username”: “my email”,
“password”: “Librato Tokken”
},
“json”: {
“gauges”: [
{
“name”: “hum”,
“value”: “{{SPARK_EVENT_VALUE}}”,
“source”: “{{SPARK_DEVICE_ID}}”
},
{
“name”: “temp”,
“value”: “{{SPARK_EVENT_VALUE}}”,
“source”: “{{SPARK_DEVICE_ID}}”
},
{
“name”: “baro”,
“value”: “{{SPARK_EVENT_VALUE}}”,
“source”: “{{SPARK_DEVICE_ID}}”
},
{
“name”: “duration”,
“value”: “{{SPARK_EVENT_VALUE}}”,
“source”: “{{SPARK_DEVICE_ID}}”
}
]
},
“mydevices”: true
}

Code

sprintf(publishString,"{“hum”: %.2s, “temp”: %.2s, “baro”: %u, “duration”: %u}",String(humi).c_str(),String(tempe).c_str(),pressure,dur);

Spark.publish(“event”, publishString);

Dashboard result:

{“data”:"{“hum”: 61, “temp”: 24, “baro”: 96141, “duration”: 4862}",“ttl”:“60”,“published_at”:“2015-08-30T01:51:44.388Z”,“coreid”:“my core id”,“name”:“data”}

particle subscribe mine result:

Subscribing to all events from my personal stream (my devices only)
Listening to: /v1/devices/events
{“name”:“data”,“data”:"{“hum”: 61, “temp”: 24, “baro”: 96141, “duration”: 4862}",“ttl”:“60”,“published_at”:“2015-08-30T01:51:44.388Z”,“coreid”:“my core id”}

Altough it seems to work, all my values in Librato are 0.
I would be very grateful if you could help me to solve this problem.

Something seems inconsistent here

You publish event

But your webhook looks for data

Apart from the fact that these two settings should correspond, I’d also suggest to use less general terms.
There may be loads of data and event events out there.

thank you very much for your reply! I changed both to sensordata but it did not solve the problem.

Have you dropped and recreated the webhook?

Maybe leave some minutes between dropping the old and recreating the new one.

yes, I dropped and recreated it.
I think that my json file is not correct but I did not find an expample at Librato.

Edit:

I changed

“name”: “hum”,
“value”: “{{SPARK_EVENT_VALUE}}”,
“source”: “{{SPARK_DEVICE_ID}}”

to

“name”: “hum”,
“value”: “50”,
“source”: “{{SPARK_DEVICE_ID}}”

and this works but of course the value is always 50. So i assume that {{SPARK_EVENT_VALUE}} is zero.

Edit2:

After hours of try and error I found the solution:

I just have to use “value”: “{{hum}}”, instead of “value”: “{{SPARK_EVENT_VALUE}}”, :smile:

The docs don’t hide this fact tho’ :sunglasses:
https://docs.particle.io/guide/tools-and-features/webhooks/#custom-template-variables

Starting with the easy examples in the docs helps growing into the topic.
Taking on too much on at once might just become frustrating.