Replies: 10 comments 2 replies
ℹ️ Information Needed
💡 Please reply to this issue with the requested information. 🤖 Automated triage by Issue Bot |
|
99% of the time you can actually create things thru the UI, your AI is probably misleading you. Every AI I have used with HA has been notorious for suggesting to write things in yaml based on old training, but most things can be achieved thru the UI. Sounds like what you're describing could be a helper made thru the UI, and our config set helper tool could help with that. We do have a yaml writing tool that can write to packages folder but it's beta/dev server only because it is extremely dangerous, due to the AI hallucinating and thinking that they just write to yaml even though they don't; they often will write broken or old buggy code that can brick your installation. So I recommend not using that, and I recommend pushing back on whatever your AI is and saying "no, this can be made in the UI" and eventually it'll figure it out. Even after all of the optimizations I've made on my own personal AI and ha-mcp setup it still will occasionally recommend writing to yaml or will tell me I have to manually copy and paste something, when in reality it was possible via the UI the whole time... Usually I have to push back 2-3 times and tell it it's wrong and it's possible thru the UI and to think harder, eventually it finds the proper tools. |
|
I'm pretty wel verder in writing templates myself And no, specifically a device tracker is something I don't think you can write through the UI Also getting a to-do list itemized properly requires calling a service/action so my ai actually tries to scriptify this in a ui version but those don't actually work (or at best with so little data it isn't usable) |
|
Based on my analysis of the codebase, the user is requesting expanded filesystem and configuration access to support Home Assistant packages. Currently, 🔍 AnalysisThe user wants to interact with the Home Assistant To support this feature, we need to:
🛠️ Suggested Steps
📊 Technical Analysis (for maintainers)Root CauseThe restriction is hardcoded in both the
Affected Code
Proposed Fix--- a/custom_components/ha_mcp_tools/const.py
+++ b/custom_components/ha_mcp_tools/const.py
@@ -6,8 +6,8 @@
DOMAIN = "ha_mcp_tools"
# Allowed directories for file operations (relative to config dir)
-ALLOWED_READ_DIRS = ["www", "themes", "custom_templates", "dashboards"]
-ALLOWED_WRITE_DIRS = ["www", "themes", "custom_templates", "dashboards"]
+ALLOWED_READ_DIRS = ["www", "themes", "custom_templates", "dashboards", "packages"]
+ALLOWED_WRITE_DIRS = ["www", "themes", "custom_templates", "dashboards", "packages"]
# Files allowed for managed YAML editing
ALLOWED_YAML_CONFIG_FILES = ["configuration.yaml"]
@@ -32,6 +32,9 @@
"notify",
"group",
"utility_meter",
+ "device_tracker",
+ "automation",
+ "script",
}
)
@@ -52,6 +55,14 @@
"post_action": "reload_available",
"reload_service": "group.reload",
},
+ "automation": {
+ "post_action": "reload_available",
+ "reload_service": "automation.reload",
+ },
+ "script": {
+ "post_action": "reload_available",
+ "reload_service": "script.reload",
+ },
}
# Default for keys not in YAML_KEY_POST_ACTIONS:
YAML_KEY_DEFAULT_POST_ACTION = {"post_action": "restart_required"}
--- a/src/ha_mcp/tools/tools_filesystem.py
+++ b/src/ha_mcp/tools/tools_filesystem.py
@@ -40,7 +40,7 @@
"custom_components/**/*.py",
]
-WRITABLE_DIRS = ["www", "themes", "custom_templates", "dashboards"]
+WRITABLE_DIRS = ["www", "themes", "custom_templates", "dashboards", "packages"]
def is_filesystem_tools_enabled() -> bool:
@@ -93,11 +93,11 @@
Field(
description=(
"Relative directory path from config directory. "
- "Allowed paths: www/, themes/, custom_templates/, dashboards/. "
+ "Allowed paths: www/, themes/, custom_templates/, dashboards/, packages/. "
"Example: 'www/' or 'themes/my_theme'"
),
),
],
@@ -107,7 +107,7 @@
) -> dict[str, Any]:
"""List files in a directory within the Home Assistant config directory.
- Lists files in allowed directories (www/, themes/, custom_templates/, dashboards/) with
+ Lists files in allowed directories (www/, themes/, custom_templates/, dashboards/, packages/) with
optional glob pattern filtering. Returns file names, sizes, and modification times.
**Allowed Directories:**
@@ -115,6 +115,7 @@
- `themes/` - Theme files
- `custom_templates/` - Jinja2 template files
- `dashboards/` - YAML-mode dashboard files
+ - `packages/` - Package configuration files
**Security:** Only directories in the allowed list can be accessed.Related Issues/PRs
🤖 Automated analysis by Issue Bot |
|
Can you give some specific examples of what you're trying to do with the device tracker may be template only? There are some cases still that require templates and direct yaml but they're few and far between, and often have workarounds. I won't be able to tell you for sure though without a concrete example. As for the todo stuff, we have tools specific for the todo list that should be working fine. If they aren't working properly then please ask your AI to use the ha report issue tool after you've used the todo tool and it failed to work, then submit the issue here, the. we can see what we can do to Improve the tools. Also what AI and model are you using? Some behavior can be from poor agent behavior. Our tools are mostly optimized for use with Claude, but we're trying to make them more friendly to other AIs as well. |
|
@VPelt I'm going to go ahead and close this and convert this to a discussion, since the functionality you are asking for exists in our beta/dev server. If I'm wrong or if you are looking for something else then please feel free to reopen an issue. I'd still like those examples of what you're trying to build too please, that way I can either show you how it's possible using helpers instead of templates, or you can show me that I'm wrong lol one way or the other... If I'm wrong then I'll reconsider doing a very limited version of the yaml writing tool on the stable version to only write to packages folder. |
|
For todo: for my devicde tracker i got something like this |
|
also i have a shell cleanup function that cleans up old images |
|
Tested both of your template examples on my live HA — both can be done without templates using UI-configured tools. Device tracker override (no template needed):
That produces a real Todo single-item dashboard (no template needed): I verified end-to-end on my own HA:
Shell command: you're right that there's no clean UI alternative for Both helpers are creatable via the UI today (or via ha-mcp's |
|
And again if you want to stick with yaml that's fine, you can switch to dev/master version to use the yaml editing tool, just keep in mind that it is very dangerous and is likely to cause problems, that's why I push doing it via UI so hard. |
Uh oh!
There was an error while loading. Please reload this page.
What would you like to see?
It would be nice if mcp could create templates/scripts/etc in a /package folder
The reason is twofold
Why do you need this?
Certain templates are not creatable through UI
Additional context
No response
All reactions