As far as I can tell, this is a "solved problem", but I just can't get the details. Hopefully, someone can just provide the specifics so I can move on.
I have an existing InfluxDB setup running on an external server. It works and routinely accepts various environmental data from both raspberry pi and, a Wemos d1mini that was set up using the Arduino IDE. Grafana is used to visualize the data. So, that's all good.
I also have been able to get a couple of different Wemos d1 mini's running using ESP Easy. Again, running various sensors as well as a couple of different OLED displays.
So, the pieces are in place.
However, I cannot get the ESP Easy system to connect successfully with my existing InfluxDB using the Generic HTTP Advanced (From the ESP_Easy_mega_20200913_dev_ESP8266_4M1M version of the firmware). I believe that the problem lies in the syntax of the "Body" of the information that this controller is sending. I have tried numerous formats, and no matter what, it just doesn't work. Every time, according to the log, I'm getting the "400" response back from InfluxDB, which according to the InfluxDB information means "Bad Request".
Here is one example of the setup that I have tried. Note that the "header" is specified as "json" because that is what seems to be suggested at the InfluxDB API reference page: https://docs.influxdata.com/influxdb/v1.8/tools/api/
However, I am not wedded to any of this since it's not working, but, as I mentioned, I've tried numerous other formats. In this example, my db is "DustData", my "measurement" is "PMs", the tag is "location" and the field I'm trying to upload is "pm10". The sensor is a PMS5003, named as "Inside" and the value name is pm10.
So, the basic question is, what is the proper format for sending data to an existing InfluxDB setup? It appears to be possible, given that there is at least one other report of success using the HTTP Advanced controller.
Thanks.
getting InfluxDB to work with Generic HTTP Advanced
Moderators: grovkillen, Stuntteam, TD-er
Re: getting InfluxDB to work with Generic HTTP Advanced
For an external host, make sure to set the timeout of the controller to a higher value (default of 100 msec is too short for external hosts)
Try first with a timeout of 1000 msec.
Also make sure to change the "Check Reply" from its default so it does wait for an acknowledgement.
Try first with a timeout of 1000 msec.
Also make sure to change the "Check Reply" from its default so it does wait for an acknowledgement.
Re: getting InfluxDB to work with Generic HTTP Advanced
First, I changed the timeout, and it had no effect. And, second, I believe that I have the Reply set up properly.
In the event that it can help someone assist with this problem, here is the section of my Arduino IDE generated code (on a different WEMOS d1 mini with a different sensor). This one correctly uploads the data to InfluxDB on the same external server to which I wish to upload this data. Note that the measurement name is different.
#include <InfluxDb.h>
....
#define INFLUXDB_HOST "xxx.xxx.xxx.xxx" //External InfluxDB location
#define INFLUXDB_USER "user" //username for InfluxDB
#define INFLUXDB_PASS "password" // password for InfluxDB
...
Influxdb influx(INFLUXDB_HOST);
...
influx.setDbAuth("IHE_Weather", INFLUXDB_USER, INFLUXDB_PASS); //DB name, credentials
...
InfluxData row("air_quality"); // InfluxDB measurement
row.addTag("location", "ESP8266_1"); //Location tag
row.addTag("tz","America/Denver"); //Time zone tag
... (other data from other sensor)
row.addValue("pm25", pm.pm25); // "pm.pm25" is the output that comes from "SdsDustSensor.h"
row.addValue("pm10", pm.pm10);
influx.write(row);
As mentioned earlier, this sensor/Wemos has been working routinely. I need to figure out how to translate this syntax to the ESPEasy framework...
Thanks.
In the event that it can help someone assist with this problem, here is the section of my Arduino IDE generated code (on a different WEMOS d1 mini with a different sensor). This one correctly uploads the data to InfluxDB on the same external server to which I wish to upload this data. Note that the measurement name is different.
#include <InfluxDb.h>
....
#define INFLUXDB_HOST "xxx.xxx.xxx.xxx" //External InfluxDB location
#define INFLUXDB_USER "user" //username for InfluxDB
#define INFLUXDB_PASS "password" // password for InfluxDB
...
Influxdb influx(INFLUXDB_HOST);
...
influx.setDbAuth("IHE_Weather", INFLUXDB_USER, INFLUXDB_PASS); //DB name, credentials
...
InfluxData row("air_quality"); // InfluxDB measurement
row.addTag("location", "ESP8266_1"); //Location tag
row.addTag("tz","America/Denver"); //Time zone tag
... (other data from other sensor)
row.addValue("pm25", pm.pm25); // "pm.pm25" is the output that comes from "SdsDustSensor.h"
row.addValue("pm10", pm.pm10);
influx.write(row);
As mentioned earlier, this sensor/Wemos has been working routinely. I need to figure out how to translate this syntax to the ESPEasy framework...
Thanks.
Re: getting InfluxDB to work with Generic HTTP Advanced
So, it appears there was some recent work done on this problem, but I don't fully understand what the status is.
Apparently, in issue 1306, (Generic HTTP Advanced controller] Newline placeholders are being replaced incorrectly #1306) TD-er made some changes that apparently fixed the problems. However, I need some help figuring out what version of the ESPEasy firmware to use that will 1) incorporate these changes, and 2) retain the support for the PMS5003 sensor and a 1306 OLED display.
I updated my previous firmware with ESP_Easy_mega_20201009_dev_ESP8266_4M1M.bin, but it not clear to me (because I just don't know how things are done) whether the "fix" for the InfluxDB problem is incorporated in this version or not. Since the user with whom you were interacting (DrakenGray) is also apparently using the PMS sensor, presumably whatever version he is using has the necessary PMS support.
It would also be helpful to have an example of the exact syntax that he used, as that would probably suffice to fix everything once I have the correct binary, but if someone can point me to the known correct version, I can at least start with that.
Apparently, in issue 1306, (Generic HTTP Advanced controller] Newline placeholders are being replaced incorrectly #1306) TD-er made some changes that apparently fixed the problems. However, I need some help figuring out what version of the ESPEasy firmware to use that will 1) incorporate these changes, and 2) retain the support for the PMS5003 sensor and a 1306 OLED display.
I updated my previous firmware with ESP_Easy_mega_20201009_dev_ESP8266_4M1M.bin, but it not clear to me (because I just don't know how things are done) whether the "fix" for the InfluxDB problem is incorporated in this version or not. Since the user with whom you were interacting (DrakenGray) is also apparently using the PMS sensor, presumably whatever version he is using has the necessary PMS support.
It would also be helpful to have an example of the exact syntax that he used, as that would probably suffice to fix everything once I have the correct binary, but if someone can point me to the known correct version, I can at least start with that.
Re: getting InfluxDB to work with Generic HTTP Advanced
To see what plugins are included in what build, see: https://espeasy.readthedocs.io/en/lates ... al-plugins
When in doubt if a PR is included in the current source code, you can check here to see if it is still open: https://github.com/letscontrolit/ESPEasy/pulls
But bugs like that are often not waiting that long to be merged, so I think it is present in the current code base.
When in doubt if a PR is included in the current source code, you can check here to see if it is still open: https://github.com/letscontrolit/ESPEasy/pulls
But bugs like that are often not waiting that long to be merged, so I think it is present in the current code base.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 153 guests