From a7647fee285ec233e874e615ebf863ff6d9a0df5 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 10 Jan 2023 18:26:49 +0100 Subject: [PATCH] Fix unknown data in homematicip_cloud (#85618) --- homeassistant/components/homematicip_cloud/sensor.py | 4 ++-- tests/components/homematicip_cloud/test_sensor.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/homematicip_cloud/sensor.py b/homeassistant/components/homematicip_cloud/sensor.py index b4eb89f06c8..04fba2cfd92 100644 --- a/homeassistant/components/homematicip_cloud/sensor.py +++ b/homeassistant/components/homematicip_cloud/sensor.py @@ -177,10 +177,10 @@ class HomematicipHeatingThermostat(HomematicipGenericEntity, SensorEntity): return "mdi:radiator" @property - def native_value(self) -> int: + def native_value(self) -> int | None: """Return the state of the radiator valve.""" if self._device.valveState != ValveState.ADAPTION_DONE: - return self._device.valveState + return None return round(self._device.valvePosition * 100) diff --git a/tests/components/homematicip_cloud/test_sensor.py b/tests/components/homematicip_cloud/test_sensor.py index 33da0f217ae..b4da2a83c38 100644 --- a/tests/components/homematicip_cloud/test_sensor.py +++ b/tests/components/homematicip_cloud/test_sensor.py @@ -29,6 +29,7 @@ from homeassistant.const import ( PERCENTAGE, POWER_WATT, SPEED_KILOMETERS_PER_HOUR, + STATE_UNKNOWN, TEMP_CELSIUS, ) from homeassistant.setup import async_setup_component @@ -82,7 +83,7 @@ async def test_hmip_heating_thermostat(hass, default_mock_hap_factory): await async_manipulate_test_data(hass, hmip_device, "valveState", "nn") ha_state = hass.states.get(entity_id) - assert ha_state.state == "nn" + assert ha_state.state == STATE_UNKNOWN await async_manipulate_test_data( hass, hmip_device, "valveState", ValveState.ADAPTION_DONE