diff --git a/homeassistant/components/plugwise/number.py b/homeassistant/components/plugwise/number.py index 102d94f91b7564..5979480d90f3a2 100644 --- a/homeassistant/components/plugwise/number.py +++ b/homeassistant/components/plugwise/number.py @@ -48,6 +48,14 @@ class PlugwiseNumberEntityDescription( entity_category=EntityCategory.CONFIG, native_unit_of_measurement=UnitOfTemperature.CELSIUS, ), + PlugwiseNumberEntityDescription( + key="max_dhw_temperature", + translation_key="max_dhw_temperature", + command=lambda api, number, value: api.set_number_setpoint(number, value), + device_class=NumberDeviceClass.TEMPERATURE, + entity_category=EntityCategory.CONFIG, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + ), ) @@ -89,7 +97,6 @@ def __init__( self.entity_description = description self._attr_unique_id = f"{device_id}-{description.key}" 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) diff --git a/homeassistant/components/plugwise/strings.json b/homeassistant/components/plugwise/strings.json index e1b5b5c40535d8..5210f8a6dc0b2e 100644 --- a/homeassistant/components/plugwise/strings.json +++ b/homeassistant/components/plugwise/strings.json @@ -76,6 +76,9 @@ "number": { "maximum_boiler_temperature": { "name": "Maximum boiler temperature setpoint" + }, + "max_dhw_temperature": { + "name": "Domestic hot water setpoint" } }, "select": { diff --git a/tests/components/plugwise/test_number.py b/tests/components/plugwise/test_number.py index da31b8038c8545..9ca64e104d3133 100644 --- a/tests/components/plugwise/test_number.py +++ b/tests/components/plugwise/test_number.py @@ -40,3 +40,32 @@ async def test_anna_max_boiler_temp_change( mock_smile_anna.set_number_setpoint.assert_called_with( "maximum_boiler_temperature", 65.0 ) + + +async def test_adam_number_entities( + hass: HomeAssistant, mock_smile_adam_2: MagicMock, init_integration: MockConfigEntry +) -> None: + """Test creation of a number.""" + state = hass.states.get("number.opentherm_domestic_hot_water_setpoint") + assert state + assert float(state.state) == 60.0 + + +async def test_adam_dhw_setpoint_change( + hass: HomeAssistant, mock_smile_adam_2: MagicMock, init_integration: MockConfigEntry +) -> None: + """Test changing of number entities.""" + await hass.services.async_call( + NUMBER_DOMAIN, + SERVICE_SET_VALUE, + { + ATTR_ENTITY_ID: "number.opentherm_domestic_hot_water_setpoint", + ATTR_VALUE: 55, + }, + blocking=True, + ) + + assert mock_smile_adam_2.set_number_setpoint.call_count == 1 + mock_smile_adam_2.set_number_setpoint.assert_called_with( + "max_dhw_temperature", 55.0 + )