Fix weather module when no air_quality available
This commit is contained in:
parent
4fb1f7f08f
commit
960c1592cd
@ -224,12 +224,15 @@ class WeatherRainModule:
|
|||||||
elif thisdayweather["avgvis_km"] < 10:
|
elif thisdayweather["avgvis_km"] < 10:
|
||||||
gauge.add('Visibilité', [{'value': thisdayweather["avgvis_km"] * 10, 'color': '#999'}])
|
gauge.add('Visibilité', [{'value': thisdayweather["avgvis_km"] * 10, 'color': '#999'}])
|
||||||
icon_path = "wi-fog.png"
|
icon_path = "wi-fog.png"
|
||||||
else:
|
elif "air_quality" in thisdayweather:
|
||||||
gauge.add("Qualité de l'air", [{'value': thisdayweather["air_quality"]["gb-defra-index"] * 10}])
|
gauge.add("Qualité de l'air", [{'value': thisdayweather["air_quality"]["gb-defra-index"] * 10}])
|
||||||
if thisdayweather["air_quality"]["gb-defra-index"] >= 5:
|
if thisdayweather["air_quality"]["gb-defra-index"] >= 5:
|
||||||
icon_path = "wi-smog.png"
|
icon_path = "wi-smog.png"
|
||||||
else:
|
else:
|
||||||
icon_path = "wi-smoke.png"
|
icon_path = "wi-smoke.png"
|
||||||
|
else:
|
||||||
|
gauge.add('Vent', [{'value': thisdayweather["maxwind_kph"], 'color': '#999'}])
|
||||||
|
icon_path = "wi-wind-beaufort-1.png"
|
||||||
|
|
||||||
image = Image.open(io.BytesIO(gauge.render_to_png()))
|
image = Image.open(io.BytesIO(gauge.render_to_png()))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user