mirror of
https://github.com/home-assistant/core.git
synced 2025-11-17 23:10:28 +00:00
Add missing device class attributes to homekit_controller sensors (#32175)
* Add some missing device class attributes to homekit_controller sensors * Add classes for binary sensors
This commit is contained in:
@@ -4,6 +4,9 @@ from aiohomekit.model.characteristics import CharacteristicsTypes
|
||||
from homeassistant.const import (
|
||||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
DEVICE_CLASS_BATTERY,
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
DEVICE_CLASS_ILLUMINANCE,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
TEMP_CELSIUS,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
@@ -31,6 +34,11 @@ class HomeKitHumiditySensor(HomeKitEntity):
|
||||
"""Define the homekit characteristics the entity is tracking."""
|
||||
return [CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT]
|
||||
|
||||
@property
|
||||
def device_class(self) -> str:
|
||||
"""Return the device class of the sensor."""
|
||||
return DEVICE_CLASS_HUMIDITY
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the device."""
|
||||
@@ -67,6 +75,11 @@ class HomeKitTemperatureSensor(HomeKitEntity):
|
||||
"""Define the homekit characteristics the entity is tracking."""
|
||||
return [CharacteristicsTypes.TEMPERATURE_CURRENT]
|
||||
|
||||
@property
|
||||
def device_class(self) -> str:
|
||||
"""Return the device class of the sensor."""
|
||||
return DEVICE_CLASS_TEMPERATURE
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the device."""
|
||||
@@ -103,6 +116,11 @@ class HomeKitLightSensor(HomeKitEntity):
|
||||
"""Define the homekit characteristics the entity is tracking."""
|
||||
return [CharacteristicsTypes.LIGHT_LEVEL_CURRENT]
|
||||
|
||||
@property
|
||||
def device_class(self) -> str:
|
||||
"""Return the device class of the sensor."""
|
||||
return DEVICE_CLASS_ILLUMINANCE
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the device."""
|
||||
|
||||
Reference in New Issue
Block a user