diff --git a/dbSqlite.h b/dbSqlite.h index 679b3d15c8ffd30a4cfd0c0fe453fe2b8d3df0f1..3812e38a53b6419afc1dbfb7573fe47d3ad14a1b 100644 --- a/dbSqlite.h +++ b/dbSqlite.h @@ -118,7 +118,7 @@ public: string queryResult; influxdb_cpp::server_info si(this->getSettings().influx_host, this->getSettings().influx_port, this->getSettings().influx_db, this->getSettings().influx_user, this->getSettings().influx_pass); - influxdb_cpp::query(queryResult, "SELECT * FROM Sensors WHERE client = '" + node + "' AND sensor = '" + sensor + "' AND time > now() - 5m;", si); + influxdb_cpp::query(queryResult, "SELECT * FROM Sensors WHERE client = '" + node + "' AND sensor = '" + sensor + "' ORDER BY time DESC LIMIT 1;", si); auto response = nlohmann::json::parse(queryResult);