Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
"""Test the Plugwise config flow."""
|
2022-02-05 18:07:02 +00:00
|
|
|
from unittest.mock import AsyncMock, MagicMock, patch
|
2021-01-01 21:31:56 +00:00
|
|
|
|
2020-11-21 02:43:20 +00:00
|
|
|
from plugwise.exceptions import (
|
|
|
|
ConnectionFailedError,
|
|
|
|
InvalidAuthentication,
|
2022-03-15 07:53:53 +00:00
|
|
|
InvalidSetupError,
|
2020-11-21 02:43:20 +00:00
|
|
|
PlugwiseException,
|
|
|
|
)
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
import pytest
|
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
from homeassistant.components.plugwise.const import API, DEFAULT_PORT, DOMAIN, PW_TYPE
|
|
|
|
from homeassistant.components.zeroconf import ZeroconfServiceInfo
|
2020-09-06 20:26:14 +00:00
|
|
|
from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF
|
2020-11-08 17:09:43 +00:00
|
|
|
from homeassistant.const import (
|
|
|
|
CONF_HOST,
|
|
|
|
CONF_NAME,
|
|
|
|
CONF_PASSWORD,
|
|
|
|
CONF_PORT,
|
2021-07-16 16:46:23 +00:00
|
|
|
CONF_SOURCE,
|
2020-11-08 17:09:43 +00:00
|
|
|
CONF_USERNAME,
|
|
|
|
)
|
2022-02-05 18:07:02 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from homeassistant.data_entry_flow import (
|
|
|
|
RESULT_TYPE_ABORT,
|
|
|
|
RESULT_TYPE_CREATE_ENTRY,
|
|
|
|
RESULT_TYPE_FORM,
|
|
|
|
)
|
2020-09-06 20:26:14 +00:00
|
|
|
|
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
|
|
|
|
TEST_HOST = "1.1.1.1"
|
|
|
|
TEST_HOSTNAME = "smileabcdef"
|
2021-07-16 16:46:23 +00:00
|
|
|
TEST_HOSTNAME2 = "stretchabc"
|
2020-09-06 20:26:14 +00:00
|
|
|
TEST_PASSWORD = "test_password"
|
2020-09-19 10:08:16 +00:00
|
|
|
TEST_PORT = 81
|
2020-11-08 17:09:43 +00:00
|
|
|
TEST_USERNAME = "smile"
|
|
|
|
TEST_USERNAME2 = "stretch"
|
2020-09-19 10:08:16 +00:00
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
TEST_DISCOVERY = ZeroconfServiceInfo(
|
2021-11-22 11:35:52 +00:00
|
|
|
host=TEST_HOST,
|
2022-02-11 22:46:17 +00:00
|
|
|
addresses=[TEST_HOST],
|
2021-11-22 11:35:52 +00:00
|
|
|
hostname=f"{TEST_HOSTNAME}.local.",
|
2021-11-23 16:35:44 +00:00
|
|
|
name="mock_name",
|
|
|
|
port=DEFAULT_PORT,
|
2021-11-22 11:35:52 +00:00
|
|
|
properties={
|
2020-09-06 20:26:14 +00:00
|
|
|
"product": "smile",
|
|
|
|
"version": "1.2.3",
|
|
|
|
"hostname": f"{TEST_HOSTNAME}.local.",
|
|
|
|
},
|
2021-11-23 16:35:44 +00:00
|
|
|
type="mock_type",
|
2021-11-22 11:35:52 +00:00
|
|
|
)
|
2022-02-05 18:07:02 +00:00
|
|
|
|
|
|
|
TEST_DISCOVERY2 = ZeroconfServiceInfo(
|
2021-11-22 11:35:52 +00:00
|
|
|
host=TEST_HOST,
|
2022-02-11 22:46:17 +00:00
|
|
|
addresses=[TEST_HOST],
|
2021-11-22 11:35:52 +00:00
|
|
|
hostname=f"{TEST_HOSTNAME2}.local.",
|
2021-11-23 16:35:44 +00:00
|
|
|
name="mock_name",
|
|
|
|
port=DEFAULT_PORT,
|
2021-11-22 11:35:52 +00:00
|
|
|
properties={
|
2021-07-16 16:46:23 +00:00
|
|
|
"product": "stretch",
|
|
|
|
"version": "1.2.3",
|
|
|
|
"hostname": f"{TEST_HOSTNAME2}.local.",
|
|
|
|
},
|
2021-11-23 16:35:44 +00:00
|
|
|
type="mock_type",
|
2021-11-22 11:35:52 +00:00
|
|
|
)
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(name="mock_smile")
|
|
|
|
def mock_smile():
|
|
|
|
"""Create a Mock Smile for testing exceptions."""
|
2020-08-27 11:56:20 +00:00
|
|
|
with patch(
|
|
|
|
"homeassistant.components.plugwise.config_flow.Smile",
|
|
|
|
) as smile_mock:
|
2021-07-16 16:46:23 +00:00
|
|
|
smile_mock.PlugwiseException = PlugwiseException
|
2020-11-21 02:43:20 +00:00
|
|
|
smile_mock.InvalidAuthentication = InvalidAuthentication
|
|
|
|
smile_mock.ConnectionFailedError = ConnectionFailedError
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
smile_mock.return_value.connect.return_value = True
|
|
|
|
yield smile_mock.return_value
|
|
|
|
|
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
async def test_form(
|
|
|
|
hass: HomeAssistant,
|
|
|
|
mock_setup_entry: AsyncMock,
|
|
|
|
mock_smile_config_flow: MagicMock,
|
|
|
|
) -> None:
|
|
|
|
"""Test the full user configuration flow."""
|
2021-07-16 16:46:23 +00:00
|
|
|
result = await hass.config_entries.flow.async_init(
|
|
|
|
DOMAIN, context={CONF_SOURCE: SOURCE_USER}
|
|
|
|
)
|
2022-02-05 18:07:02 +00:00
|
|
|
assert result.get("type") == RESULT_TYPE_FORM
|
|
|
|
assert result.get("errors") == {}
|
|
|
|
assert result.get("step_id") == "user"
|
|
|
|
assert "flow_id" in result
|
2021-07-16 16:46:23 +00:00
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
result2 = await hass.config_entries.flow.async_configure(
|
|
|
|
result["flow_id"],
|
|
|
|
user_input={
|
|
|
|
CONF_HOST: TEST_HOST,
|
|
|
|
CONF_PASSWORD: TEST_PASSWORD,
|
|
|
|
},
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
)
|
2020-09-08 06:37:44 +00:00
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
|
|
|
assert result2.get("title") == "Test Smile Name"
|
|
|
|
assert result2.get("data") == {
|
2020-11-08 17:09:43 +00:00
|
|
|
CONF_HOST: TEST_HOST,
|
|
|
|
CONF_PASSWORD: TEST_PASSWORD,
|
|
|
|
CONF_PORT: DEFAULT_PORT,
|
|
|
|
CONF_USERNAME: TEST_USERNAME,
|
2021-07-16 16:46:23 +00:00
|
|
|
PW_TYPE: API,
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
}
|
2020-09-06 20:26:14 +00:00
|
|
|
|
|
|
|
assert len(mock_setup_entry.mock_calls) == 1
|
2022-02-05 18:07:02 +00:00
|
|
|
assert len(mock_smile_config_flow.connect.mock_calls) == 1
|
2020-09-06 20:26:14 +00:00
|
|
|
|
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
"discovery,username",
|
|
|
|
[
|
|
|
|
(TEST_DISCOVERY, TEST_USERNAME),
|
|
|
|
(TEST_DISCOVERY2, TEST_USERNAME2),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
async def test_zeroconf_flow(
|
|
|
|
hass: HomeAssistant,
|
|
|
|
mock_setup_entry: AsyncMock,
|
|
|
|
mock_smile_config_flow: MagicMock,
|
|
|
|
discovery: ZeroconfServiceInfo,
|
|
|
|
username: str,
|
|
|
|
) -> None:
|
|
|
|
"""Test config flow for smile devices."""
|
2020-09-06 20:26:14 +00:00
|
|
|
result = await hass.config_entries.flow.async_init(
|
|
|
|
DOMAIN,
|
2021-07-16 16:46:23 +00:00
|
|
|
context={CONF_SOURCE: SOURCE_ZEROCONF},
|
2022-02-05 18:07:02 +00:00
|
|
|
data=discovery,
|
2020-09-06 20:26:14 +00:00
|
|
|
)
|
2022-02-05 18:07:02 +00:00
|
|
|
assert result.get("type") == RESULT_TYPE_FORM
|
|
|
|
assert result.get("errors") == {}
|
|
|
|
assert result.get("step_id") == "user"
|
|
|
|
assert "flow_id" in result
|
2020-11-08 17:09:43 +00:00
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
result2 = await hass.config_entries.flow.async_configure(
|
|
|
|
result["flow_id"],
|
|
|
|
user_input={CONF_PASSWORD: TEST_PASSWORD},
|
|
|
|
)
|
2020-11-08 17:09:43 +00:00
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
|
|
|
assert result2.get("title") == "Test Smile Name"
|
|
|
|
assert result2.get("data") == {
|
2020-11-08 17:09:43 +00:00
|
|
|
CONF_HOST: TEST_HOST,
|
|
|
|
CONF_PASSWORD: TEST_PASSWORD,
|
|
|
|
CONF_PORT: DEFAULT_PORT,
|
2022-02-05 18:07:02 +00:00
|
|
|
CONF_USERNAME: username,
|
2021-07-16 16:46:23 +00:00
|
|
|
PW_TYPE: API,
|
2020-11-08 17:09:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
assert len(mock_setup_entry.mock_calls) == 1
|
2022-02-05 18:07:02 +00:00
|
|
|
assert len(mock_smile_config_flow.connect.mock_calls) == 1
|
2020-11-08 17:09:43 +00:00
|
|
|
|
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
async def test_zeroconf_flow_stretch(
|
|
|
|
hass: HomeAssistant,
|
|
|
|
mock_setup_entry: AsyncMock,
|
|
|
|
mock_smile_config_flow: MagicMock,
|
|
|
|
) -> None:
|
|
|
|
"""Test config flow for stretch devices."""
|
2020-11-08 17:09:43 +00:00
|
|
|
result = await hass.config_entries.flow.async_init(
|
2021-07-16 16:46:23 +00:00
|
|
|
DOMAIN,
|
|
|
|
context={CONF_SOURCE: SOURCE_ZEROCONF},
|
|
|
|
data=TEST_DISCOVERY2,
|
2020-11-08 17:09:43 +00:00
|
|
|
)
|
2022-02-05 18:07:02 +00:00
|
|
|
assert result.get("type") == RESULT_TYPE_FORM
|
|
|
|
assert result.get("errors") == {}
|
|
|
|
assert result.get("step_id") == "user"
|
|
|
|
assert "flow_id" in result
|
2020-09-06 20:26:14 +00:00
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
result2 = await hass.config_entries.flow.async_configure(
|
|
|
|
result["flow_id"],
|
|
|
|
user_input={CONF_PASSWORD: TEST_PASSWORD},
|
|
|
|
)
|
2020-09-06 20:26:14 +00:00
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
|
|
|
assert result2.get("title") == "Test Smile Name"
|
|
|
|
assert result2.get("data") == {
|
2020-11-08 17:09:43 +00:00
|
|
|
CONF_HOST: TEST_HOST,
|
|
|
|
CONF_PASSWORD: TEST_PASSWORD,
|
|
|
|
CONF_PORT: DEFAULT_PORT,
|
|
|
|
CONF_USERNAME: TEST_USERNAME2,
|
2021-07-16 16:46:23 +00:00
|
|
|
PW_TYPE: API,
|
2020-09-06 20:26:14 +00:00
|
|
|
}
|
|
|
|
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
assert len(mock_setup_entry.mock_calls) == 1
|
2022-02-05 18:07:02 +00:00
|
|
|
assert len(mock_smile_config_flow.connect.mock_calls) == 1
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
|
2021-07-16 16:46:23 +00:00
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
async def test_zercoconf_discovery_update_configuration(hass: HomeAssistant) -> None:
|
2021-10-31 19:19:51 +00:00
|
|
|
"""Test if a discovered device is configured and updated with new host."""
|
|
|
|
entry = MockConfigEntry(
|
|
|
|
domain=DOMAIN,
|
|
|
|
title=CONF_NAME,
|
|
|
|
data={CONF_HOST: "0.0.0.0", CONF_PASSWORD: TEST_PASSWORD},
|
|
|
|
unique_id=TEST_HOSTNAME,
|
|
|
|
)
|
|
|
|
entry.add_to_hass(hass)
|
|
|
|
|
|
|
|
assert entry.data[CONF_HOST] == "0.0.0.0"
|
|
|
|
|
|
|
|
result = await hass.config_entries.flow.async_init(
|
|
|
|
DOMAIN,
|
|
|
|
context={CONF_SOURCE: SOURCE_ZEROCONF},
|
|
|
|
data=TEST_DISCOVERY,
|
|
|
|
)
|
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
assert result.get("type") == RESULT_TYPE_ABORT
|
|
|
|
assert result.get("reason") == "already_configured"
|
2021-10-31 19:19:51 +00:00
|
|
|
assert entry.data[CONF_HOST] == "1.1.1.1"
|
|
|
|
|
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
"side_effect,reason",
|
|
|
|
[
|
|
|
|
(InvalidAuthentication, "invalid_auth"),
|
2022-03-15 07:53:53 +00:00
|
|
|
(InvalidSetupError, "invalid_setup"),
|
2022-02-05 18:07:02 +00:00
|
|
|
(ConnectionFailedError, "cannot_connect"),
|
|
|
|
(PlugwiseException, "cannot_connect"),
|
|
|
|
(RuntimeError, "unknown"),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
async def test_flow_errors(
|
|
|
|
hass: HomeAssistant,
|
|
|
|
mock_setup_entry: AsyncMock,
|
|
|
|
mock_smile_config_flow: MagicMock,
|
|
|
|
side_effect: Exception,
|
|
|
|
reason: str,
|
|
|
|
) -> None:
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
"""Test we handle invalid auth."""
|
|
|
|
result = await hass.config_entries.flow.async_init(
|
2022-02-05 18:07:02 +00:00
|
|
|
DOMAIN,
|
|
|
|
context={CONF_SOURCE: SOURCE_USER},
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
)
|
2022-02-05 18:07:02 +00:00
|
|
|
assert result.get("type") == RESULT_TYPE_FORM
|
|
|
|
assert result.get("errors") == {}
|
|
|
|
assert result.get("step_id") == "user"
|
|
|
|
assert "flow_id" in result
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
mock_smile_config_flow.connect.side_effect = side_effect
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
result2 = await hass.config_entries.flow.async_configure(
|
2020-08-27 11:56:20 +00:00
|
|
|
result["flow_id"],
|
2021-07-16 16:46:23 +00:00
|
|
|
user_input={CONF_HOST: TEST_HOST, CONF_PASSWORD: TEST_PASSWORD},
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
)
|
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
assert result2.get("type") == RESULT_TYPE_FORM
|
|
|
|
assert result2.get("errors") == {"base": reason}
|
|
|
|
assert result2.get("step_id") == "user"
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
assert len(mock_setup_entry.mock_calls) == 0
|
|
|
|
assert len(mock_smile_config_flow.connect.mock_calls) == 1
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
mock_smile_config_flow.connect.side_effect = None
|
|
|
|
result3 = await hass.config_entries.flow.async_configure(
|
2020-08-27 11:56:20 +00:00
|
|
|
result["flow_id"],
|
2021-07-16 16:46:23 +00:00
|
|
|
user_input={CONF_HOST: TEST_HOST, CONF_PASSWORD: TEST_PASSWORD},
|
Update plugwise to async and config_flow (#33691)
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-28 15:52:25 +00:00
|
|
|
)
|
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
assert result3.get("type") == RESULT_TYPE_CREATE_ENTRY
|
|
|
|
assert result3.get("title") == "Test Smile Name"
|
|
|
|
assert result3.get("data") == {
|
|
|
|
CONF_HOST: TEST_HOST,
|
|
|
|
CONF_PASSWORD: TEST_PASSWORD,
|
|
|
|
CONF_PORT: DEFAULT_PORT,
|
|
|
|
CONF_USERNAME: TEST_USERNAME,
|
|
|
|
PW_TYPE: API,
|
|
|
|
}
|
2020-09-06 20:26:14 +00:00
|
|
|
|
2022-02-05 18:07:02 +00:00
|
|
|
assert len(mock_setup_entry.mock_calls) == 1
|
|
|
|
assert len(mock_smile_config_flow.connect.mock_calls) == 2
|