#include #include ESP8266WiFiMulti wifiMulti; #include #include #define ONE_WIRE_BUS D5 OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); union { uint64_t the_long_long; uint32_t the_longs[2]; uint8_t the_shorts[8]; } devAddr; // WiFi AP SSID #define WIFI_SSID "" // WiFi password #define WIFI_PASSWORD "" int status = WL_IDLE_STATUS; // the Wifi radio's status // InfluxDB server url, e.g. http://192.168.1.48:8086 (don't use localhost, always server name or ip address) #define INFLUXDB_URL "" // InfluxDB database name #define INFLUXDB_DB_NAME "" // Single InfluxDB instance InfluxDBClient client(INFLUXDB_URL, INFLUXDB_DB_NAME); // Define data point with measurement name 'device_status` Point point("temperature"); int16_t i, j; char query[160]; uint32_t lasttime; void setup() { char dummytext[20]; Serial.begin(115200); //Begin serial communication Serial.println("Arduino Digital Temperature // Serial Monitor Version"); //Print a message pinMode(D2, OUTPUT); // Connect WiFi Serial.println("Connecting to WiFi"); WiFi.mode(WIFI_STA); wifiMulti.addAP(WIFI_SSID, WIFI_PASSWORD); while (wifiMulti.run() != WL_CONNECTED) { Serial.print("."); delay(100); } Serial.print ( "IP address: " ); Serial.println ( WiFi.localIP() ); // Check server connection if (client.validateConnection()) { Serial.print("Connected to InfluxDB: "); Serial.println(client.getServerUrl()); } else { Serial.print("InfluxDB connection failed: "); Serial.println(client.getLastErrorMessage()); } // You can specify the time server pool and the offset, (in seconds) // additionaly you can specify the update interval (in milliseconds). //NTPClient timeClient(ntpUDP, "se.pool.ntp.org", 0, 120000); timeSync("UTC", "se.pool.ntp.org", "pool.ntp.org"); oneWire.reset() ; lasttime = millis(); sensors.begin(); Serial.print(sensors.getDS18Count()); Serial.println(" devices found"); for (i=0; i 10000) { lasttime = millis(); sensors.requestTemperatures(); for (i=0; i