Zepp OS: Make weather v5 non-experimental

This commit is contained in:
José Rebelo
2026-01-26 20:16:29 +00:00
parent 70df3dc8c3
commit 0a81a2555e
3 changed files with 5 additions and 22 deletions
@@ -164,16 +164,7 @@ public class ZeppOsHttpService extends AbstractZeppOsService {
if (path.startsWith("/weather/")) {
if (path.startsWith("/weather/v5/")) {
statusCode = 200;
final boolean experimentalWeatherV5 = getSupport().getCoordinator().experimentalSettingEnabled(
getSupport().getDevice(),
"zepp_os_experimental_weather_v5"
);
if (experimentalWeatherV5) {
response = ZeppOsWeatherHandlerV5.handleHttpRequest(path, query);
} else {
LOG.warn("Experimental weather v5 is disabled, ignoring request");
response = null;
}
response = ZeppOsWeatherHandlerV5.handleHttpRequest(path, query);
} else if (weatherHandler != null) {
final ZeppOsWeatherHandler.Response weatherResponse = weatherHandler.handleHttpRequest(path, query);
statusCode = weatherResponse.getHttpStatusCode();
@@ -108,7 +108,7 @@ object ZeppOsWeatherHandlerV5 {
conditionCode = ZeppOsWeatherHandler.mapToZeppOsWeatherCode(it.conditionCode).toString(),
humidity = it.humidity / 100.0f,
pressure = weatherSpec.pressure, // TODO WeatherSpec does not support hourly pressure
temperature = it.temp - 273.15f,
temperature = it.temp - 273f,
uvIndex = it.uvIndex.roundToInt(),
visibility = weatherSpec.visibility, // TODO WeatherSpec does not support hourly visibility
windDirection = it.windDirection,
@@ -155,7 +155,7 @@ object ZeppOsWeatherHandlerV5 {
calendar.setTime(Date(dayTimestamp))
val sunrise = WeatherSpec.sunriseComputed(day.sunRise, calendar, weatherSpec.getLocationObject())
val sunset = WeatherSpec.sunsetComputed(day.sunRise, calendar, weatherSpec.getLocationObject())
val sunset = WeatherSpec.sunsetComputed(day.sunSet, calendar, weatherSpec.getLocationObject())
val daytimeForecastStart: Date
val daytimeForecastEnd: Date
@@ -188,8 +188,8 @@ object ZeppOsWeatherHandlerV5 {
moonset = if (day.moonSet > 0) toOffsetDateTime(Date(day.moonSet * 1000L)) else null,
sunrise = sunrise?.let { toOffsetDateTime(it) },
sunset = sunset?.let { toOffsetDateTime(it) },
temperatureMax = day.maxTemp - 273.15f,
temperatureMin = day.minTemp - 273.15f,
temperatureMax = day.maxTemp - 273f,
temperatureMin = day.minTemp - 273f,
daytimeForecast = DayPartForecast(
forecastStart = toOffsetDateTime(daytimeForecastStart),
forecastEnd = toOffsetDateTime(daytimeForecastEnd),
@@ -15,12 +15,4 @@
android:layout="@layout/preference_checkbox"
android:summary="Enable Alexa / Zepp Flow manual debug options and voice receiving. Not yet functional."
android:title="Assistant service" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:icon="@drawable/ic_wb_sunny"
android:key="zepp_os_experimental_weather_v5"
android:layout="@layout/preference_checkbox"
android:summary="Not tested. See Codeberg issue #5653"
android:title="Weather v5" />
</androidx.preference.PreferenceScreen>