Correct thunderstorm detection
This commit is contained in:
1 parent
8447a85ff0
commit
62ed14e334
2 files changed
+11
-2
No files matched your search
+4
-2
@@ -17,9 +17,11 @@ def classify_weather(rain_level, thunder_level):
|
||||
"""Map protocol weather levels to a concise UI-friendly state."""
|
||||
if rain_level is None and thunder_level is None:
|
||||
return None
|
||||
if thunder_level is not None and thunder_level > 0:
|
||||
raining = rain_level is not None and rain_level > 0
|
||||
thundering = thunder_level is not None and thunder_level > 0
|
||||
if raining and thundering:
|
||||
return 'thunderstorm'
|
||||
if rain_level is not None and rain_level > 0:
|
||||
if raining:
|
||||
return 'rain'
|
||||
return 'clear'
|
||||
|
||||
|
||||
Reference in new issue
Block a user