Use the humidity value in Shelly Wall Display climate entity (#119830)
* Use the humidity value with the climate entity if available * Update tests * Use walrus --------- Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
This commit is contained in:
parent
b6b6248713
commit
f5dfefb3a6
3 changed files with 41 additions and 0 deletions
|
@ -254,6 +254,7 @@ MOCK_STATUS_RPC = {
|
|||
"current_C": 12.3,
|
||||
"output": True,
|
||||
},
|
||||
"humidity:0": {"rh": 44.4},
|
||||
"sys": {
|
||||
"available_updates": {
|
||||
"beta": {"version": "some_beta_version"},
|
||||
|
|
|
@ -8,6 +8,7 @@ from aioshelly.exceptions import DeviceConnectionError, InvalidAuthError
|
|||
import pytest
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
ATTR_CURRENT_HUMIDITY,
|
||||
ATTR_CURRENT_TEMPERATURE,
|
||||
ATTR_HVAC_ACTION,
|
||||
ATTR_HVAC_MODE,
|
||||
|
@ -610,6 +611,7 @@ async def test_rpc_climate_hvac_mode(
|
|||
assert state.attributes[ATTR_TEMPERATURE] == 23
|
||||
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 12.3
|
||||
assert state.attributes[ATTR_HVAC_ACTION] == HVACAction.HEATING
|
||||
assert state.attributes[ATTR_CURRENT_HUMIDITY] == 44.4
|
||||
|
||||
entry = entity_registry.async_get(ENTITY_ID)
|
||||
assert entry
|
||||
|
@ -620,6 +622,7 @@ async def test_rpc_climate_hvac_mode(
|
|||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state.attributes[ATTR_HVAC_ACTION] == HVACAction.IDLE
|
||||
assert state.attributes[ATTR_CURRENT_HUMIDITY] == 44.4
|
||||
|
||||
monkeypatch.setitem(mock_rpc_device.status["thermostat:0"], "enable", False)
|
||||
await hass.services.async_call(
|
||||
|
@ -637,6 +640,31 @@ async def test_rpc_climate_hvac_mode(
|
|||
assert state.state == HVACMode.OFF
|
||||
|
||||
|
||||
async def test_rpc_climate_without_humidity(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: EntityRegistry,
|
||||
mock_rpc_device: Mock,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
"""Test climate entity without the humidity value."""
|
||||
new_status = deepcopy(mock_rpc_device.status)
|
||||
new_status.pop("humidity:0")
|
||||
monkeypatch.setattr(mock_rpc_device, "status", new_status)
|
||||
|
||||
await init_integration(hass, 2, model=MODEL_WALL_DISPLAY)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state.state == HVACMode.HEAT
|
||||
assert state.attributes[ATTR_TEMPERATURE] == 23
|
||||
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 12.3
|
||||
assert state.attributes[ATTR_HVAC_ACTION] == HVACAction.HEATING
|
||||
assert ATTR_CURRENT_HUMIDITY not in state.attributes
|
||||
|
||||
entry = entity_registry.async_get(ENTITY_ID)
|
||||
assert entry
|
||||
assert entry.unique_id == "123456789ABC-thermostat:0"
|
||||
|
||||
|
||||
async def test_rpc_climate_set_temperature(
|
||||
hass: HomeAssistant, mock_rpc_device: Mock, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue