Support vizio pairing through config flow (#31520)
* support pairing through config flow * simplify import failure log messages * remove unnecessary list comprehension * bump pyvizio to add passing ClientSession in where it was missed * show different message if user completes pairing through import * remove dupe failure message since reasons for failure are the same in both instances * remove extra constant * add host reachability check during pairing workflow * revert redundant connection check since check is implicitly done during pairing process * fix rebase errors * fix string * updates based on review * update docstring * missed commit * update import confirmation message to be less wordy * use ConfigFlow _abort_if_unique_id_configured * fix test
This commit is contained in:
1 parent
03d8abe1ba
commit
b9fa32444a
6 files changed
+388
-67
No files matched your search
@@ -12,6 +12,7 @@ from homeassistant.const import (
|
||||
CONF_DEVICE_CLASS,
|
||||
CONF_HOST,
|
||||
CONF_NAME,
|
||||
CONF_PIN,
|
||||
CONF_PORT,
|
||||
CONF_TYPE,
|
||||
)
|
||||
@@ -29,6 +30,30 @@ UNIQUE_ID = "testid"
|
||||
MODEL = "model"
|
||||
VERSION = "version"
|
||||
|
||||
CH_TYPE = 1
|
||||
RESPONSE_TOKEN = 1234
|
||||
PIN = "abcd"
|
||||
|
||||
|
||||
class MockStartPairingResponse(object):
|
||||
"""Mock Vizio start pairing response."""
|
||||
|
||||
def __init__(self, ch_type: int, token: int) -> None:
|
||||
"""Initialize mock start pairing response."""
|
||||
self.ch_type = ch_type
|
||||
self.token = token
|
||||
|
||||
|
||||
class MockCompletePairingResponse(object):
|
||||
"""Mock Vizio complete pairing response."""
|
||||
|
||||
def __init__(self, auth_token: str) -> None:
|
||||
"""Initialize mock complete pairing response."""
|
||||
self.auth_token = auth_token
|
||||
|
||||
|
||||
MOCK_PIN_CONFIG = {CONF_PIN: PIN}
|
||||
|
||||
MOCK_USER_VALID_TV_CONFIG = {
|
||||
CONF_NAME: NAME,
|
||||
CONF_HOST: HOST,
|
||||
|
||||
Reference in new issue
Block a user