@@ -44,7 +44,7 @@ ESP8266WiFiMulti wifiMulti;
4444// Japanesse: "JST-9"
4545// Central Europe: "CET-1CEST,M3.5.0,M10.5.0/3"
4646#define TZ_INFO " CET-1CEST,M3.5.0,M10.5.0/3"
47- // NTP servers the for time syncronozation .
47+ // NTP servers the for time synchronization .
4848// For the fastest time sync find NTP servers in your area: https://www.pool.ntp.org/zone/
4949#define NTP_SERVER1 " pool.ntp.org"
5050#define NTP_SERVER2 " time.nis.gov"
@@ -54,6 +54,8 @@ ESP8266WiFiMulti wifiMulti;
5454
5555// InfluxDB client instance with preconfigured InfluxCloud certificate
5656InfluxDBClient client (INFLUXDB_URL, INFLUXDB_ORG, INFLUXDB_BUCKET, INFLUXDB_TOKEN, InfluxDbCloud2CACert);
57+ // InfluxDB client instance without preconfigured InfluxCloud certificate for insecure connection
58+ // InfluxDBClient client(INFLUXDB_URL, INFLUXDB_ORG, INFLUXDB_BUCKET, INFLUXDB_TOKEN);
5759
5860// Data point
5961Point sensorStatus (" wifi_status" );
@@ -71,14 +73,17 @@ void setup() {
7173 Serial.print (" Connecting to wifi" );
7274 while (wifiMulti.run () != WL_CONNECTED) {
7375 Serial.print (" ." );
74- delay (100 );
76+ delay (500 );
7577 }
7678 Serial.println ();
7779
7880 // Add tags
7981 sensorStatus.addTag (" device" , DEVICE);
8082 sensorStatus.addTag (" SSID" , WiFi.SSID ());
8183
84+ // Alternatively, set insecure connection to skip server certificate validation
85+ // client.setInsecure(true);
86+
8287 // Accurate time is necessary for certificate validation and writing in batches
8388 // Syncing progress and the time will be printed to Serial.
8489 timeSync (TZ_INFO, NTP_SERVER1, NTP_SERVER2);
@@ -143,8 +148,9 @@ void loop() {
143148 sensorStatus.clearFields ();
144149
145150 // If no Wifi signal, try to reconnect it
146- if ((WiFi. RSSI () == 0 ) && ( wifiMulti.run () != WL_CONNECTED))
151+ if (wifiMulti.run () != WL_CONNECTED) {
147152 Serial.println (" Wifi connection lost" );
153+ }
148154
149155 // End of the iteration - force write of all the values into InfluxDB as single transaction
150156 Serial.println (" Flushing data into InfluxDB" );
0 commit comments