mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-10-14 08:35:12 +02:00
m5paper: clear-night icon for sunny hours without UV, center hourly temperature without precipitation
This commit is contained in:
1 parent
b523963944
commit
e13be73596
2 files changed
+7
-2
No files matched your search
@@ -123,6 +123,9 @@ inline bool parse(ArduinoJson::JsonObjectConst response, const char *entity, uin
|
||||
}
|
||||
Hour &hour = out.hours[out.count++];
|
||||
hour.cond = condition_code(item["condition"] | "");
|
||||
// OpenWeatherMap reports "sunny" for clear nights too; no UV means the sun is down
|
||||
if (hour.cond == condition_code("sunny") && (item["uv_index"] | 1.0f) == 0.0f)
|
||||
hour.cond = condition_code("clear-night");
|
||||
float temp = item["temperature"] | NAN;
|
||||
hour.temp2 = std::isnan(temp) ? NO_TEMP : int8_t(std::max(-127L, std::min(127L, lroundf(temp * 2))));
|
||||
float wind = item["wind_speed"] | NAN;
|
||||
|
||||
Reference in new issue
Block a user