mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Fix DarkSky floating-point math (#12753)
DarkSky delivers relative humidity from 0-100% as a 0-1 decimal value, so we convert it by multiplying by 100.0. Unfortunately, due to floating point math, the display of a raw value of 0.29 ends up looking like 28.999999999999996% relative humidity. This change rounds the value to two decimal places.
This commit is contained in:
parent
8645f244da
commit
4e522448b1
@ -96,7 +96,7 @@ class DarkSkyWeather(WeatherEntity):
|
||||
@property
|
||||
def humidity(self):
|
||||
"""Return the humidity."""
|
||||
return self._ds_currently.get('humidity') * 100.0
|
||||
return round(self._ds_currently.get('humidity') * 100.0, 2)
|
||||
|
||||
@property
|
||||
def wind_speed(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user