I am trying to use the Blynk Webhook (local Blynk server on a Raspberry Pi 3) to pass data from a virtual pin to an Influx database (local sever on a different Raspberry Pi 3), but not having much luck. I use the Blynk app on and iPhone and iPad.
From the InfluxDB website, Influx (https://docs.influxdata.com/influxdb/v1.4/tools/api/#write) uses POST HTTP requests to write data into the database. And it works as expected from my Pi with a test value:
pi@BlueberryPi:~ $ curl -i -XPOST "http://10.0.1.102:8086/write?db=arduino" --data-binary 'average value=41.29'
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: add75056-225b-11e8-8298-000000000000
X-Influxdb-Version: 1.1.1
Date: Wed, 07 Mar 2018 23:02:58 GMT
InfluxDB terminal logging display:
[httpd] 10.0.1.102 - - [07/Mar/2018:18:05:29 -0500] "POST /write?db=arduino HTTP/1.1" 204 0 "-" "curl/7.38.0" 07b9b0e1-225c-11e8-829a-000000000000 17531
Note that I have successfully directly written to an Influx database from a WiFi connected Arduino Yun using the string, or even more complex strings, as above, and I am successfully using Blynk Webhooks to push data from some home automation Arduino’s to a local ThingSpeak server (also on a Raspberry Pi 3).
However, when I use a Blynk Webhook for results on a virtual pin from an Arduino sketch where
URL: see above
Method: POST
Content Type: application/json
Body: empty
The InfluxDB terminal log displays:
[httpd] 10.0.1.103 - - [07/Mar/2018:18:14:36 -0500] "POST /write?db=arduino%20--data-binary%20%E2%80%98average%20value=3039.856%E2%80%98 HTTP/1.1" 404 87 "-" "-" 4d6d8aa2-225d-11e8-82a5-000000000000 478
And no value is entered into the database, although I can see the value for the pin changing with each write (until the write stops after 10 failures as per the Blynk default). I have tried different combinations of quoting for the URL, as well as using “&” for spaces, and a lot of Google’ing and searching the Blynk and InfluxDB sites, but no luck. Either an HTTP 400 or 404 error is displayed in the InfluxDB log. I also have tried the 3 different Webhook content types and that does not appear to solve the problem either.
Any thoughts as to why the Webhook fails to successfully write to the InfluxDB? As I noted above, it works brilliantly with my ThingSpeak server.
Thanks in advance for any help.
Regards,
John