Closed pheetr closed 2 years ago
Outputs below (InfluxDB library debugging enabled)
Success:
Running task: WriteToDatabase
Reconnects since system start: 3
3615.058 [D] writeRecord: bufferPointer: 1, batchPointer: 0, _bufferCeiling: 1
3615.059 [D] Flushing buffer: is oversized true, is timeout false, is buffer full false
3615.134 [D] Writing batch, batchpointer: 0, size 1
3615.188 [D] Writing to http://ip:port/api/v2/write?org=org&bucket=bucket
3615.272 [D] Sending:
AirGradient pm2.5=0i,co2=1462i,humidity=47i,temperature=20.70,reconnects=3i,uptime_ms=3614995i
3615.406 [D] Dropped batch, batchpointer: 1
3615.441 [D] Success: 1, _bufferPointer: 1, _batchPointer: 1, _writeBuffer[_bufferPointer]_0
3615.538 [D] Buffer empty
Running task: MQTTHandler
Failure then successful retry:
Running task: WriteToDatabase
Reconnects since system start: 3
3675.056 [D] writeRecord: bufferPointer: 1, batchPointer: 0, _bufferCeiling: 1
3675.057 [D] Flushing buffer: is oversized true, is timeout false, is buffer full false
3675.132 [D] Writing batch, batchpointer: 0, size 1
3675.186 [D] Writing to http://ip:port/api/v2/write?org=org&bucket=bucket
3675.271 [D] Sending:
AirGradient pm2.5=0i,co2=1569i,humidity=47i,temperature=20.70,reconnects=3i,uptime_ms=3674995i
3680.574 [D] Leaving data in buffer for retry, retryInterval: 0
3680.575 [D] Success: 0, _bufferPointer: 1, _batchPointer: 0, _writeBuffer[_bufferPointer]_0
InfluxDB write failed: connection failed
Reconnecting WiFi.....................................................
WiFi reconnected.
Retrying InfluxDB write.
3686.918 [D] writeRecord: bufferPointer: 2, batchPointer: 0, _bufferCeiling: 2
3686.920 [D] Flushing buffer: is oversized true, is timeout true, is buffer full false
3687.007 [D] Writing batch, batchpointer: 0, size 1
3687.061 [D] Writing to http://ip:port/api/v2/write?org=org&bucket=bucket
3687.145 [D] Sending:
AirGradient pm2.5=0i,co2=1569i,humidity=47i,temperature=20.70,reconnects=3i,uptime_ms=3674995i
3687.282 [D] Dropped batch, batchpointer: 1
3687.314 [D] Writing batch, batchpointer: 1, size 1
3687.368 [D] Writing to http://ip:port/api/v2/write?org=org&bucket=bucket
3687.452 [D] Sending:
AirGradient pm2.5=0i,co2=1569i,humidity=47i,temperature=20.70,reconnects=3i,uptime_ms=3674995i
3687.589 [D] Dropped batch, batchpointer: 2
3687.621 [D] Success: 1, _bufferPointer: 2, _batchPointer: 2, _writeBuffer[_bufferPointer]_0
3687.718 [D] Buffer empty
Running task: MQTTHandler
Hello, I don’t have time currently to investigate the issue thoroughly at the moment, I will definitely look into this in the next coming days. In the meantime if you could keep updating the thread if you have new information and you might look at pull request #11, as this may solve the issue.
No worries, this is not urgent at all, as the issue is mostly cosmetic. It does the write successfully at retry and there is only one data point showing up in InfluxDB as a result (no doubt because it's the same data sent twice). I just noticed it was happening and found it curious.
I'll definitely take a look at pr#11 when I get a chance to, though it may be a while, as I'll be traveling for about two weeks starting tomorrow. It's great that you are still enhancing the sketch!
Hi, this is not an issue with the sketch per se; I've been tweaking it, particularly due to a general issue I'm having that is more ESP8266-related, that after running fine for a while the device becomes unresponsive from a network perspective. This means that the loop is progressing fine, but the device can no longer be pinged and it is not able to transmit the data either.
In an effort to address this (and not miss a db write cycle) I've appended writeToDatabase() in the following way at the point where the db write attempt is made (ln376):
For context, timer() is an alternative delay function I've added:
The interesting thing is, that when influxClient.writePoint(sensor) is being called again, following WiFi.reconnect(), DB write is being executed twice (successfully) for some reason. I'll post the relevant output shortly, once it has had another unresponsive state occur.
Do you have any ideas why this double write may be happening at retry?