diff --git a/homeassistant/components/metoffice/sensor.py b/homeassistant/components/metoffice/sensor.py index 0682c458792f..678d02d9d836 100644 --- a/homeassistant/components/metoffice/sensor.py +++ b/homeassistant/components/metoffice/sensor.py @@ -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], } diff --git a/homeassistant/components/openuv/sensor.py b/homeassistant/components/openuv/sensor.py index 0d4a8b73a087..162fac50c6c4 100644 --- a/homeassistant/components/openuv/sensor.py +++ b/homeassistant/components/openuv/sensor.py @@ -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", diff --git a/homeassistant/components/rfxtrx/__init__.py b/homeassistant/components/rfxtrx/__init__.py index 39cbde08c013..b37ad8c15a83 100644 --- a/homeassistant/components/rfxtrx/__init__.py +++ b/homeassistant/components/rfxtrx/__init__.py @@ -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", ""), diff --git a/homeassistant/components/tellduslive/sensor.py b/homeassistant/components/tellduslive/sensor.py index 472c430da163..693616ab78ce 100644 --- a/homeassistant/components/tellduslive/sensor.py +++ b/homeassistant/components/tellduslive/sensor.py @@ -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],