5 #include "salon-config.h"
7 const char* wifi_ssid = WIFI_SSID;
8 const char* wifi_pass = WIFI_PASS;
11 IPAddress influxdb_ip(INFLUXDB_IP);
12 long influxdb_port = INFLUXDB_PORT;
13 unsigned int localPort = 2390;
15 long unsigned poll_int = POLL_INT;
17 String location = LOCATION;
21 SimpleDHT22 dht22(pinDHT22);
27 WiFi.begin(WIFI_SSID, WIFI_PASS);
29 while (WiFi.status() != WL_CONNECTED) {
35 float temperature = 0;
37 int err = SimpleDHTErrSuccess;
38 if ((err = dht22.read2(&temperature, &humidity, NULL)) == SimpleDHTErrSuccess) {
39 sendToInfluxDB("temperature,city="+city+",location="+location, "value", String(temperature));
40 sendToInfluxDB("humidity,city="+city+",location="+location, "value", String(humidity));
46 void sendToInfluxDB(String measure, String key, String value) {
47 String line = measure+" "+key+"="+value;
49 Udp.beginPacket(influxdb_ip, influxdb_port);