From ad4b4bd2212376956d54510177cd919e30f80436 Mon Sep 17 00:00:00 2001 From: Norman Yee <155019+funkadelic@users.noreply.github.com> Date: Tue, 3 Mar 2026 02:05:32 -0800 Subject: [PATCH] Enhance GV5140 test to assert temperature and humidity sensors (#164644) --- tests/components/govee_ble/test_sensor.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/components/govee_ble/test_sensor.py b/tests/components/govee_ble/test_sensor.py index 65dc1060b2a..85235e75610 100644 --- a/tests/components/govee_ble/test_sensor.py +++ b/tests/components/govee_ble/test_sensor.py @@ -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"