Skip to content

Commit

Permalink
Fix ranges and trap none PM concentrations
Browse files Browse the repository at this point in the history
  • Loading branch information
djjudas21 committed Jan 19, 2024
1 parent 0340fab commit 66cea03
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions ecowitt_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,26 @@ def aqi_uk(concentration):
concentration = float(concentration)
if concentration < 12:
index = 1
elif 12 <= concentration <= 23:
elif 12 <= concentration < 24:
index = 2
elif 24 <= concentration <= 35:
elif 24 <= concentration < 36:
index = 3
elif 36 <= concentration <= 41:
elif 36 <= concentration < 42:
index = 4
elif 42 <= concentration <= 47:
elif 42 <= concentration < 48:
index = 5
elif 48 <= concentration <= 53:
elif 48 <= concentration < 54:
index = 6
elif 54 <= concentration <= 58:
elif 54 <= concentration < 59:
index = 7
elif 59 <= concentration <= 64:
elif 59 <= concentration < 65:
index = 8
elif 65 <= concentration <= 70:
elif 65 <= concentration < 71:
index = 9
elif concentration > 70:
elif concentration >= 71:
index = 10
else:
index = None
return index

def aqi_nepm(concentration):
Expand Down

0 comments on commit 66cea03

Please sign in to comment.