Compare commits
1 Commits
064784c483
...
74636af386
| Author | SHA1 | Date |
|---|---|---|
|
|
74636af386 |
|
|
@ -218,22 +218,15 @@ def celsius_to_fahrenheit(celsius: float) -> float:
|
|||
return celsius * 9.0 / 5.0 + 32
|
||||
|
||||
|
||||
def heat_index(data: Any, convert: bool = False) -> float | None:
|
||||
def heat_index(data: Any, convert: bool = False) -> float:
|
||||
"""Calculate heat index from temperature.
|
||||
|
||||
data: dict with temperature and humidity
|
||||
convert: bool, convert recieved data from Celsius to Fahrenheit
|
||||
"""
|
||||
|
||||
temp = data.get(OUTSIDE_TEMP, None)
|
||||
rh = data.get(OUTSIDE_HUMIDITY, None)
|
||||
|
||||
if not temp or not rh:
|
||||
return None
|
||||
|
||||
temp = float(temp)
|
||||
rh = float(rh)
|
||||
|
||||
temp = float(data[OUTSIDE_TEMP])
|
||||
rh = float(data[OUTSIDE_HUMIDITY])
|
||||
adjustment = None
|
||||
|
||||
if convert:
|
||||
|
|
@ -263,21 +256,15 @@ def heat_index(data: Any, convert: bool = False) -> float | None:
|
|||
return simple
|
||||
|
||||
|
||||
def chill_index(data: Any, convert: bool = False) -> float | None:
|
||||
def chill_index(data: Any, convert: bool = False) -> float:
|
||||
"""Calculate wind chill index from temperature and wind speed.
|
||||
|
||||
data: dict with temperature and wind speed
|
||||
convert: bool, convert recieved data from Celsius to Fahrenheit
|
||||
"""
|
||||
|
||||
temp = data.get(OUTSIDE_TEMP, None)
|
||||
wind = data.get(WIND_SPEED, None)
|
||||
|
||||
if not temp or not wind:
|
||||
return None
|
||||
|
||||
temp = float(temp)
|
||||
wind = float(wind)
|
||||
temp = float(data[OUTSIDE_TEMP])
|
||||
wind = float(data[WIND_SPEED])
|
||||
|
||||
if convert:
|
||||
temp = celsius_to_fahrenheit(temp)
|
||||
|
|
|
|||
Loading…
Reference in New Issue