بنقرة واحدة
test-remote-environment
Test on the Homeassitant Dev envoronment
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Test on the Homeassitant Dev envoronment
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Review the current chat session or recently completed task for reusable implementation or testing lessons, then decide whether to update an existing GitHub instruction and skills, create a new instruction/skill, or store the guidance as repo memory. Use when: finishing a fix, stabilizing a test, capturing a lesson learned, or asking "should we document this for future Copilot sessions?" Triggers on: "lesson learned", "capture lessons learned", "review session for reusable pattern", "update github instruction", "document this fix for future".
Close out a completed docs/tasks/*.md task by validating checklist completion, syncing GitHub issue status/comments, and preparing optional PR summary notes. Triggers on: "close task", "finalize task", "wrap up task 012", "complete docs task".
Automate creation or update of a pull request from the current branch to main, with detailed PR body, task/issue linking, and user prompts for draft/auto-merge. Fallback to commit summary if no task is found.
Create a new task planning document for SRAT. Use when: adding a feature, planning a fix, documenting a refactor, or creating a new TODO item. Produces a <TaskID>_<Title>.md file in docs/tasks/ using the project task template. Triggers on: "create task", "new task", "add task", "plan feature", "create todo", "new issue task", "document work item".
Expert HomeAssistant development skill for creating custom sensors (template, REST, command line, Python components), building Lovelace dashboards with custom cards and layouts, and developing custom integrations with config flows, coordinators, and multiple platforms. Use this skill when working with HomeAssistant YAML configuration, Python integration development, or dashboard customization.
Execute one checklist phase from a docs/tasks/*.md task with strict sequencing: pick exactly one unchecked item, implement only that scope, run targeted validation, and update task progress immediately. Triggers on: "implement next task item", "do task phase", "work on next checklist item", "execute phase 3 of task 012".
| name | test-remote-environment |
| description | Test on the Homeassitant Dev envoronment |
| argument-hint | Describe what to test and whether custom component interaction is needed (e.g., 'test share creation flow, include custom component: yes'). |
Test the SRAT project against the live Home Assistant test environment. Deploys the backend binary via mise //backend:build:remote, starts the frontend dev server with mise run //frontend:dev:remote, controls the local_sambanas2 addon (start/stop/restart) via the Home Assistant MCP, reads addon logs, and browses/validates the UI with Playwright at http://localhost:3080/.
| Requirement | How to verify |
|---|---|
HOMEASSISTANT_IP env var (default 192.168.0.68) | echo ${HOMEASSISTANT_IP:-192.168.0.68} — must return an IP address |
SUPERVISOR_URL env var set | echo ${SUPERVISOR_URL:-http://192.168.0.68/ — must return e.g. http://192.168.0.68/; used to derive API_URL for the frontend dev server |
| SSH access to HA | ssh root@${HOMEASSISTANT_IP:-192.168.0.68} echo ok |
sshfs available for remote mount | which sshfs |
| HA MCP server connected | MCP tools mcp_home-assistan_ha_* or home-assistant-dev must be available |
| Frontend dependencies installed | cd frontend && bun install |
Before running the procedure, decide whether custom component deployment is in scope.
include custom component: yes, with custom component, or similar.include custom component: no, backend-only, or similar.Should I include custom component remote deployment/reload in this test? (yes/no)yes.Run in the backend/ terminal (background, it may take a minute):
mise //backend:build:remote
amd64, then rsyncs the binaries into /addon_configs/local_sambanas2/upgrade/ on the HA host.Remote build and deployment completed. before proceeding.HOMEASSISTANT_IP is not set, ask the user or check .env/shell profile.Use the Home Assistant MCP to restart the addon:
mcp_home-assistan_ha_restart_addon → slug: "local_sambanas2"
Wait ~10 seconds for the addon to fully start before proceeding.
First fetch Home Assistant core logs (this is where custom component Python logs and tracebacks appear):
mcp_home-assistan_ha_core_logs
Then fetch addon logs:
mcp_home-assistan_ha_addon_logs → slug: "local_sambanas2"
Look for:
custom_components.srat import/setup errors, tracebacks, config-entry failures"srat-server started" or equivalent startup messageFATAL or panic linespermission denied errors for the data directoryIf the addon failed to start:
panic stack traces or signal: killed (OOM)Addon control commands:
mcp_home-assistan_ha_stop_addon → slug: "local_sambanas2"
mcp_home-assistan_ha_start_addon → slug: "local_sambanas2"
Only run this step when the argument indicates custom component interaction (or user confirms yes when asked).
Deploy the custom component to the remote HA environment:
cd custom_components && mise run install:remote
Then reload Home Assistant configuration/core as needed via MCP:
mcp_home-assistan_ha_reload_config → component: "core"
Verify no configuration/runtime errors after deploy (check core logs first, then addon logs):
mcp_home-assistan_ha_check_config
mcp_home-assistan_ha_core_logs
mcp_home-assistan_ha_addon_logs → slug: "local_sambanas2"
Look for:
custom_components/sratConfig entry setup failuresERROR/Traceback lines introduced immediately after reloadOnly needed when testing UI changes. Run in the frontend/ terminal (background):
mise run //frontend:dev:remote
API_URL is derived automatically from SUPERVISOR_URL — the script computes ${SUPERVISOR_URL%/}:3000/ (strips trailing slash, appends the SRAT backend port). Ensure SUPERVISOR_URL is set before running.http://localhost:3080/.Bun.serve listening on :3080 before opening the browser.Navigate to the app:
mcp_playwright_browser_navigate → url: "http://localhost:3080/"
Take a screenshot to verify the page loaded:
mcp_playwright_browser_take_screenshot
Then use Playwright tools as needed to interact with the UI:
mcp_playwright_browser_click — click buttons, links, menu itemsmcp_playwright_browser_fill_form — fill in formsmcp_playwright_browser_snapshot — get DOM accessibility snapshot for assertionsmcp_playwright_browser_evaluate — run JavaScript in the page contextmcp_playwright_browser_console_messages — read browser console output (check for JS errors)mcp_playwright_browser_network_requests — inspect API calls and responsesmcp_playwright_browser_wait_for — wait for an element or condition before continuingCommon validation checks:
MUI TreeView / ToggleButtonGroup interaction note:
browser_snapshot may return only RootWebArea for MUI components that use virtual trees or custom rendering (e.g., SimpleTreeView, ToggleButtonGroup)browser_eval with JavaScript DOM queries as a fallback: document.querySelector(...) or React fiber access via __reactFiber$<hash>ToggleButtonGroup clicks, React fiber handler invocation is often the only reliable method (MUI resists synthetic PointerEvent/MouseEvent dispatch)After triggering actions in the UI, re-read logs to catch backend and integration errors:
mcp_home-assistant_ha_core_logs
Then:
mcp_home-assistant_ha_addon_logs → slug: "local_sambanas2"
Look for new ERROR or WARN lines correlating with the UI actions taken.
When testing features that modify backend state (config saves, DB writes) and then read it back via a different API endpoint, stale caches can produce misleading test results. After any state-mutating action (save, create, delete), verify the data is consistent across all read paths.
Known pattern — HardwareService cache (30-min TTL):
SaveDeviceConfig writes to DB but may not invalidate HardwareService cache/api/disk/{id}/hdidle/config reads DB directly (fresh)/api/volumes reads from HardwareService cache (may be stale)supported=falseVerification approach:
mcp_home-assistant_ha_stop_addon → slug: "local_sambanas2"
Wait 5 seconds
mcp_home-assistant_ha_start_addon → slug: "local_sambanas2"
When to apply this step:
mcp_playwright_browser_closeBuild successful?
├── No → Check Go errors, fix, retry Step 1
└── Yes → Addon start OK?
├── No → Read logs (Step 3), stop/start, check again
└── Yes → Custom component included?
├── Yes → Run Step 4 (deploy/reload/check)
└── No → Continue
↓
UI test needed?
├── No → Read logs only (Step 7) — done
└── Yes → Start frontend (Step 5) → Playwright (Step 6) → Logs (Step 7)
| Symptom | Likely cause | Action |
|---|---|---|
HOMEASSISTANT_IP is not set | Env var missing | Set export HOMEASSISTANT_IP=<ip> in the shell |
SUPERVISOR_URL is not set / blank API_URL | Env var missing | Set export SUPERVISOR_URL=http://<ip>/ in the shell |
rsync: connection refused | SSH not running / wrong IP | Verify SSH access manually |
| Custom component errors are missing in addon logs | Looking at wrong log source | Check mcp_home-assistan_ha_core_logs first; custom component Python errors are logged in Home Assistant core logs |
Addon fails to start, signal: killed | OOM or binary mismatch | Check if PPROF port conflicts; rebuild without PPROF=1 |
| Addon fails to start, Mach-O format error | Cross-compilation produced macOS binary | Ensure GOOS=linux is set in all build export sections of backend/.mise.toml (zig-musl, glibc, static) |
| Addon starts but API 404s | Old binary still running | Stop, wait 5 s, start again |
| Custom component fails after deploy | Reload/setup error in HA | Run mcp_home-assistan_ha_check_config, then inspect addon/core logs for traceback and fix component imports/schema |
| Frontend build loop / TS errors | Type error in changed file | Fix the error shown in frontend terminal stdout |
| Playwright blank page | Frontend not yet ready | Wait for Bun.serve listening on :3080 in terminal |
| WebSocket not connecting | Proxy / CORS | Check mise run //frontend:dev:remote stdout for proxy errors |
| Browser console CORS errors | API_URL mismatch | Verify HOMEASSISTANT_IP matches API_URL in .mise.toml dev:remote |
| Individual API returns correct data but list API returns stale/defaults | In-memory cache stale (e.g., HardwareService 30-min cache) | Restart addon to clear cache, re-read from list endpoint; file bug if Save* methods don't call Invalidate* |
| UI panel hidden despite correct DB data | Backend cache stale → supported=false → frontend visibility gate blocks rendering | Restart addon, verify panel appears; report as cache invalidation bug |
| Direct API access needed | Cannot reach backend API externally | Use docker exec addon_local_sambanas2 curl -sL http://localhost:64289/api/... from the HA host (no auth required — internal-only API) |
smbpasswd -L fails / shows help | smbpasswd -L is broken in the addon container | Use pdbedit -a -u <username> instead to set Samba passwords; pdbedit -L to list existing users |
Use this when custom component behavior is unclear and you need deeper diagnostics.
configuration.yaml (test environment):logger:
default: info
logs:
custom_components.srat: debug
custom_components.srat.websocket_client: debug
custom_components.srat.coordinator: debug
mcp_home-assistan_ha_reload_config → component: "core"
mcp_home-assistan_ha_core_logs
mcp_home-assistan_ha_addon_logs → slug: "local_sambanas2"
info (or remove them) to avoid noisy logs.Notes:
Get detailed addon state (version, options, state):
mcp_home-assistan_ha_addon_info → slug: "local_sambanas2"
Update addon options before restart:
mcp_home-assistan_ha_set_addon_options → slug: "local_sambanas2", options: { ... }
Test: "Validate backend API changes for share creation"
Custom component: "include custom component: no"
Test: "Test share creation UI flow with custom component"
Custom component: "include custom component: yes"
Test: "Quick validation of addon after build"
Custom component: "include custom component: no" (will ask if unsure)
This skill returns a comprehensive test report including:
This skill gracefully handles:
All errors are logged with actionable guidance, and the skill provides clear next steps for resolution.