Reputation: 1
I am brand new to webhooks and have had a nightmare trying to get my first one to function. I am trying to use a Particle Photon to send a single float temperature variable to a site that can graph the data. I've tried creating webhooks to thingspeak.com and librato.com with no success. My main attempts have been trying to use the json code in tutorials to create the webhook.
Here is my Photon's code:
#include "Particle.h"
float temp = 70.1000;
float adjust = 0.4;
int acOn = 0;
void setup()
{
}
void loop()
{
if(temp < 72)
adjust = random(1620000)/1000000.0;
else if(temp < 74)
adjust = random(1000000)/1000000.0;
else
adjust = -1*random(500000,2200000)/1000000.0;
temp = temp + adjust;
Particle.publish("librato_", String(temp), 60, PRIVATE);
Particle.process();
delay(30000);
}
and the webhook JSON code (for the librato attempt)
{
"event": "librato_",
"url": "https://metrics-api.librato.com/v1/metrics",
"requestType": "POST",
"auth": {
"username": "YOUR_LIBRATO_USERNAME",
"password": "YOUR_LIBRATO_API_TOKEN"
},
"json": {
"gauges": [
{
"name": "{{NAME}}",
"value": "{{temp}}",
"source": "{{PARTICLE_DEVICE_ID (particle API token?)}}"
}
]
},
"mydevices": true
}
where I have filled in the username and API token found on librato and also the particle api token in the IDE settings. Thanks in advance for the help.
Upvotes: 0
Views: 873
Reputation: 39
Looks like this user had a similar problem which was solved with a simple renaming or the webhook: https://community.particle.io/t/connection-to-librato-solved/19230
Check with the Particle CLI if any events are being generated. If you are still not seeing data in Librato, reach out to [email protected] so that we can check the API for errors.
Upvotes: 0