From 5cf5f5b4cf044ca07d63a401d91aef741f088290 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk <11290930+bouwew@users.noreply.github.com> Date: Thu, 21 Sep 2023 19:31:53 +0200 Subject: [PATCH] Add missing step-differentiation for the Plugwise temperature_offset (#100654) --- homeassistant/components/plugwise/number.py | 6 +++++- tests/components/plugwise/test_number.py | 14 +++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/plugwise/number.py b/homeassistant/components/plugwise/number.py index 7e387abea02..9865aec2242 100644 --- a/homeassistant/components/plugwise/number.py +++ b/homeassistant/components/plugwise/number.py @@ -114,7 +114,11 @@ class PlugwiseNumberEntity(PlugwiseEntity, NumberEntity): self._attr_mode = NumberMode.BOX self._attr_native_max_value = self.device[description.key]["upper_bound"] self._attr_native_min_value = self.device[description.key]["lower_bound"] - self._attr_native_step = max(self.device[description.key]["resolution"], 0.5) + + native_step = self.device[description.key]["resolution"] + if description.key != "temperature_offset": + native_step = max(native_step, 0.5) + self._attr_native_step = native_step @property def native_value(self) -> float: diff --git a/tests/components/plugwise/test_number.py b/tests/components/plugwise/test_number.py index 6572a0df20e..6fa65b3e65a 100644 --- a/tests/components/plugwise/test_number.py +++ b/tests/components/plugwise/test_number.py @@ -71,10 +71,22 @@ async def test_adam_dhw_setpoint_change( ) +async def test_adam_temperature_offset( + hass: HomeAssistant, mock_smile_adam: MagicMock, init_integration: MockConfigEntry +) -> None: + """Test creation of the temperature_offset number.""" + state = hass.states.get("number.zone_thermostat_jessie_temperature_offset") + assert state + assert float(state.state) == 0.0 + assert state.attributes.get("min") == -2.0 + assert state.attributes.get("max") == 2.0 + assert state.attributes.get("step") == 0.1 + + async def test_adam_temperature_offset_change( hass: HomeAssistant, mock_smile_adam: MagicMock, init_integration: MockConfigEntry ) -> None: - """Test changing of number entities.""" + """Test changing of the temperature_offset number.""" await hass.services.async_call( NUMBER_DOMAIN, SERVICE_SET_VALUE,