mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Garmin: send current air quality with hourly forecasts over HTTP
This commit is contained in:
committed by
José Rebelo
parent
bbfaa34976
commit
57a821a8dd
+20
-1
@@ -236,7 +236,7 @@ public class WeatherHandler {
|
||||
//feelsLikeTemperature = new WeatherValue(hourlyForecast.temp - 273f, "CELSIUS"); // TODO feelsLikeTemperature
|
||||
//visibility = new WeatherValue(0, "METER"); // TODO visibility
|
||||
//pressure = new WeatherValue(0f, "INCHES_OF_MERCURY"); // TODO pressure
|
||||
//airQuality = null; // TODO airQuality
|
||||
airQuality = mapAqiToGarminAirQuality(Weather.getInstance().getWeatherSpec().airQuality.aqi); // TODO: replace with better way to get current weather
|
||||
//cloudCover = 0; // TODO cloudCover
|
||||
}
|
||||
}
|
||||
@@ -348,6 +348,25 @@ public class WeatherHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static Integer mapAqiToGarminAirQuality(int aqi) { //see https://github.com/breezy-weather/breezy-weather/blob/main/app/src/main/java/org/breezyweather/domain/weather/index/PollutantIndex.kt#L38
|
||||
if (aqi == -1) {
|
||||
return null; // Unknown (--)
|
||||
}
|
||||
if (aqi < 20) {
|
||||
return 0; // Good
|
||||
} else if (aqi < 50) {
|
||||
return 1; // Moderate
|
||||
} else if (aqi < 100) {
|
||||
return 2; // Unhealthy Sensitive
|
||||
} else if (aqi < 150) {
|
||||
return 3; // Unhealthy
|
||||
} else if (aqi < 250) {
|
||||
return 4; // Very Unhealthy
|
||||
} else {
|
||||
return 5; // Hazardous
|
||||
}
|
||||
}
|
||||
|
||||
public static int mapToGarminCondition(final int openWeatherMapCondition) {
|
||||
// Icons mapped from a Venu 3:
|
||||
// 0 1 2 unk
|
||||
|
||||
Reference in New Issue
Block a user