Add long-term statistics for OpenUV sensors (#55417)
parent
b634bd26d0
commit
1a47fcc4e3
|
@ -1,9 +1,13 @@
|
|||
"""Support for OpenUV sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
|
||||
from homeassistant.components.sensor import (
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
SensorEntity,
|
||||
SensorEntityDescription,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import TIME_MINUTES, UV_INDEX
|
||||
from homeassistant.const import DEVICE_CLASS_OZONE, TIME_MINUTES, UV_INDEX
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.util.dt import as_local, parse_datetime
|
||||
|
@ -46,14 +50,16 @@ SENSOR_DESCRIPTIONS = (
|
|||
SensorEntityDescription(
|
||||
key=TYPE_CURRENT_OZONE_LEVEL,
|
||||
name="Current Ozone Level",
|
||||
icon="mdi:vector-triangle",
|
||||
device_class=DEVICE_CLASS_OZONE,
|
||||
native_unit_of_measurement="du",
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=TYPE_CURRENT_UV_INDEX,
|
||||
name="Current UV Index",
|
||||
icon="mdi:weather-sunny",
|
||||
native_unit_of_measurement=UV_INDEX,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=TYPE_CURRENT_UV_LEVEL,
|
||||
|
@ -65,42 +71,49 @@ SENSOR_DESCRIPTIONS = (
|
|||
name="Max UV Index",
|
||||
icon="mdi:weather-sunny",
|
||||
native_unit_of_measurement=UV_INDEX,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=TYPE_SAFE_EXPOSURE_TIME_1,
|
||||
name="Skin Type 1 Safe Exposure Time",
|
||||
icon="mdi:timer-outline",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=TYPE_SAFE_EXPOSURE_TIME_2,
|
||||
name="Skin Type 2 Safe Exposure Time",
|
||||
icon="mdi:timer-outline",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=TYPE_SAFE_EXPOSURE_TIME_3,
|
||||
name="Skin Type 3 Safe Exposure Time",
|
||||
icon="mdi:timer-outline",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=TYPE_SAFE_EXPOSURE_TIME_4,
|
||||
name="Skin Type 4 Safe Exposure Time",
|
||||
icon="mdi:timer-outline",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=TYPE_SAFE_EXPOSURE_TIME_5,
|
||||
name="Skin Type 5 Safe Exposure Time",
|
||||
icon="mdi:timer-outline",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=TYPE_SAFE_EXPOSURE_TIME_6,
|
||||
name="Skin Type 6 Safe Exposure Time",
|
||||
icon="mdi:timer-outline",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue