Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions custom_components/plugwise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ async def async_migrate_plugwise_entry(
entry: ConfigEntry
) -> bool:
"""Migrate to new config entry."""
if entry.version > 1:
return False

if entry.version == 1 and entry.minor_version < 2:
new_data = {**entry.data}
new_data[CONF_TIMEOUT] = get_timeout_for_version(coordinator.api.smile_version)
Expand Down
4 changes: 2 additions & 2 deletions custom_components/plugwise/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def async_get_options_flow(
class PlugwiseOptionsFlowHandler(OptionsFlowWithConfigEntry): # pw-beta options
"""Plugwise option flow."""

def _create_options_schema(self, coordinator):
def _create_options_schema(self, coordinator: PlugwiseDataUpdateCoordinator) -> vol.Schema:
interval = DEFAULT_SCAN_INTERVAL[coordinator.api.smile_type] # pw-beta options
schema = {
vol.Optional(
Expand Down Expand Up @@ -310,7 +310,7 @@ async def async_step_none(
async def async_step_init(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult:
"""Manage the Plugwise options."""
if not self.config_entry.data.get(CONF_HOST):
return await self.async_step_none(user_input)
return await self.async_step_none(user_input) # pragma: no cover

if user_input is not None:
return self.async_create_entry(title="", data=user_input)
Expand Down
24 changes: 12 additions & 12 deletions tests/components/plugwise/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def mock_setup_entry() -> Generator[AsyncMock]:


@pytest.fixture
def mock_smile_config_flow() -> Generator[None, MagicMock, None]:
def mock_smile_config_flow() -> Generator[MagicMock]:
"""Return a mocked Smile client."""
with patch(
"homeassistant.components.plugwise.config_flow.Smile",
Expand All @@ -76,7 +76,7 @@ def mock_smile_config_flow() -> Generator[None, MagicMock, None]:


@pytest.fixture
def mock_smile_adam() -> Generator[None, MagicMock, None]:
def mock_smile_adam() -> Generator[MagicMock]:
"""Create a Mock Adam environment for testing exceptions."""
chosen_env = "m_adam_multiple_devices_per_zone"

Expand Down Expand Up @@ -105,7 +105,7 @@ def mock_smile_adam() -> Generator[None, MagicMock, None]:


@pytest.fixture
def mock_smile_adam_2() -> Generator[None, MagicMock, None]:
def mock_smile_adam_2() -> Generator[MagicMock]:
"""Create a 2nd Mock Adam environment for testing exceptions."""
chosen_env = "m_adam_heating"

Expand Down Expand Up @@ -134,7 +134,7 @@ def mock_smile_adam_2() -> Generator[None, MagicMock, None]:


@pytest.fixture
def mock_smile_adam_3() -> Generator[None, MagicMock, None]:
def mock_smile_adam_3() -> Generator[MagicMock]:
"""Create a 3rd Mock Adam environment for testing exceptions."""
chosen_env = "m_adam_cooling"

Expand Down Expand Up @@ -163,7 +163,7 @@ def mock_smile_adam_3() -> Generator[None, MagicMock, None]:


@pytest.fixture
def mock_smile_adam_4() -> Generator[None, MagicMock, None]:
def mock_smile_adam_4() -> Generator[MagicMock]:
"""Create a 4th Mock Adam environment for testing exceptions."""
chosen_env = "m_adam_jip"

Expand Down Expand Up @@ -192,7 +192,7 @@ def mock_smile_adam_4() -> Generator[None, MagicMock, None]:


@pytest.fixture
def mock_smile_anna() -> Generator[None, MagicMock, None]:
def mock_smile_anna() -> Generator[MagicMock]:
"""Create a Mock Anna environment for testing exceptions."""
chosen_env = "anna_heatpump_heating"
with patch(
Expand Down Expand Up @@ -220,7 +220,7 @@ def mock_smile_anna() -> Generator[None, MagicMock, None]:


@pytest.fixture
def mock_smile_anna_2() -> Generator[None, MagicMock, None]:
def mock_smile_anna_2() -> Generator[MagicMock]:
"""Create a 2nd Mock Anna environment for testing exceptions."""
chosen_env = "m_anna_heatpump_cooling"
with patch(
Expand Down Expand Up @@ -248,7 +248,7 @@ def mock_smile_anna_2() -> Generator[None, MagicMock, None]:


@pytest.fixture
def mock_smile_anna_3() -> Generator[None, MagicMock, None]:
def mock_smile_anna_3() -> Generator[MagicMock]:
"""Create a 3rd Mock Anna environment for testing exceptions."""
chosen_env = "m_anna_heatpump_idle"
with patch(
Expand Down Expand Up @@ -276,7 +276,7 @@ def mock_smile_anna_3() -> Generator[None, MagicMock, None]:


@pytest.fixture
def mock_smile_p1() -> Generator[None, MagicMock, None]:
def mock_smile_p1() -> Generator[MagicMock]:
"""Create a Mock P1 DSMR environment for testing exceptions."""
chosen_env = "p1v4_442_single"
with patch(
Expand Down Expand Up @@ -304,7 +304,7 @@ def mock_smile_p1() -> Generator[None, MagicMock, None]:


@pytest.fixture
def mock_smile_p1_2() -> Generator[None, MagicMock, None]:
def mock_smile_p1_2() -> Generator[MagicMock]:
"""Create a Mock P1 3-phase DSMR environment for testing exceptions."""
chosen_env = "p1v4_442_triple"
with patch(
Expand Down Expand Up @@ -332,7 +332,7 @@ def mock_smile_p1_2() -> Generator[None, MagicMock, None]:


@pytest.fixture
def mock_smile_legacy_anna() -> Generator[None, MagicMock, None]:
def mock_smile_legacy_anna() -> Generator[MagicMock]:
"""Create a Mock legacy Anna environment for testing exceptions."""
chosen_env = "legacy_anna"
with patch(
Expand Down Expand Up @@ -360,7 +360,7 @@ def mock_smile_legacy_anna() -> Generator[None, MagicMock, None]:


@pytest.fixture
def mock_stretch() -> Generator[None, MagicMock, None]:
def mock_stretch() -> Generator[MagicMock]:
"""Create a Mock Stretch environment for testing exceptions."""
chosen_env = "stretch_v31"
with patch(
Expand Down
2 changes: 2 additions & 0 deletions tests/components/plugwise/snapshots/test_init.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
'username': 'smile',
}),
'disabled_by': None,
'discovery_keys': dict({
}),
'domain': 'plugwise',
'entry_id': <ANY>,
'minor_version': 2,
Expand Down
Loading