Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/hue/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class HuePresence(GenericZLLSensor, BinarySensorEntity):
"""The presence sensor entity for a Hue motion sensor device."""

device_class = DEVICE_CLASS_MOTION
_attr_device_class = DEVICE_CLASS_MOTION

@property
def is_on(self):
Expand Down
27 changes: 8 additions & 19 deletions homeassistant/components/hue/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class GenericHueGaugeSensorEntity(GenericZLLSensor, SensorEntity):
class HueLightLevel(GenericHueGaugeSensorEntity):
"""The light level sensor entity for a Hue motion sensor device."""

device_class = DEVICE_CLASS_ILLUMINANCE
unit_of_measurement = LIGHT_LUX
_attr_device_class = DEVICE_CLASS_ILLUMINANCE
_attr_unit_of_measurement = LIGHT_LUX

@property
def state(self):
Expand Down Expand Up @@ -76,8 +76,9 @@ def extra_state_attributes(self):
class HueTemperature(GenericHueGaugeSensorEntity):
"""The temperature sensor entity for a Hue motion sensor device."""

device_class = DEVICE_CLASS_TEMPERATURE
unit_of_measurement = TEMP_CELSIUS
_attr_device_class = DEVICE_CLASS_TEMPERATURE
_attr_state_class = STATE_CLASS_MEASUREMENT
_attr_unit_of_measurement = TEMP_CELSIUS

@property
def state(self):
Expand All @@ -87,15 +88,13 @@ def state(self):

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):
"""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
def unique_id(self):
"""Return a unique identifier for this device."""
Expand All @@ -106,16 +105,6 @@ def state(self):
"""Return the state of the 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(
{
Expand Down
5 changes: 4 additions & 1 deletion homeassistant/components/hue/sensor_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"""Support for the Philips Hue sensors as a platform."""
from __future__ import annotations

from datetime import timedelta
import logging
from typing import Any

from aiohue import AiohueException, Unauthorized
from aiohue.sensors import TYPE_ZLL_PRESENCE
Expand All @@ -16,7 +19,7 @@
from .hue_event import EVENT_CONFIG_MAP
from .sensor_device import GenericHueDevice

SENSOR_CONFIG_MAP = {}
SENSOR_CONFIG_MAP: dict[str, Any] = {}
_LOGGER = logging.getLogger(__name__)


Expand Down
3 changes: 0 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1012,9 +1012,6 @@ ignore_errors = true
[mypy-homeassistant.components.honeywell.*]
ignore_errors = true

[mypy-homeassistant.components.hue.*]
ignore_errors = true

[mypy-homeassistant.components.huisbaasje.*]
ignore_errors = true

Expand Down
1 change: 0 additions & 1 deletion script/hassfest/mypy_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
"homeassistant.components.homekit_controller.*",
"homeassistant.components.homematicip_cloud.*",
"homeassistant.components.honeywell.*",
"homeassistant.components.hue.*",
"homeassistant.components.huisbaasje.*",
"homeassistant.components.humidifier.*",
"homeassistant.components.iaqualink.*",
Expand Down