mirror of https://github.com/home-assistant/core
Use UNIT_UV_INDEX constant (#34055)
This commit is contained in:
parent
138470d86c
commit
44afffcfbf
|
@ -17,6 +17,7 @@ from homeassistant.const import (
|
|||
SPEED_MILES_PER_HOUR,
|
||||
TEMP_CELSIUS,
|
||||
UNIT_PERCENTAGE,
|
||||
UNIT_UV_INDEX,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
@ -72,7 +73,7 @@ SENSOR_TYPES = {
|
|||
"wind_gust": ["Wind Gust", SPEED_MILES_PER_HOUR],
|
||||
"visibility": ["Visibility", None],
|
||||
"visibility_distance": ["Visibility Distance", LENGTH_KILOMETERS],
|
||||
"uv": ["UV", None],
|
||||
"uv": ["UV", UNIT_UV_INDEX],
|
||||
"precipitation": ["Probability of Precipitation", UNIT_PERCENTAGE],
|
||||
"humidity": ["Humidity", UNIT_PERCENTAGE],
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for OpenUV sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.const import TIME_MINUTES
|
||||
from homeassistant.const import TIME_MINUTES, UNIT_UV_INDEX
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.util.dt import as_local, parse_datetime
|
||||
|
||||
|
@ -43,9 +43,9 @@ UV_LEVEL_LOW = "Low"
|
|||
|
||||
SENSORS = {
|
||||
TYPE_CURRENT_OZONE_LEVEL: ("Current Ozone Level", "mdi:vector-triangle", "du"),
|
||||
TYPE_CURRENT_UV_INDEX: ("Current UV Index", "mdi:weather-sunny", "index"),
|
||||
TYPE_CURRENT_UV_INDEX: ("Current UV Index", "mdi:weather-sunny", UNIT_UV_INDEX),
|
||||
TYPE_CURRENT_UV_LEVEL: ("Current UV Level", "mdi:weather-sunny", None),
|
||||
TYPE_MAX_UV_INDEX: ("Max UV Index", "mdi:weather-sunny", "index"),
|
||||
TYPE_MAX_UV_INDEX: ("Max UV Index", "mdi:weather-sunny", UNIT_UV_INDEX),
|
||||
TYPE_SAFE_EXPOSURE_TIME_1: (
|
||||
"Skin Type 1 Safe Exposure Time",
|
||||
"mdi:timer",
|
||||
|
|
|
@ -19,6 +19,7 @@ from homeassistant.const import (
|
|||
POWER_WATT,
|
||||
TEMP_CELSIUS,
|
||||
UNIT_PERCENTAGE,
|
||||
UNIT_UV_INDEX,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
@ -57,7 +58,7 @@ DATA_TYPES = OrderedDict(
|
|||
("Sound", ""),
|
||||
("Sensor Status", ""),
|
||||
("Counter value", ""),
|
||||
("UV", "uv"),
|
||||
("UV", UNIT_UV_INDEX),
|
||||
("Humidity status", ""),
|
||||
("Forecast", ""),
|
||||
("Forecast numeric", ""),
|
||||
|
|
|
@ -11,6 +11,7 @@ from homeassistant.const import (
|
|||
TEMP_CELSIUS,
|
||||
TIME_HOURS,
|
||||
UNIT_PERCENTAGE,
|
||||
UNIT_UV_INDEX,
|
||||
)
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
||||
|
@ -44,7 +45,7 @@ SENSOR_TYPES = {
|
|||
SENSOR_TYPE_WINDDIRECTION: ["Wind direction", "", "", None],
|
||||
SENSOR_TYPE_WINDAVERAGE: ["Wind average", SPEED_METERS_PER_SECOND, "", None],
|
||||
SENSOR_TYPE_WINDGUST: ["Wind gust", SPEED_METERS_PER_SECOND, "", None],
|
||||
SENSOR_TYPE_UV: ["UV", "UV", "", None],
|
||||
SENSOR_TYPE_UV: ["UV", UNIT_UV_INDEX, "", None],
|
||||
SENSOR_TYPE_WATT: ["Power", POWER_WATT, "", None],
|
||||
SENSOR_TYPE_LUMINANCE: ["Luminance", "lx", None, DEVICE_CLASS_ILLUMINANCE],
|
||||
SENSOR_TYPE_DEW_POINT: ["Dew Point", TEMP_CELSIUS, None, DEVICE_CLASS_TEMPERATURE],
|
||||
|
|
Loading…
Reference in New Issue