mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Add domestic_hot_water_setpoint number to Plugwise (#98092)
* Add max_dhw_temperature number * Update strings.json * Add related tests * Correct test * Black-fix
This commit is contained in:
parent
38cea8f31c
commit
b41d3b465c
@ -48,6 +48,14 @@ NUMBER_TYPES = (
|
|||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
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 @@ class PlugwiseNumberEntity(PlugwiseEntity, NumberEntity):
|
|||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
self._attr_unique_id = f"{device_id}-{description.key}"
|
self._attr_unique_id = f"{device_id}-{description.key}"
|
||||||
self._attr_mode = NumberMode.BOX
|
self._attr_mode = NumberMode.BOX
|
||||||
|
|
||||||
self._attr_native_max_value = self.device[description.key]["upper_bound"]
|
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_min_value = self.device[description.key]["lower_bound"]
|
||||||
self._attr_native_step = max(self.device[description.key]["resolution"], 0.5)
|
self._attr_native_step = max(self.device[description.key]["resolution"], 0.5)
|
||||||
|
@ -76,6 +76,9 @@
|
|||||||
"number": {
|
"number": {
|
||||||
"maximum_boiler_temperature": {
|
"maximum_boiler_temperature": {
|
||||||
"name": "Maximum boiler temperature setpoint"
|
"name": "Maximum boiler temperature setpoint"
|
||||||
|
},
|
||||||
|
"max_dhw_temperature": {
|
||||||
|
"name": "Domestic hot water setpoint"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"select": {
|
"select": {
|
||||||
|
@ -40,3 +40,32 @@ async def test_anna_max_boiler_temp_change(
|
|||||||
mock_smile_anna.set_number_setpoint.assert_called_with(
|
mock_smile_anna.set_number_setpoint.assert_called_with(
|
||||||
"maximum_boiler_temperature", 65.0
|
"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
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user