Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new DeviceClass and StateClass enums in daikin #61340

Merged
merged 1 commit into from Dec 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 13 additions & 16 deletions homeassistant/components/daikin/sensor.py
Expand Up @@ -7,15 +7,12 @@
from pydaikin.daikin_base import Appliance

from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.const import (
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_POWER,
DEVICE_CLASS_TEMPERATURE,
ENERGY_KILO_WATT_HOUR,
FREQUENCY_HERTZ,
PERCENTAGE,
Expand Down Expand Up @@ -52,55 +49,55 @@ class DaikinSensorEntityDescription(SensorEntityDescription, DaikinRequiredKeysM
DaikinSensorEntityDescription(
key=ATTR_INSIDE_TEMPERATURE,
name="Inside Temperature",
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=TEMP_CELSIUS,
value_func=lambda device: device.inside_temperature,
),
DaikinSensorEntityDescription(
key=ATTR_OUTSIDE_TEMPERATURE,
name="Outside Temperature",
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=TEMP_CELSIUS,
value_func=lambda device: device.outside_temperature,
),
DaikinSensorEntityDescription(
key=ATTR_HUMIDITY,
name="Humidity",
device_class=DEVICE_CLASS_HUMIDITY,
state_class=STATE_CLASS_MEASUREMENT,
device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
value_func=lambda device: device.humidity,
),
DaikinSensorEntityDescription(
key=ATTR_TARGET_HUMIDITY,
name="Target Humidity",
device_class=DEVICE_CLASS_HUMIDITY,
state_class=STATE_CLASS_MEASUREMENT,
device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
value_func=lambda device: device.humidity,
),
DaikinSensorEntityDescription(
key=ATTR_TOTAL_POWER,
name="Total Power Consumption",
device_class=DEVICE_CLASS_POWER,
device_class=SensorDeviceClass.POWER,
native_unit_of_measurement=POWER_KILO_WATT,
value_func=lambda device: round(device.current_total_power_consumption, 2),
),
DaikinSensorEntityDescription(
key=ATTR_COOL_ENERGY,
name="Cool Energy Consumption",
icon="mdi:snowflake",
device_class=DEVICE_CLASS_ENERGY,
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
value_func=lambda device: round(device.last_hour_cool_energy_consumption, 2),
),
DaikinSensorEntityDescription(
key=ATTR_HEAT_ENERGY,
name="Heat Energy Consumption",
icon="mdi:fire",
device_class=DEVICE_CLASS_ENERGY,
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
value_func=lambda device: round(device.last_hour_heat_energy_consumption, 2),
),
Expand Down