25 July 2018
Espruino did unexpectedly have a module to talk to InfluxDB directly: https://github.com/espruino/EspruinoDocs/blob/master/modules/InfluxDB.js. Given that it's a simple HTTP POST request (see previous blog entry), I should not have been surprised.
That simplifies data ingestion: no need for MQTT broker, no need for an MQTT-to-InfluxDB converter. The InfluxDB instance is on the local network this way since SSL is still not doable on an ESP8266.
This is the Espruino code:
// InfluxDB configuration
var influxDBParams = {
influxDBHost: "192.168.1.14",
influxPort: 8086,
influxDBName: "demo",
influxUserName: "submit",
influxPassword: "submitpw",
influxAgentName: "ESP32"
};
var influxDB = require("InfluxDB").setup(influxDBParams);
// bme() is the function to read from the BME280 sensor
let temperature=bme.readTemperature()
let data="env "+temperature+"="+temperature;
influxDB.write(data);
That's it. As simple as MQTT.