mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Add missing step-differentiation for the Plugwise temperature_offset (#100654)
This commit is contained in:
parent
f973d4cc26
commit
5cf5f5b4cf
@ -114,7 +114,11 @@ class PlugwiseNumberEntity(PlugwiseEntity, NumberEntity):
|
|||||||
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)
|
|
||||||
|
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
|
@property
|
||||||
def native_value(self) -> float:
|
def native_value(self) -> float:
|
||||||
|
@ -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(
|
async def test_adam_temperature_offset_change(
|
||||||
hass: HomeAssistant, mock_smile_adam: MagicMock, init_integration: MockConfigEntry
|
hass: HomeAssistant, mock_smile_adam: MagicMock, init_integration: MockConfigEntry
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test changing of number entities."""
|
"""Test changing of the temperature_offset number."""
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
NUMBER_DOMAIN,
|
NUMBER_DOMAIN,
|
||||||
SERVICE_SET_VALUE,
|
SERVICE_SET_VALUE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user