Use SoundPressure unit and device class in point (#83580)

This commit is contained in:
epenet 2022-12-08 20:57:38 +01:00 committed by GitHub
parent 5d71afef85
commit 0edcb26844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,7 @@ from homeassistant.components.sensor import (
SensorEntityDescription, SensorEntityDescription,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import PERCENTAGE, SOUND_PRESSURE_WEIGHTED_DBA, TEMP_CELSIUS from homeassistant.const import PERCENTAGE, UnitOfSoundPressure, UnitOfTemperature
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -42,7 +42,7 @@ SENSOR_TYPES: tuple[MinutPointSensorEntityDescription, ...] = (
key="temperature", key="temperature",
precision=1, precision=1,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
), ),
MinutPointSensorEntityDescription( MinutPointSensorEntityDescription(
key="humidity", key="humidity",
@ -53,8 +53,8 @@ SENSOR_TYPES: tuple[MinutPointSensorEntityDescription, ...] = (
MinutPointSensorEntityDescription( MinutPointSensorEntityDescription(
key="sound", key="sound",
precision=1, precision=1,
icon="mdi:ear-hearing", device_class=SensorDeviceClass.SOUND_PRESSURE,
native_unit_of_measurement=SOUND_PRESSURE_WEIGHTED_DBA, native_unit_of_measurement=UnitOfSoundPressure.WEIGHTED_DECIBEL_A,
), ),
) )