This commit is contained in:
xyj 2024-02-05 11:34:37 +08:00
parent 4a06a653d6
commit a0af0c1ab1
1 changed files with 16 additions and 7 deletions

View File

@ -83,34 +83,43 @@ def rfid_deviceId(rfid, deviceId):
]
temperature_threshold = [37, 41]
air_temperature_threshold = [0, 40]
air_humidity_threshold = [30, 80]
danqi_threshold = [1.24]
jiawan_threshold = [3000]
zaoyin_threshold = [55]
yanwu_threshold = [200]
def is_warning(deviceId, v, t):
match t:
case 0:
temperature = v[1]
if 41.0 <= temperature or temperature <= 37.0:
if temperature_threshold[1] <= temperature or temperature <= temperature_threshold[0]:
return True
case 1:
air_temperature = v[1]
air_humidity = v[2]
if 40.0 <= air_temperature or air_temperature <= 0:
if air_temperature_threshold[1] <= air_temperature or air_temperature <= air_temperature_threshold[0]:
return True
if 80.0 <= air_humidity or air_humidity <= 30.0:
if air_humidity_threshold[1] <= air_humidity or air_humidity <= air_humidity_threshold[0]:
return True
case 2:
danqi = v[1]
if danqi >= 1.24:
if danqi >= danqi_threshold[0]:
return True
case 3:
jiawan = v[1]
if jiawan > 3000:
if jiawan > jiawan_threshold[0]:
return True
case 4:
zaoyin = v[1]
if zaoyin >= 55:
if zaoyin >= zaoyin_threshold[0]:
return True
case 5:
yanwu = v[1]
if yanwu >= 200:
if yanwu >= yanwu_threshold[0]:
return True
return False