mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 01:38:02 +00:00
Fix Hue overriding property methods, remove ignored typing (#50976)
This commit is contained in:
parent
caad125b44
commit
0cbcb9e0d6
@ -27,7 +27,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||||||
class HuePresence(GenericZLLSensor, BinarySensorEntity):
|
class HuePresence(GenericZLLSensor, BinarySensorEntity):
|
||||||
"""The presence sensor entity for a Hue motion sensor device."""
|
"""The presence sensor entity for a Hue motion sensor device."""
|
||||||
|
|
||||||
device_class = DEVICE_CLASS_MOTION
|
_attr_device_class = DEVICE_CLASS_MOTION
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
|
@ -41,8 +41,8 @@ class GenericHueGaugeSensorEntity(GenericZLLSensor, SensorEntity):
|
|||||||
class HueLightLevel(GenericHueGaugeSensorEntity):
|
class HueLightLevel(GenericHueGaugeSensorEntity):
|
||||||
"""The light level sensor entity for a Hue motion sensor device."""
|
"""The light level sensor entity for a Hue motion sensor device."""
|
||||||
|
|
||||||
device_class = DEVICE_CLASS_ILLUMINANCE
|
_attr_device_class = DEVICE_CLASS_ILLUMINANCE
|
||||||
unit_of_measurement = LIGHT_LUX
|
_attr_unit_of_measurement = LIGHT_LUX
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
@ -76,8 +76,9 @@ class HueLightLevel(GenericHueGaugeSensorEntity):
|
|||||||
class HueTemperature(GenericHueGaugeSensorEntity):
|
class HueTemperature(GenericHueGaugeSensorEntity):
|
||||||
"""The temperature sensor entity for a Hue motion sensor device."""
|
"""The temperature sensor entity for a Hue motion sensor device."""
|
||||||
|
|
||||||
device_class = DEVICE_CLASS_TEMPERATURE
|
_attr_device_class = DEVICE_CLASS_TEMPERATURE
|
||||||
unit_of_measurement = TEMP_CELSIUS
|
_attr_state_class = STATE_CLASS_MEASUREMENT
|
||||||
|
_attr_unit_of_measurement = TEMP_CELSIUS
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
@ -87,15 +88,13 @@ class HueTemperature(GenericHueGaugeSensorEntity):
|
|||||||
|
|
||||||
return self.sensor.temperature / 100
|
return self.sensor.temperature / 100
|
||||||
|
|
||||||
@property
|
|
||||||
def state_class(self):
|
|
||||||
"""Return the state class of the sensor."""
|
|
||||||
return STATE_CLASS_MEASUREMENT
|
|
||||||
|
|
||||||
|
|
||||||
class HueBattery(GenericHueSensor, SensorEntity):
|
class HueBattery(GenericHueSensor, SensorEntity):
|
||||||
"""Battery class for when a batt-powered device is only represented as an event."""
|
"""Battery class for when a batt-powered device is only represented as an event."""
|
||||||
|
|
||||||
|
_attr_device_class = DEVICE_CLASS_BATTERY
|
||||||
|
_attr_unit_of_measurement = PERCENTAGE
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
"""Return a unique identifier for this device."""
|
"""Return a unique identifier for this device."""
|
||||||
@ -106,16 +105,6 @@ class HueBattery(GenericHueSensor, SensorEntity):
|
|||||||
"""Return the state of the battery."""
|
"""Return the state of the battery."""
|
||||||
return self.sensor.battery
|
return self.sensor.battery
|
||||||
|
|
||||||
@property
|
|
||||||
def device_class(self):
|
|
||||||
"""Return the class of the sensor."""
|
|
||||||
return DEVICE_CLASS_BATTERY
|
|
||||||
|
|
||||||
@property
|
|
||||||
def unit_of_measurement(self):
|
|
||||||
"""Return the unit of measurement of this entity."""
|
|
||||||
return PERCENTAGE
|
|
||||||
|
|
||||||
|
|
||||||
SENSOR_CONFIG_MAP.update(
|
SENSOR_CONFIG_MAP.update(
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
"""Support for the Philips Hue sensors as a platform."""
|
"""Support for the Philips Hue sensors as a platform."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from aiohue import AiohueException, Unauthorized
|
from aiohue import AiohueException, Unauthorized
|
||||||
from aiohue.sensors import TYPE_ZLL_PRESENCE
|
from aiohue.sensors import TYPE_ZLL_PRESENCE
|
||||||
@ -16,7 +19,7 @@ from .helpers import remove_devices
|
|||||||
from .hue_event import EVENT_CONFIG_MAP
|
from .hue_event import EVENT_CONFIG_MAP
|
||||||
from .sensor_device import GenericHueDevice
|
from .sensor_device import GenericHueDevice
|
||||||
|
|
||||||
SENSOR_CONFIG_MAP = {}
|
SENSOR_CONFIG_MAP: dict[str, Any] = {}
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
3
mypy.ini
3
mypy.ini
@ -1012,9 +1012,6 @@ ignore_errors = true
|
|||||||
[mypy-homeassistant.components.honeywell.*]
|
[mypy-homeassistant.components.honeywell.*]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
[mypy-homeassistant.components.hue.*]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.huisbaasje.*]
|
[mypy-homeassistant.components.huisbaasje.*]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
|
@ -91,7 +91,6 @@ IGNORED_MODULES: Final[list[str]] = [
|
|||||||
"homeassistant.components.homekit_controller.*",
|
"homeassistant.components.homekit_controller.*",
|
||||||
"homeassistant.components.homematicip_cloud.*",
|
"homeassistant.components.homematicip_cloud.*",
|
||||||
"homeassistant.components.honeywell.*",
|
"homeassistant.components.honeywell.*",
|
||||||
"homeassistant.components.hue.*",
|
|
||||||
"homeassistant.components.huisbaasje.*",
|
"homeassistant.components.huisbaasje.*",
|
||||||
"homeassistant.components.humidifier.*",
|
"homeassistant.components.humidifier.*",
|
||||||
"homeassistant.components.iaqualink.*",
|
"homeassistant.components.iaqualink.*",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user