ha-mcp-dev 7.6.0.dev639__tar.gz → 7.6.0.dev641__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ha_mcp_dev-7.6.0.dev639/src/ha_mcp_dev.egg-info → ha_mcp_dev-7.6.0.dev641}/PKG-INFO +1 -1
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/pyproject.toml +1 -2
- ha_mcp_dev-7.6.0.dev641/src/ha_mcp/tools/smart_search/__init__.py +62 -0
- ha_mcp_dev-7.6.0.dev641/src/ha_mcp/tools/smart_search/_base.py +38 -0
- ha_mcp_dev-7.6.0.dev641/src/ha_mcp/tools/smart_search/_config.py +73 -0
- ha_mcp_dev-7.6.0.dev641/src/ha_mcp/tools/smart_search/_deep.py +767 -0
- ha_mcp_dev-7.6.0.dev641/src/ha_mcp/tools/smart_search/_entities.py +559 -0
- ha_mcp_dev-7.6.0.dev641/src/ha_mcp/tools/smart_search/_fetch.py +150 -0
- ha_mcp_dev-7.6.0.dev641/src/ha_mcp/tools/smart_search/_overview.py +506 -0
- ha_mcp_dev-7.6.0.dev641/src/ha_mcp/tools/smart_search/_scenes.py +306 -0
- ha_mcp_dev-7.6.0.dev641/src/ha_mcp/tools/smart_search/_scoring.py +161 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_bug_report.py +8 -2
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/utils/usage_logger.py +71 -1
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641/src/ha_mcp_dev.egg-info}/PKG-INFO +1 -1
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp_dev.egg-info/SOURCES.txt +9 -1
- ha_mcp_dev-7.6.0.dev639/src/ha_mcp/tools/smart_search.py +0 -2265
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/LICENSE +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/MANIFEST.in +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/README.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/setup.cfg +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/__init__.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/__main__.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/_pypi_marker +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/_version.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/auth/__init__.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/auth/consent_form.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/auth/provider.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/backup_manager.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/client/__init__.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/client/rest_client.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/client/supervisor_client.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/client/websocket_client.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/client/websocket_listener.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/config.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/errors.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/policy/__init__.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/policy/approval_queue.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/policy/evaluator.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/policy/handlers.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/policy/middleware.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/policy/model.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/policy/persistence.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/policy/value_sources.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/py.typed +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/.claude/settings.json +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/.claude-plugin/marketplace.json +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/.claude-plugin/plugin.json +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/.github/ISSUE_TEMPLATE/skill-rca.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/.github/pull_request_template.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/AGENTS.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/CLAUDE.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/CONTRIBUTING.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/LICENSE +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/README.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/skills/home-assistant-best-practices/SKILL.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/skills/home-assistant-best-practices/evals/evals.json +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/skills/home-assistant-best-practices/references/automation-patterns.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/skills/home-assistant-best-practices/references/dashboard-cards.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/skills/home-assistant-best-practices/references/dashboard-guide.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/skills/home-assistant-best-practices/references/device-control.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/skills/home-assistant-best-practices/references/domain-docs.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/skills/home-assistant-best-practices/references/examples.yaml +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/skills/home-assistant-best-practices/references/helper-selection.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/skills/home-assistant-best-practices/references/safe-refactoring.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/skills/home-assistant-best-practices/references/template-guidelines.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/resources/skills-vendor/skills/home-assistant-best-practices/references/yaml-only-integrations.md +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/server.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/settings.css +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/settings.js +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/settings_ui.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/smoke_test.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/stdio_settings_sidecar.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/__init__.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/auto_backup.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/backup.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/best_practice_checker.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/device_control.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/enhanced.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/helpers.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/reference_validator.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/registry.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_addons.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_areas.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_blueprints.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_calendar.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_camera.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_categories.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_code.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_config_automations.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_config_dashboards.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_config_entry_flow.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_config_helpers.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_config_scenes.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_config_scripts.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_energy.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_entities.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_filesystem.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_groups.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_hacs.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_history.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_integrations.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_labels.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_mcp_component.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_registry.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_resources.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_search.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_service.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_services.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_system.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_todo.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_traces.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_updates.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_utility.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_voice_assistant.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_yaml_config.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/tools_zones.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/util_helpers.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/tools/validation_middleware.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/transforms/__init__.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/transforms/categorized_search.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/transforms/lite_docstrings.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/utils/__init__.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/utils/config_hash.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/utils/data_paths.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/utils/domain_handlers.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/utils/fuzzy_search.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/utils/kill_signal_diagnostics.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/utils/operation_manager.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/utils/python_sandbox.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp/utils/skill_loader.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp_dev.egg-info/dependency_links.txt +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp_dev.egg-info/entry_points.txt +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp_dev.egg-info/requires.txt +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/src/ha_mcp_dev.egg-info/top_level.txt +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/tests/__init__.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/tests/test_constants.py +0 -0
- {ha_mcp_dev-7.6.0.dev639 → ha_mcp_dev-7.6.0.dev641}/tests/test_env_manager.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ha-mcp-dev"
|
|
7
|
-
version = "7.6.0.
|
|
7
|
+
version = "7.6.0.dev641"
|
|
8
8
|
description = "Home Assistant MCP Server - Complete control of Home Assistant through MCP"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.13,<3.14"
|
|
@@ -150,7 +150,6 @@ ignore = [
|
|
|
150
150
|
"src/ha_mcp/tools/tools_entities.py" = ["C901"]
|
|
151
151
|
"src/ha_mcp/tools/tools_registry.py" = ["C901"]
|
|
152
152
|
"src/ha_mcp/tools/tools_search.py" = ["C901"]
|
|
153
|
-
"src/ha_mcp/tools/smart_search.py" = ["C901"]
|
|
154
153
|
|
|
155
154
|
[tool.pytest.ini_options]
|
|
156
155
|
testpaths = ["tests"]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Smart search tools for Home Assistant MCP server.
|
|
2
|
+
|
|
3
|
+
The implementation is split across sibling modules to keep each unit
|
|
4
|
+
focused (see issue #925):
|
|
5
|
+
|
|
6
|
+
- ``_search_config``: shared constants and pure helpers
|
|
7
|
+
- ``_search_base``: attributes shared across mixins + registry-list helper
|
|
8
|
+
- ``_search_deep``: ``deep_search`` (config-definition search)
|
|
9
|
+
- ``_search_overview``: ``get_system_overview``
|
|
10
|
+
- ``_search_entities``: ``smart_entity_search`` + ``get_entities_by_area``
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import logging
|
|
14
|
+
|
|
15
|
+
from ...client.rest_client import HomeAssistantClient
|
|
16
|
+
from ...config import get_global_settings
|
|
17
|
+
from ...utils.fuzzy_search import create_fuzzy_searcher
|
|
18
|
+
|
|
19
|
+
# Re-export shared constants so existing ``smart_search.<CONST>`` references
|
|
20
|
+
# keep resolving.
|
|
21
|
+
from ._config import (
|
|
22
|
+
AUTOMATION_CONFIG_TIME_BUDGET,
|
|
23
|
+
BULK_REST_TIMEOUT,
|
|
24
|
+
BULK_WEBSOCKET_TIMEOUT,
|
|
25
|
+
DEFAULT_CONCURRENCY_LIMIT,
|
|
26
|
+
INDIVIDUAL_CONFIG_TIMEOUT,
|
|
27
|
+
INDIVIDUAL_FETCH_BATCH_SIZE,
|
|
28
|
+
SCENE_CONFIG_TIME_BUDGET,
|
|
29
|
+
SCRIPT_CONFIG_TIME_BUDGET,
|
|
30
|
+
)
|
|
31
|
+
from ._deep import DeepSearchMixin
|
|
32
|
+
from ._entities import EntitySearchMixin
|
|
33
|
+
from ._overview import SystemOverviewMixin
|
|
34
|
+
|
|
35
|
+
logger = logging.getLogger(__name__)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class SmartSearchTools(DeepSearchMixin, SystemOverviewMixin, EntitySearchMixin):
|
|
39
|
+
"""Smart search tools with fuzzy matching and AI optimization."""
|
|
40
|
+
|
|
41
|
+
def __init__(
|
|
42
|
+
self, client: HomeAssistantClient | None = None, fuzzy_threshold: int = 60
|
|
43
|
+
):
|
|
44
|
+
"""Initialize with Home Assistant client."""
|
|
45
|
+
# Always load settings for configuration access
|
|
46
|
+
self.settings = get_global_settings()
|
|
47
|
+
|
|
48
|
+
# Use provided client or create new one
|
|
49
|
+
if client is None:
|
|
50
|
+
self.client = HomeAssistantClient()
|
|
51
|
+
fuzzy_threshold = self.settings.fuzzy_threshold
|
|
52
|
+
else:
|
|
53
|
+
self.client = client
|
|
54
|
+
|
|
55
|
+
self.fuzzy_searcher = create_fuzzy_searcher(threshold=fuzzy_threshold)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def create_smart_search_tools(
|
|
59
|
+
client: HomeAssistantClient | None = None,
|
|
60
|
+
) -> SmartSearchTools:
|
|
61
|
+
"""Create smart search tools instance."""
|
|
62
|
+
return SmartSearchTools(client)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Shared base for the smart-search feature mixins.
|
|
2
|
+
|
|
3
|
+
``_SearchBase`` declares the instance attributes that
|
|
4
|
+
``SmartSearchTools.__init__`` sets, so each feature mixin type-checks in
|
|
5
|
+
isolation, and hosts the registry-list helper shared by the overview and
|
|
6
|
+
entity/area search mixins.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import logging
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
from ...client.rest_client import HomeAssistantClient
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class _SearchBase:
|
|
18
|
+
"""Attributes set by ``SmartSearchTools.__init__`` plus shared helpers."""
|
|
19
|
+
|
|
20
|
+
client: HomeAssistantClient
|
|
21
|
+
fuzzy_searcher: Any
|
|
22
|
+
settings: Any
|
|
23
|
+
|
|
24
|
+
@staticmethod
|
|
25
|
+
def _extract_registry_list(result: Any, label: str) -> list[dict[str, Any]]:
|
|
26
|
+
"""Unwrap a WS registry-list result, returning ``[]`` on error/failure.
|
|
27
|
+
|
|
28
|
+
Exceptions are logged at debug because every caller treats missing
|
|
29
|
+
registry data as non-fatal rather than raising: the overview degrades
|
|
30
|
+
its area enrichment, and the area search degrades to "no match found".
|
|
31
|
+
"""
|
|
32
|
+
if isinstance(result, Exception):
|
|
33
|
+
logger.debug(f"Could not fetch {label}: {result}")
|
|
34
|
+
return []
|
|
35
|
+
if isinstance(result, dict) and result.get("success"):
|
|
36
|
+
registry: list[dict[str, Any]] = result.get("result", [])
|
|
37
|
+
return registry
|
|
38
|
+
return []
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""Shared constants and pure helpers for the smart-search modules.
|
|
2
|
+
|
|
3
|
+
This module imports nothing from the ``ha_mcp.tools`` package so the
|
|
4
|
+
smart-search mixins and the public ``smart_search`` shell can both depend
|
|
5
|
+
on it without creating an import cycle.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import logging
|
|
9
|
+
import os
|
|
10
|
+
|
|
11
|
+
logger = logging.getLogger(__name__)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# Default concurrency limit for parallel operations
|
|
15
|
+
DEFAULT_CONCURRENCY_LIMIT = 20
|
|
16
|
+
|
|
17
|
+
# Bulk fetch timeouts (in seconds)
|
|
18
|
+
BULK_REST_TIMEOUT = 5.0 # Timeout for bulk REST endpoint calls
|
|
19
|
+
BULK_WEBSOCKET_TIMEOUT = 3.0 # Timeout for bulk WebSocket calls
|
|
20
|
+
INDIVIDUAL_CONFIG_TIMEOUT = 5.0 # Timeout for individual config fetches
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# Time budgets for fallback individual fetching (in seconds).
|
|
24
|
+
# Configurable via env vars for instances with many automations/scripts.
|
|
25
|
+
def _env_float(key: str, default: float) -> float:
|
|
26
|
+
raw = os.environ.get(key)
|
|
27
|
+
if raw is None:
|
|
28
|
+
return default
|
|
29
|
+
try:
|
|
30
|
+
return float(raw)
|
|
31
|
+
except (ValueError, TypeError):
|
|
32
|
+
logger.warning(f"Invalid value for {key}={raw!r}, using default {default}")
|
|
33
|
+
return default
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
AUTOMATION_CONFIG_TIME_BUDGET = _env_float("HAMCP_AUTOMATION_CONFIG_TIME_BUDGET", 30.0)
|
|
37
|
+
SCRIPT_CONFIG_TIME_BUDGET = _env_float("HAMCP_SCRIPT_CONFIG_TIME_BUDGET", 20.0)
|
|
38
|
+
SCENE_CONFIG_TIME_BUDGET = _env_float("HAMCP_SCENE_CONFIG_TIME_BUDGET", 20.0)
|
|
39
|
+
|
|
40
|
+
# Batch size for parallel individual config fetches (Attempt C fallback)
|
|
41
|
+
INDIVIDUAL_FETCH_BATCH_SIZE = 10
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _simplify_states_summary(
|
|
45
|
+
states_summary: dict[str, int],
|
|
46
|
+
detail_level: str,
|
|
47
|
+
max_states: int | None = None,
|
|
48
|
+
) -> dict[str, int]:
|
|
49
|
+
"""Keep only the most common states, aggregate the rest into _other.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
states_summary: Original {state: count} mapping.
|
|
53
|
+
detail_level: "minimal", "standard", or "full".
|
|
54
|
+
max_states: Override cap (None = 5 for minimal, 10 for standard).
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
Capped states_summary with ``_other`` count when truncated.
|
|
58
|
+
"""
|
|
59
|
+
if detail_level == "full":
|
|
60
|
+
return states_summary
|
|
61
|
+
|
|
62
|
+
if max_states is None:
|
|
63
|
+
max_states = 5 if detail_level == "minimal" else 10
|
|
64
|
+
|
|
65
|
+
if len(states_summary) <= max_states:
|
|
66
|
+
return states_summary
|
|
67
|
+
|
|
68
|
+
sorted_states = sorted(states_summary.items(), key=lambda x: x[1], reverse=True)
|
|
69
|
+
top = dict(sorted_states[:max_states])
|
|
70
|
+
other_count = sum(count for _, count in sorted_states[max_states:])
|
|
71
|
+
if other_count > 0:
|
|
72
|
+
top["_other"] = other_count
|
|
73
|
+
return top
|