Files
2026-06-28 13:58:35 +03:00

97 lines
3.1 KiB
Markdown

# Live Environment Validation
Validate that code changes work correctly against the live Home Assistant instance using MCP tools.
## Triggers
Use when:
- The user says "validate", "check live", "smoke test", "verify live environment"
- After deploying or restarting the app daemon
- After modifying any Monitor/Manager service and wanting to confirm it works
- When the live-validation rule fires (after editing monitor service files)
## Prerequisites
- The Home Assistant instance must be running and reachable
- The `homeassistant` MCP server must be connected in Cursor
## Validation Workflow
### Step 1: Build Verification
Run `dotnet build` for the solution or affected project to confirm compilation succeeds.
```
dotnet build HomeAssistantSDK.sln --no-restore
```
If the build fails, stop and fix compilation errors before proceeding.
### Step 2: API Health Check
Use the `homeassistant` MCP tool `check_api` to verify the HA instance is reachable.
If the API is unreachable, report the failure and stop — no further validation is possible.
### Step 3: Smoke Test
Use the `homeassistant` MCP tool `RunSmokeTest` to run a full environment check:
- Pass the relevant domains based on what was changed
- Check the `overall` field for PASS/FAIL
- Review any unhealthy entities
Domain mapping for changed services:
- **BoilerMonitor** → `switch,sensor,binary_sensor,number,text`
- **LightMonitor** → `light,person,sun`
- **NordPool** → `sensor`
- **PowerMonitor** → `sensor`
- **ShowerMonitor** → `sensor,switch`
### Step 4: Entity-Specific Validation
Based on which service was changed, validate its critical entities using the `ValidateEntities` MCP tool:
**BoilerMonitor entities:**
- `sensor.boilermonitor_status`
- `sensor.boilermonitor_water_ready`
- `sensor.boilermonitor_estimated_temperature`
- `sensor.boilermonitor_heating_percentage`
**LightMonitor entities:**
- `light.sonoff_1002214d40`
- `sun.sun`
- `person.marius`, `person.erika`
**NordPool entities:**
- `sensor.nordpool_current_price`
**PowerMonitor entities:**
- Power sensor entities configured in the system
### Step 5: Behavioral Validation (Optional)
For deeper validation, use the `get_logbook` MCP tool filtered to the relevant entity with a 30-minute window to confirm the service is producing expected state changes.
Use `get_entity_history` for trend validation — verify values are within expected ranges.
### Step 6: Report
Summarize results:
1. Build status (pass/fail)
2. API health (reachable/unreachable)
3. Smoke test result (PASS/FAIL with details)
4. Entity validation results (list any failures)
5. Logbook activity summary (if performed)
If everything passes, confirm with a brief "Live validation passed" message.
If anything fails, list specific failures with entity IDs and current states.
## Browser Validation (HistoryReplay UI)
If the `HomeAssistant.HistoryReplay` Blazor app is running, use the `cursor-ide-browser` MCP to:
1. Navigate to the dashboard URL
2. Take a screenshot to verify charts render correctly
3. Check console for JavaScript errors
This is optional and only applies when HistoryReplay changes are involved.