kalkih / simple-weather-card

Minimalistic weather card for Home Assistant
MIT License
283 stars 33 forks source link

Wrong Extrema calculation #40

Closed smmoroz closed 3 years ago

smmoroz commented 4 years ago

Hi!

Extrema (high and low temperatures) is computed using just forecast[0]. But in many cases forecast[0] is just night, while forecast[1] is day. In this case high = forecast[1].temperature and low =forecast[0].templow.

I would suggest a more general way:

high = max of forecast[i].temperature low = low of forecast[i].templow

Thanks for your great work!

gonzotek commented 4 years ago

Agree with smmoroz on the suggested general approach.

I would also like to note that at least with the Dark Sky weather platform (which is admittedly due for deprecation eventually), forecast can be the next X hours (not days), and there is no templow shown in the entity attributes. Perhaps the algorithm could be further improved by checking for a templow, and if non-existant, optionally using the min of forecast[i].temperature instead?