feat: adb_command is a conforming action — always registered in async_setup (option gates USE), services.yaml with required command/entity, strings services+exceptions, ServiceValidationError on empty/unknown-target/ADB-down; participant registry stays (t29 G8)
This commit is contained in:
1 parent
e51545262e
commit
3e0208789a
3 files changed
+344
-54
No files matched your search
+25
-2
@@ -15,6 +15,7 @@ ENTITIES_STUB_NAMES = (
|
||||
"voluptuous",
|
||||
"homeassistant",
|
||||
"homeassistant.config_entries",
|
||||
"homeassistant.exceptions",
|
||||
"homeassistant.core",
|
||||
"homeassistant.const",
|
||||
"homeassistant.components",
|
||||
@@ -134,6 +135,17 @@ def install() -> None:
|
||||
config_entries.OptionsFlow = type("OptionsFlow", (), {})
|
||||
sys.modules["homeassistant.config_entries"] = config_entries
|
||||
|
||||
exceptions = types.ModuleType("homeassistant.exceptions")
|
||||
|
||||
class ServiceValidationErrorStubError(Exception):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args or (kwargs.get("translation_key"),))
|
||||
self.translation_domain = kwargs.get("translation_domain")
|
||||
self.translation_key = kwargs.get("translation_key")
|
||||
|
||||
exceptions.ServiceValidationError = ServiceValidationErrorStubError
|
||||
sys.modules["homeassistant.exceptions"] = exceptions
|
||||
|
||||
core = types.ModuleType("homeassistant.core")
|
||||
core.HomeAssistant = object
|
||||
core.callback = lambda fn: fn
|
||||
@@ -216,9 +228,20 @@ def load_entity_modules() -> dict:
|
||||
install()
|
||||
from conftest import _SHIELD_DIR, _load_module
|
||||
|
||||
for name in ("helpers", "power", "jellyfin", "media_player", "remote", "diagnostics"):
|
||||
for name in (
|
||||
"helpers",
|
||||
"power",
|
||||
"jellyfin",
|
||||
"media_player",
|
||||
"remote",
|
||||
"diagnostics",
|
||||
"init",
|
||||
): # "init" maps the integration __init__.py (t29 G8 async_setup)
|
||||
if name == "init" and "nsh.init" in sys.modules:
|
||||
continue
|
||||
if f"nsh.{name}" not in sys.modules:
|
||||
_load_module(f"nsh.{name}", _SHIELD_DIR / f"{name}.py")
|
||||
file_name = "__init__.py" if name == "init" else f"{name}.py"
|
||||
_load_module(f"nsh.{name}", _SHIELD_DIR / file_name)
|
||||
return {
|
||||
name: sys.modules[f"nsh.{name}"]
|
||||
for name in ("power", "jellyfin", "media_player", "remote", "diagnostics")
|
||||
|
||||
Reference in new issue
Block a user