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:
Jc2k
2020-02-25 20:43:14 +00:00
committed by GitHub
parent 24652d82ab
commit dd13e99967
4 changed files with 52 additions and 2 deletions

View File

@@ -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."""