mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Add entity translations for Abode (#94169)
This commit is contained in:
parent
8e93045857
commit
6ceb973606
@ -22,17 +22,14 @@ from .const import DOMAIN
|
|||||||
SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=CONST.TEMP_STATUS_KEY,
|
key=CONST.TEMP_STATUS_KEY,
|
||||||
name="Temperature",
|
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=CONST.HUMI_STATUS_KEY,
|
key=CONST.HUMI_STATUS_KEY,
|
||||||
name="Humidity",
|
|
||||||
device_class=SensorDeviceClass.HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=CONST.LUX_STATUS_KEY,
|
key=CONST.LUX_STATUS_KEY,
|
||||||
name="Lux",
|
|
||||||
device_class=SensorDeviceClass.ILLUMINANCE,
|
device_class=SensorDeviceClass.ILLUMINANCE,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -56,6 +53,7 @@ class AbodeSensor(AbodeDevice, SensorEntity):
|
|||||||
"""A sensor implementation for Abode devices."""
|
"""A sensor implementation for Abode devices."""
|
||||||
|
|
||||||
_device: AbodeSense
|
_device: AbodeSense
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
@ -37,7 +37,7 @@ async def test_attributes(hass: HomeAssistant) -> None:
|
|||||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Environment Sensor Humidity"
|
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Environment Sensor Humidity"
|
||||||
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.HUMIDITY
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.HUMIDITY
|
||||||
|
|
||||||
state = hass.states.get("sensor.environment_sensor_lux")
|
state = hass.states.get("sensor.environment_sensor_illuminance")
|
||||||
assert state.state == "1.0"
|
assert state.state == "1.0"
|
||||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "lx"
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "lx"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user