Remove the MCP server and split NordPool today/tomorrow fetch decisions
- Drop the HomeAssistant.McpServer wiring from opencode.json along with the Cursor live-validation hook, rule and skill; update AGENTS.md and README - Rename ShouldFetchNewPrices to ShouldFetchTodaysPrices and add a separate ShouldFetchTomorrowPrice that waits until the CET publish hour (TomorrowPricesPublishHour) - Inject TimeProvider into NordPoolPriceService, use the CET zone for the current date and record fetch timestamps from it - Rework the NordPool tests around FakeTimeProvider and cover fetching only today before the publish hour
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"version": 1,
|
||||
"hooks": {
|
||||
"afterShellExecution": [
|
||||
{
|
||||
"command": "powershell -ExecutionPolicy Bypass -File .cursor/hooks/scripts/after-build-validate.ps1"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
$input = [Console]::In.ReadToEnd()
|
||||
$context = $input | ConvertFrom-Json
|
||||
|
||||
$command = $context.command
|
||||
if (-not $command) { exit 0 }
|
||||
|
||||
$buildPatterns = @('dotnet build', 'dotnet run', 'dotnet publish')
|
||||
$isBuildCommand = $false
|
||||
|
||||
foreach ($pattern in $buildPatterns) {
|
||||
if ($command -match [regex]::Escape($pattern)) {
|
||||
$isBuildCommand = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $isBuildCommand) { exit 0 }
|
||||
|
||||
$response = @{
|
||||
message = "[Live Validation] Build command detected. Run live environment validation using the homeassistant MCP tools: 1) check_api to verify HA is reachable, 2) RunSmokeTest for a full health check, 3) ValidateEntities for the critical entities of the changed service."
|
||||
} | ConvertTo-Json -Compress
|
||||
|
||||
Write-Output $response
|
||||
exit 0
|
||||
@@ -1,46 +0,0 @@
|
||||
---
|
||||
description: Require live environment validation after modifying monitor services
|
||||
globs:
|
||||
- "BoilerMonitor.Manager/**/*.cs"
|
||||
- "BoilerMonitor.Models/**/*.cs"
|
||||
- "LightMonitor.Manager/**/*.cs"
|
||||
- "LightMonitor.Models/**/*.cs"
|
||||
- "NordPool.Manager/**/*.cs"
|
||||
- "NordPool.Models/**/*.cs"
|
||||
- "PowerMonitor.Manager/**/*.cs"
|
||||
- "PowerMonitor.Models/**/*.cs"
|
||||
- "ShowerMonitor.Manager/**/*.cs"
|
||||
- "ShowerMonitor.Models/**/*.cs"
|
||||
- "HomeAssistant.McpServer/**/*.cs"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Live Validation Required
|
||||
|
||||
After modifying any Monitor service, Manager, or Models code, the agent MUST validate the change works in the live Home Assistant environment before considering the task complete.
|
||||
|
||||
## Mandatory Steps
|
||||
|
||||
1. **Build** — run `dotnet build` on the affected project to confirm compilation.
|
||||
2. **Smoke test** — use the `RunSmokeTest` MCP tool (from the `homeassistant` MCP server) with domains relevant to the changed service.
|
||||
3. **Entity check** — use `ValidateEntities` to confirm critical entities for the changed service are not `unavailable` or `unknown`.
|
||||
|
||||
## Domain Mapping
|
||||
|
||||
| Service Changed | MCP Domains to Check |
|
||||
|---|---|
|
||||
| BoilerMonitor | `switch,sensor,binary_sensor` |
|
||||
| LightMonitor | `light,person,sun` |
|
||||
| NordPool | `sensor` |
|
||||
| PowerMonitor | `sensor` |
|
||||
| ShowerMonitor | `sensor,switch` |
|
||||
|
||||
## When to Skip
|
||||
|
||||
- If the Home Assistant instance is offline (check via `check_api` first)
|
||||
- If changes are purely to unit tests, documentation, or non-runtime code
|
||||
- If the user explicitly says to skip validation
|
||||
|
||||
## On Failure
|
||||
|
||||
Report the specific entities that failed validation and their current states. Do not silently proceed.
|
||||
@@ -1,96 +0,0 @@
|
||||
# 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.
|
||||
Reference in New Issue
Block a user