fixed
This commit is contained in:
parent
49d1e50bc6
commit
a39bee3350
13
xumu.py
13
xumu.py
|
@ -339,7 +339,18 @@ async def past_seven_days(deviceId):
|
|||
current_date = datetime.now().date()
|
||||
tomorrow = current_date + timedelta(days=1)
|
||||
past_6_days_date = current_date - timedelta(days=6)
|
||||
sql = f"select MAX_VALUE(value) from root.warning.{deviceId} group by ([{past_6_days_date}, {tomorrow}), 1d)"
|
||||
the_decvice = await get_device(None, deviceId)
|
||||
device_type = None
|
||||
if the_decvice.code == 200:
|
||||
device_values = the_decvice.data["values"]
|
||||
if len(device_values) != 0:
|
||||
device_type = device_values[1][0]
|
||||
# 如果是空气设备,则有两个值
|
||||
if device_type == 1:
|
||||
sql = f"select MAX_VALUE(air_temperature),MAX_VALUE(air_humidity) from root.warning.{deviceId} group by ([{past_6_days_date}, {tomorrow}), 1d)"
|
||||
# 如果是其他设备,则有一个值,RFID不算
|
||||
else:
|
||||
sql = f"select MAX_VALUE(value) from root.warning.{deviceId} group by ([{past_6_days_date}, {tomorrow}), 1d)"
|
||||
send_json = {
|
||||
"sql": sql
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue