Do not reload Shelly TRV entry when not needed (#88037)

* Do not reload the entry when the target temperature changes

* Do not reload the entry when the mode changes

* Increase test coverage

* Increase test coverage
This commit is contained in:
Maciej Bieniek 2023-02-15 10:21:53 +01:00 committed by GitHub
parent cd4ce86f07
commit 95bb019f71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View file

@ -35,8 +35,13 @@ ENTITY_ID = f"{CLIMATE_DOMAIN}.test_name"
async def test_climate_hvac_mode(hass, mock_block_device, monkeypatch):
"""Test climate hvac mode service."""
monkeypatch.delattr(mock_block_device.blocks[DEVICE_BLOCK_ID], "targetTemp")
monkeypatch.setattr(
mock_block_device.blocks[SENSOR_BLOCK_ID],
"sensor_ids",
{"battery": 98, "valvePos": 50, "targetTemp": 21.0},
)
monkeypatch.setattr(mock_block_device.blocks[DEVICE_BLOCK_ID], "valveError", 0)
await init_integration(hass, 1, sleep_period=1000)
await init_integration(hass, 1, sleep_period=1000, model="SHTRV-01")
# Make device online
mock_block_device.mock_update()
@ -131,7 +136,7 @@ async def test_climate_set_preset_mode(hass, mock_block_device, monkeypatch):
monkeypatch.delattr(mock_block_device.blocks[DEVICE_BLOCK_ID], "targetTemp")
monkeypatch.setattr(mock_block_device.blocks[DEVICE_BLOCK_ID], "valveError", 0)
monkeypatch.setattr(mock_block_device.blocks[DEVICE_BLOCK_ID], "mode", None)
await init_integration(hass, 1, sleep_period=1000)
await init_integration(hass, 1, sleep_period=1000, model="SHTRV-01")
# Make device online
mock_block_device.mock_update()