Add daikin sensor state class (#60145)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
pull/60199/head
Henrik 2021-11-23 21:46:10 +01:00 committed by GitHub
parent 7c6a72b086
commit 0a0928b9f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -6,7 +6,11 @@ from dataclasses import dataclass
from pydaikin.daikin_base import Appliance
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.const import (
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_HUMIDITY,
@ -49,6 +53,7 @@ SENSOR_TYPES: tuple[DaikinSensorEntityDescription, ...] = (
key=ATTR_INSIDE_TEMPERATURE,
name="Inside Temperature",
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
native_unit_of_measurement=TEMP_CELSIUS,
value_func=lambda device: device.inside_temperature,
),
@ -56,6 +61,7 @@ SENSOR_TYPES: tuple[DaikinSensorEntityDescription, ...] = (
key=ATTR_OUTSIDE_TEMPERATURE,
name="Outside Temperature",
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
native_unit_of_measurement=TEMP_CELSIUS,
value_func=lambda device: device.outside_temperature,
),
@ -63,6 +69,7 @@ SENSOR_TYPES: tuple[DaikinSensorEntityDescription, ...] = (
key=ATTR_HUMIDITY,
name="Humidity",
device_class=DEVICE_CLASS_HUMIDITY,
state_class=STATE_CLASS_MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
value_func=lambda device: device.humidity,
),
@ -70,6 +77,7 @@ SENSOR_TYPES: tuple[DaikinSensorEntityDescription, ...] = (
key=ATTR_TARGET_HUMIDITY,
name="Target Humidity",
device_class=DEVICE_CLASS_HUMIDITY,
state_class=STATE_CLASS_MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
value_func=lambda device: device.humidity,
),