kalkih / simple-weather-card

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

Adding math round to 2decimals for precipation #46

Closed rsurgiewicz closed 3 years ago

rsurgiewicz commented 3 years ago

Hi there,

It's a fix for the case when weather provider format precipitation is strage/long. That impacts card rendering, actually the way precipitation format is not really elegant then.

It covers the issue https://github.com/kalkih/simple-weather-card/issues/42

example:

humidity: 79
pressure: 993.2
wind_bearing: 156.1
wind_speed: 28.8
attribution: >-
  Weather forecast from met.no, delivered by the Norwegian Meteorological
  Institute.
forecast:
  - datetime: '2020-12-29T12:00:00+01:00'
    condition: rainy
    pressure: 991.8
    humidity: 92.6
    wind_bearing: 228.9
    temperature: 5.2
    templow: 2.9
    precipitation: 21.300000000000008

Then it's displayed as precipitation: 21.3 image

kalkih commented 3 years ago

Thank you, looks good!