fix(config_flow): no_state_source fires only when none of the three sources is present — ADB-only standalone is valid; strings/docs name all three (F2)
This commit is contained in:
1 parent
3b8e97fe5b
commit
ce90f59f8e
5 files changed
+54
-6
No files matched your search
@@ -128,15 +128,24 @@ class NvidiaShieldConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
self._reauth_entry = None
|
||||
|
||||
async def async_step_user(self, user_input=None):
|
||||
"""Step 1: Basic setup."""
|
||||
"""Step 1: Basic setup.
|
||||
|
||||
Standalone setup (Phase 3): any one of the three state sources is
|
||||
enough — the Android TV Remote entity, the Nvidia Remote Protocol
|
||||
(pairing), or ADB media-session mode (CONF_ADB_ENABLED). The
|
||||
``no_state_source`` error fires only when none of them is present.
|
||||
"""
|
||||
errors = {}
|
||||
|
||||
if user_input is not None:
|
||||
# Standalone setup (Phase 3): the external androidtv media_player
|
||||
# is optional — the protocol push can be the only state source.
|
||||
androidtv_entity = user_input.get(CONF_ANDROIDTV_ENTITY)
|
||||
|
||||
if not androidtv_entity and not user_input.get(CONF_PROTOCOL_ENABLED):
|
||||
has_source = (
|
||||
bool(androidtv_entity)
|
||||
or bool(user_input.get(CONF_PROTOCOL_ENABLED))
|
||||
or bool(user_input.get(CONF_ADB_ENABLED))
|
||||
)
|
||||
if not has_source:
|
||||
errors["base"] = "no_state_source"
|
||||
sel = _build_selectors()
|
||||
return self.async_show_form(
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"protocol_no_host": "Could not determine the Shield's IP address. Set the Protocol Host or ADB Host field.",
|
||||
"protocol_invalid_code": "Pairing has not started or the code is empty. Click Submit to retry.",
|
||||
"protocol_pair_failed": "The Shield rejected that pairing code. Click Submit to try again.",
|
||||
"no_state_source": "No state source selected. Link the Android TV Remote entity or enable the Nvidia Remote Protocol pairing \u2014 the integration needs at least one source of power/app state."
|
||||
"no_state_source": "No state source selected. Provide at least one of: the Android TV Remote entity, the Nvidia Remote Protocol pairing, or ADB media-session mode (enable ADB and set the ADB Host)."
|
||||
},
|
||||
"abort": {
|
||||
"already_configured": "This Shield entity is already configured.",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"protocol_no_host": "Could not determine the Shield's IP address. Set the Protocol Host or ADB Host field.",
|
||||
"protocol_invalid_code": "Pairing has not started or the code is empty. Click Submit to retry.",
|
||||
"protocol_pair_failed": "The Shield rejected that pairing code. Click Submit to try again.",
|
||||
"no_state_source": "No state source selected. Link the Android TV Remote entity or enable the Nvidia Remote Protocol pairing \u2014 the integration needs at least one source of power/app state."
|
||||
"no_state_source": "No state source selected. Provide at least one of: the Android TV Remote entity, the Nvidia Remote Protocol pairing, or ADB media-session mode (enable ADB and set the ADB Host)."
|
||||
},
|
||||
"abort": {
|
||||
"already_configured": "This Shield entity is already configured.",
|
||||
|
||||
Reference in new issue
Block a user