Refine
This commit is contained in:
@@ -1102,11 +1102,10 @@ def query_latest_record_by_ID(ID: str, type: str, bucket: str="realtime_simulati
|
||||
:return: dict: 最新记录的数据,如果没有找到则返回 None。
|
||||
"""
|
||||
if client.ping():
|
||||
print("{} -- Successfully connected to InfluxDB.".format(
|
||||
datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
|
||||
print("{} -- Successfully connected to InfluxDB.".format(datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
|
||||
else:
|
||||
print("{} -- Failed to connect to InfluxDB.".format(
|
||||
datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
|
||||
print("{} -- Failed to connect to InfluxDB.".format(datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
|
||||
|
||||
query_api = client.query_api()
|
||||
if type == "node":
|
||||
flux_query = f'''
|
||||
@@ -1188,7 +1187,7 @@ def query_latest_record_by_ID(ID: str, type: str, bucket: str="realtime_simulati
|
||||
return {
|
||||
"time": record["_time"],
|
||||
"device_ID": ID,
|
||||
"value": record["_value"],
|
||||
"value": record["monitored_value"],
|
||||
}
|
||||
|
||||
return None # 如果没有找到记录
|
||||
|
||||
Reference in New Issue
Block a user