mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Xiaomi: Weather fixes and Implement wind and AQI
Many fields were incorrectly being sent as uint32 instead of sint32. This caused issues with forecast icons.
This commit is contained in:
parent
cb7121a32e
commit
372aa88e6e
@ -111,13 +111,13 @@ public class XiaomiWeatherService extends AbstractXiaomiService {
|
||||
.setHumidity(weatherSpec.currentHumidity)
|
||||
.setSymbol("%")
|
||||
)
|
||||
.setUnk5(XiaomiProto.WeatherCurrentUnk5.newBuilder()
|
||||
.setUnk1("")
|
||||
.setUnk2(0)
|
||||
.setWind(XiaomiProto.WeatherCurrentWind.newBuilder()
|
||||
.setWind(weatherSpec.windSpeedAsBeaufort())
|
||||
.setSymbol("")
|
||||
)
|
||||
.setUnk6(XiaomiProto.WeatherCurrentUnk6.newBuilder()
|
||||
.setUv(XiaomiProto.WeatherCurrentUVIndex.newBuilder()
|
||||
.setUnk1("")
|
||||
.setUnk2(0)
|
||||
.setIndex(Math.round(weatherSpec.uvIndex)) // This is sent as an sint but seems to be displayed with a decimal point
|
||||
)
|
||||
.setAQI(XiaomiProto.WeatherCurrentAQI.newBuilder()
|
||||
.setAQIText("Unknown") // some string like "Moderate"
|
||||
@ -139,10 +139,12 @@ public class XiaomiWeatherService extends AbstractXiaomiService {
|
||||
XiaomiProto.WeatherDailyList.Builder dailyListBuilder = XiaomiProto.WeatherDailyList.newBuilder();
|
||||
int daysToSend = Math.min(7, weatherSpec.forecasts.size());
|
||||
for (int i = 0; i < daysToSend; i++) {
|
||||
WeatherSpec.AirQuality airQuality = weatherSpec.forecasts.get(i).airQuality;
|
||||
|
||||
dailyListBuilder.addForecastDay(XiaomiProto.WeatherDailyForecastDay.newBuilder()
|
||||
.setUnk1(XiaomiProto.DailyUnk1.newBuilder()
|
||||
.setUnk1("")
|
||||
.setUnk2(0)
|
||||
.setAQI(XiaomiProto.DailyAQI.newBuilder()
|
||||
.setAQIText("")
|
||||
.setAQI(airQuality != null && airQuality.aqi >= 0 ? airQuality.aqi : 0)
|
||||
)
|
||||
.setUnk2(XiaomiProto.DailyUnk2.newBuilder()
|
||||
.setUnk1(HuamiWeatherConditions.mapToAmazfitBipWeatherCode(weatherSpec.forecasts.get(i).conditionCode)) // TODO: verify
|
||||
|
@ -752,8 +752,8 @@ message WeatherCurrent {
|
||||
optional uint32 weatherCondition = 2;
|
||||
optional WeatherCurrentTemperature temperature = 3;
|
||||
optional WeatherCurrentHumidity humidity= 4;
|
||||
optional WeatherCurrentUnk5 unk5 = 5;
|
||||
optional WeatherCurrentUnk6 unk6 = 6;
|
||||
optional WeatherCurrentWind wind = 5;
|
||||
optional WeatherCurrentUVIndex uv = 6;
|
||||
optional WeatherCurrentAQI AQI = 7;
|
||||
optional WeatherCurrentWarning warning = 8; // Seems to be an array?
|
||||
optional float pressure = 9;
|
||||
@ -776,14 +776,14 @@ message WeatherCurrentHumidity {
|
||||
optional sint32 humidity = 2;
|
||||
}
|
||||
|
||||
message WeatherCurrentUnk5 {
|
||||
optional string unk1 = 1;
|
||||
optional uint32 unk2 = 2;
|
||||
message WeatherCurrentWind {
|
||||
optional string symbol = 1;
|
||||
optional sint32 wind = 2;
|
||||
}
|
||||
|
||||
message WeatherCurrentUnk6 {
|
||||
message WeatherCurrentUVIndex {
|
||||
optional string unk1 = 1;
|
||||
optional uint32 unk2 = 2;
|
||||
optional sint32 index = 2;
|
||||
}
|
||||
|
||||
message WeatherCurrentAQI {
|
||||
@ -817,21 +817,21 @@ message WeatherDailyList {
|
||||
}
|
||||
|
||||
message WeatherDailyForecastDay {
|
||||
optional DailyUnk1 unk1 = 1;
|
||||
optional DailyAQI AQI = 1;
|
||||
optional DailyUnk2 unk2 = 2;
|
||||
optional DailyHighLowTemp highLowTemp = 3;
|
||||
optional string temperatureSymbol = 4;
|
||||
optional DailySunriseSunset sunriseSunset = 5;
|
||||
}
|
||||
|
||||
message DailyUnk1 {
|
||||
optional string unk1 = 1;
|
||||
optional uint32 unk2 = 2;
|
||||
message DailyAQI {
|
||||
optional string AQIText = 1;
|
||||
optional sint32 AQI = 2;
|
||||
}
|
||||
|
||||
message DailyUnk2 {
|
||||
optional uint32 unk1 = 1;
|
||||
optional uint32 unk2 = 2;
|
||||
optional sint32 unk1 = 1;
|
||||
optional sint32 unk2 = 2;
|
||||
}
|
||||
|
||||
message DailyHighLowTemp {
|
||||
|
Loading…
Reference in New Issue
Block a user