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:
2026-12-01 13:46:19 +02:00
parent f919d6b25b
commit a9f329ffcd
14 changed files with 124 additions and 330 deletions
+3 -32
View File
@@ -13,9 +13,8 @@ before editing; it only records things that are easy to get wrong.
## Stack
- .NET 10 / C# 14 (`LangVersion=14.0`, set per-csproj in the three
executable projects — `HomeAssistant.Server`, `HomeAssistant.McpServer`,
`HomeAssistant.HistoryReplay`; no `Directory.Build.props`). `global.json`
- .NET 10 / C# 14 (`LangVersion=14.0`, set in `HomeAssistant.Server.csproj`;
no `Directory.Build.props`). `global.json`
pins SDK `10.0.0` with `rollForward=latestMajor` and
`allowPrerelease=true`.
- NetDaemon v5 (NuGet `26.11.0`) apps run inside `HomeAssistant.Server`, the
@@ -69,12 +68,6 @@ before editing; it only records things that are easy to get wrong.
(`GlobalMappingProfile`, `NordPoolMappingProfile` + `DateTimeTypeConverter`)
referenced by `HomeAssistant.Server`; wired in `program.cs` via
`config.AddProfile<…>()`. AutoMapper 16.1.1.
- `HomeAssistant.McpServer` is a separate stdio MCP server
(ModelContextProtocol NuGet 1.2.0) exposing HA tools. It is **not**
referenced by the host; it runs standalone via
`dotnet run --project HomeAssistant.McpServer`. It is wired as the
`homeassistant` MCP server in both `.cursor/mcp.json` (git-ignored) and
the committed `opencode.json` at the repo root.
- `HomeAssistant.HistoryReplay` is a Blazor debug web app that replays HA
history through monitor business logic with no side effects. It
references a subset of monitors (Boiler, NordPool, Power, Shower, Light —
@@ -115,23 +108,6 @@ Singletons are only safe for services that take **no** scoped dependency
(pure calculators, trackers with no `IHaContext`). When unsure, register
scoped.
## Live validation after monitor edits
`.cursor/rules/live-validation.mdc` (globs: all `*.Manager`/`*.Models` of
Boiler, Light, NordPool, Power, Shower, plus `HomeAssistant.McpServer` —
**not** Battery or Leak) requires, after editing monitor runtime code:
1. `dotnet build` the affected project.
2. `RunSmokeTest` MCP tool from the `homeassistant` MCP server.
3. `ValidateEntities` for the changed service's critical entities.
Domain → entity mapping is in the rule file. Skip when HA is offline (check
via `check_api`), when changes are tests/docs/non-runtime, or when the user
says to skip. On failure, report the failing entities + states; do not
silently proceed. This rule is Cursor-specific but the intent applies to
OpenCode sessions too — if you have the `homeassistant` MCP server
available, follow the same flow.
## Commands
Build everything:
@@ -152,10 +128,6 @@ Run the host (needs HA reachable + token in `appsettings.Development.json`):
```
dotnet run --project HomeAssistant.Server
```
Run the MCP server standalone:
```
dotnet run --project HomeAssistant.McpServer
```
Run the history replay web app:
```
dotnet run --project HomeAssistant.HistoryReplay
@@ -187,8 +159,7 @@ prints the reminder after publish.
replay tool requires a new project reference there too.
- The repository folder name is misspelled `homeassistant-app-deamon`
(should be `daemon`). This is intentional/legacy — do not "fix" it in
paths; `opencode.json` and `.cursor/mcp.json` reference the workspace
folder by macro.
paths.
- Stale untracked folders `NordPool.Comminication/` and
`HomeAssistant.Infrastructure/` may appear on disk containing only
`obj/` build cruft. They are **not** in the solution, not committed to