Add and use percentage constant (#32094)
* Add and use percentage constant * Fix pylint error and broken test
This commit is contained in:
1 parent
c7f128f286
commit
f1a0ca7cd3
155 files changed
+735
-459
No files matched your search
@@ -26,6 +26,7 @@ from homeassistant.const import (
|
||||
SPEED_MILES_PER_HOUR,
|
||||
TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT,
|
||||
UNIT_PERCENTAGE,
|
||||
)
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
@@ -416,7 +417,7 @@ SENSOR_TYPES = {
|
||||
"Relative Humidity",
|
||||
"conditions",
|
||||
value=lambda wu: int(wu.data["current_observation"]["relative_humidity"][:-1]),
|
||||
unit_of_measurement="%",
|
||||
unit_of_measurement=UNIT_PERCENTAGE,
|
||||
icon="mdi:water-percent",
|
||||
device_class="humidity",
|
||||
),
|
||||
@@ -916,16 +917,36 @@ SENSOR_TYPES = {
|
||||
"mdi:umbrella",
|
||||
),
|
||||
"precip_1d": WUDailySimpleForecastSensorConfig(
|
||||
"Precipitation Probability Today", 0, "pop", None, "%", "mdi:umbrella"
|
||||
"Precipitation Probability Today",
|
||||
0,
|
||||
"pop",
|
||||
None,
|
||||
UNIT_PERCENTAGE,
|
||||
"mdi:umbrella",
|
||||
),
|
||||
"precip_2d": WUDailySimpleForecastSensorConfig(
|
||||
"Precipitation Probability Tomorrow", 1, "pop", None, "%", "mdi:umbrella"
|
||||
"Precipitation Probability Tomorrow",
|
||||
1,
|
||||
"pop",
|
||||
None,
|
||||
UNIT_PERCENTAGE,
|
||||
"mdi:umbrella",
|
||||
),
|
||||
"precip_3d": WUDailySimpleForecastSensorConfig(
|
||||
"Precipitation Probability in 3 Days", 2, "pop", None, "%", "mdi:umbrella"
|
||||
"Precipitation Probability in 3 Days",
|
||||
2,
|
||||
"pop",
|
||||
None,
|
||||
UNIT_PERCENTAGE,
|
||||
"mdi:umbrella",
|
||||
),
|
||||
"precip_4d": WUDailySimpleForecastSensorConfig(
|
||||
"Precipitation Probability in 4 Days", 3, "pop", None, "%", "mdi:umbrella"
|
||||
"Precipitation Probability in 4 Days",
|
||||
3,
|
||||
"pop",
|
||||
None,
|
||||
UNIT_PERCENTAGE,
|
||||
"mdi:umbrella",
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user