Add Plugwise number platform (#74655)

This commit is contained in:
Bouwe Westerdijk 2022-07-13 09:21:58 +02:00 committed by GitHub
parent b7a6f4e220
commit 34f1d5e094
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 163 additions and 4 deletions

View file

@ -13,6 +13,9 @@
"model": "Generic heater",
"name": "OpenTherm",
"vendor": "Techneco",
"lower_bound": 0.0,
"upper_bound": 100.0,
"resolution": 1.0,
"maximum_boiler_temperature": 60.0,
"binary_sensors": {
"dhw_state": false,

View file

@ -0,0 +1,40 @@
"""Tests for the Plugwise Number integration."""
from unittest.mock import MagicMock
from homeassistant.components.number import (
ATTR_VALUE,
DOMAIN as NUMBER_DOMAIN,
SERVICE_SET_VALUE,
)
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry
async def test_anna_number_entities(
hass: HomeAssistant, mock_smile_anna: MagicMock, init_integration: MockConfigEntry
) -> None:
"""Test creation of a number."""
state = hass.states.get("number.opentherm_maximum_boiler_temperature_setpoint")
assert state
assert float(state.state) == 60.0
async def test_anna_max_boiler_temp_change(
hass: HomeAssistant, mock_smile_anna: 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_maximum_boiler_temperature_setpoint",
ATTR_VALUE: 65,
},
blocking=True,
)
assert mock_smile_anna.set_max_boiler_temperature.call_count == 1
mock_smile_anna.set_max_boiler_temperature.assert_called_with(65)