1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-02 00:20:30 +01:00

Enhance GV5140 test to assert temperature and humidity sensors (#164644)

This commit is contained in:
Norman Yee
2026-03-03 02:05:32 -08:00
committed by GitHub
parent c9c9a149b6
commit ad4b4bd221

View File

@@ -165,7 +165,7 @@ async def test_gvh5178_multi_sensor(hass: HomeAssistant) -> None:
async def test_gv5140(hass: HomeAssistant) -> None:
"""Test setting up creates the sensors for a device with CO2."""
"""Test CO2, temperature and humidity sensors for a GV5140 device."""
entry = MockConfigEntry(
domain=DOMAIN,
unique_id="AA:BB:CC:DD:EE:FF",
@@ -180,6 +180,20 @@ async def test_gv5140(hass: HomeAssistant) -> None:
await hass.async_block_till_done()
assert len(hass.states.async_all()) == 3
temp_sensor = hass.states.get("sensor.5140eeff_temperature")
temp_sensor_attributes = temp_sensor.attributes
assert temp_sensor.state == "21.6"
assert temp_sensor_attributes[ATTR_FRIENDLY_NAME] == "5140EEFF Temperature"
assert temp_sensor_attributes[ATTR_UNIT_OF_MEASUREMENT] == "°C"
assert temp_sensor_attributes[ATTR_STATE_CLASS] == "measurement"
humidity_sensor = hass.states.get("sensor.5140eeff_humidity")
humidity_sensor_attributes = humidity_sensor.attributes
assert humidity_sensor.state == "67.8"
assert humidity_sensor_attributes[ATTR_FRIENDLY_NAME] == "5140EEFF Humidity"
assert humidity_sensor_attributes[ATTR_UNIT_OF_MEASUREMENT] == "%"
assert humidity_sensor_attributes[ATTR_STATE_CLASS] == "measurement"
co2_sensor = hass.states.get("sensor.5140eeff_carbon_dioxide")
co2_sensor_attributes = co2_sensor.attributes
assert co2_sensor.state == "531"