mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Normalize concentration level status values to lowercase
This commit is contained in:
parent
ad7f512e45
commit
67a33c89a1
@ -79,7 +79,7 @@ SENSOR_DESCRIPTIONS = {
|
||||
translation_key="concentration_level",
|
||||
name="Concentration Level",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
options=[status.name for status in Color],
|
||||
options=[status.name.lower() for status in Color],
|
||||
),
|
||||
"co2": AranetSensorEntityDescription(
|
||||
key="co2",
|
||||
@ -169,7 +169,7 @@ def sensor_update_to_bluetooth_data_update(
|
||||
if val == -1:
|
||||
continue
|
||||
if key == "status":
|
||||
val = val.name
|
||||
val = val.name.lower()
|
||||
val = val * desc.scale
|
||||
data[tag] = val
|
||||
names[tag] = desc.name
|
||||
|
@ -216,11 +216,11 @@ async def test_sensors_aranet4(
|
||||
|
||||
status_sensor = hass.states.get("sensor.aranet4_12345_concentration_level")
|
||||
status_sensor_attrs = status_sensor.attributes
|
||||
assert status_sensor.state == "GREEN"
|
||||
assert status_sensor.state == "green"
|
||||
assert (
|
||||
status_sensor_attrs[ATTR_FRIENDLY_NAME] == "Aranet4 12345 Concentration Level"
|
||||
)
|
||||
assert status_sensor_attrs[ATTR_OPTIONS] == ["ERROR", "GREEN", "YELLOW", "RED"]
|
||||
assert status_sensor_attrs[ATTR_OPTIONS] == ["error", "green", "yellow", "red"]
|
||||
|
||||
# Check device context for the battery sensor
|
||||
entity = entity_registry.async_get("sensor.aranet4_12345_battery")
|
||||
@ -301,11 +301,11 @@ async def test_sensors_aranetrn(
|
||||
|
||||
status_sensor = hass.states.get("sensor.aranetrn_12345_concentration_level")
|
||||
status_sensor_attrs = status_sensor.attributes
|
||||
assert status_sensor.state == "GREEN"
|
||||
assert status_sensor.state == "green"
|
||||
assert (
|
||||
status_sensor_attrs[ATTR_FRIENDLY_NAME] == "AranetRn+ 12345 Concentration Level"
|
||||
)
|
||||
assert status_sensor_attrs[ATTR_OPTIONS] == ["ERROR", "GREEN", "YELLOW", "RED"]
|
||||
assert status_sensor_attrs[ATTR_OPTIONS] == ["error", "green", "yellow", "red"]
|
||||
|
||||
# Check device context for the battery sensor
|
||||
entity = entity_registry.async_get("sensor.aranetrn_12345_battery")
|
||||
|
Loading…
x
Reference in New Issue
Block a user