How to query data from InfluxDB to arduino IDE code

Hello,
I haven't been abe to google out the answer to my question, so I would appreciate your help. I am trying to query the data that I have sent to InfluxDB using another device. I have found only one source describing the proces of querying the data, but I haven't been able to make it work. This is the link to the source code that I have found online: InfluxDB-Client-for-Arduino/QueryAggregated.ino at master · tobiasschuerg/InfluxDB-Client-for-Arduino · GitHub

This is how the structure of my InfluxDB looks like:

I would like to query the data from the highlighted path.
This is the code that I am using (I have included just the loop part), but it ends up throwing QUERY RESULT ERROR: SEND HEADER FAILED.

void loop {
  String query1 = "from(bucket: \"Zavlazovaci System DB\") |> range(start: -1m) |> filter(fn: (r) => r._field == \"hladina_1_litraz\") |> ";

  // Print composed query
  Serial.print("Querying with: ");
  Serial.println(query1);

  // Send query to the server and get result
  FluxQueryResult result1 = client.query(query1);

  while (result1.next()) {
    long value1 = result1.getValues();
    Serial.print(value1);
  
    Serial.println();
    }

  if(result1.getError() != "") {
    Serial.print("Query result error: ");
    Serial.println(result1.getError());
    }

    result.close();   
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.