mirror of
https://github.com/home-assistant/core.git
synced 2026-09-21 10:10:54 -05:00
Deprecate aux heat from Honeywell (#114110)
* Remove aux heat * Add switch entity for emheat * Optimized async_setup_entry * Fix errors in comments * Fix new ruff failuer * Use constant for EM * Protect EM mode - must be in heat to turn on/off * Restore aux_heat * Add repair issue * Add missing place holder to issue * Better placeholder "option"
This commit is contained in:
@@ -29,7 +29,7 @@ async def test_entry_diagnostics(
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
assert hass.states.async_entity_ids_count() == 6
|
||||
assert hass.states.async_entity_ids_count() == 8
|
||||
|
||||
result = await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ async def test_setup_entry(hass: HomeAssistant, config_entry: MockConfigEntry) -
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
assert (
|
||||
hass.states.async_entity_ids_count() == 3
|
||||
hass.states.async_entity_ids_count() == 4
|
||||
) # 1 climate entity; 2 sensor entities
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ async def test_setup_multiple_thermostats(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
assert (
|
||||
hass.states.async_entity_ids_count() == 6
|
||||
) # 2 climate entities; 4 sensor entities
|
||||
hass.states.async_entity_ids_count() == 8
|
||||
) # 2 climate entities; 4 sensor entities; 2 switch entities
|
||||
|
||||
|
||||
async def test_setup_multiple_thermostats_with_same_deviceid(
|
||||
@@ -84,8 +84,8 @@ async def test_setup_multiple_thermostats_with_same_deviceid(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
assert (
|
||||
hass.states.async_entity_ids_count() == 3
|
||||
) # 1 climate entity; 2 sensor entities
|
||||
hass.states.async_entity_ids_count() == 4
|
||||
) # 1 climate entity; 2 sensor entities; 1 switch enitiy
|
||||
assert "Platform honeywell does not generate unique IDs" not in caplog.text
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ async def test_remove_stale_device(
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
assert hass.states.async_entity_ids_count() == 6
|
||||
assert hass.states.async_entity_ids_count() == 8
|
||||
|
||||
device_entries = dr.async_entries_for_config_entry(
|
||||
device_registry, config_entry.entry_id
|
||||
@@ -209,8 +209,8 @@ async def test_remove_stale_device(
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
assert (
|
||||
hass.states.async_entity_ids_count() == 3
|
||||
) # 1 climate entities; 2 sensor entities
|
||||
hass.states.async_entity_ids_count() == 4
|
||||
) # 1 climate entities; 2 sensor entities; 1 switch entity
|
||||
|
||||
device_entries = dr.async_entries_for_config_entry(
|
||||
device_registry, config_entry.entry_id
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
"""Tests for Honeywell switch component."""
|
||||
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from aiosomecomfort.exceptions import SomeComfortError
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
||||
from . import init_integration
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
async def test_emheat_switch(
|
||||
hass: HomeAssistant,
|
||||
config_entry: MockConfigEntry,
|
||||
device: MagicMock,
|
||||
) -> None:
|
||||
"""Test emergency heat switch."""
|
||||
|
||||
await init_integration(hass, config_entry)
|
||||
entity_id = f"switch.{device.name}_emergency_heat"
|
||||
await hass.services.async_call(
|
||||
SWITCH_DOMAIN,
|
||||
SERVICE_TURN_ON,
|
||||
{ATTR_ENTITY_ID: entity_id},
|
||||
blocking=True,
|
||||
)
|
||||
device.set_system_mode.assert_not_called()
|
||||
|
||||
device.set_system_mode.reset_mock()
|
||||
|
||||
await hass.services.async_call(
|
||||
SWITCH_DOMAIN,
|
||||
SERVICE_TURN_OFF,
|
||||
{ATTR_ENTITY_ID: entity_id},
|
||||
blocking=True,
|
||||
)
|
||||
device.set_system_mode.assert_not_called()
|
||||
|
||||
device.system_mode = "heat"
|
||||
|
||||
await hass.services.async_call(
|
||||
SWITCH_DOMAIN,
|
||||
SERVICE_TURN_ON,
|
||||
{ATTR_ENTITY_ID: entity_id},
|
||||
blocking=True,
|
||||
)
|
||||
device.set_system_mode.assert_called_once_with("emheat")
|
||||
|
||||
device.set_system_mode.reset_mock()
|
||||
device.system_mode = "emheat"
|
||||
await hass.services.async_call(
|
||||
SWITCH_DOMAIN,
|
||||
SERVICE_TURN_OFF,
|
||||
{ATTR_ENTITY_ID: entity_id},
|
||||
blocking=True,
|
||||
)
|
||||
device.set_system_mode.assert_called_once_with("off")
|
||||
|
||||
device.set_system_mode.reset_mock()
|
||||
device.system_mode = "heat"
|
||||
device.set_system_mode.side_effect = SomeComfortError
|
||||
with pytest.raises(HomeAssistantError):
|
||||
await hass.services.async_call(
|
||||
SWITCH_DOMAIN,
|
||||
SERVICE_TURN_ON,
|
||||
{ATTR_ENTITY_ID: entity_id},
|
||||
blocking=True,
|
||||
)
|
||||
device.set_system_mode.assert_called_once_with("emheat")
|
||||
|
||||
device.set_system_mode.reset_mock()
|
||||
device.system_mode = "emheat"
|
||||
device.set_system_mode.side_effect = SomeComfortError
|
||||
with pytest.raises(HomeAssistantError):
|
||||
await hass.services.async_call(
|
||||
SWITCH_DOMAIN,
|
||||
SERVICE_TURN_OFF,
|
||||
{ATTR_ENTITY_ID: entity_id},
|
||||
blocking=True,
|
||||
)
|
||||
device.set_system_mode.assert_called_once_with("off")
|
||||
Reference in New Issue
Block a user