a9f329ffcd
- 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
57 lines
2.1 KiB
C#
57 lines
2.1 KiB
C#
namespace NordPool.Models;
|
|
|
|
public static class NordPoolConsts
|
|
{
|
|
public const string ConfigEntry = "01K9HYQE4Y0E7KC36JZV11MEXH";
|
|
|
|
/// <summary>
|
|
/// NordPool electricity market uses 15-minute trading intervals.
|
|
/// </summary>
|
|
public const int MinutesPerInterval = 15;
|
|
|
|
/// <summary>
|
|
/// Number of 15-minute intervals in one hour.
|
|
/// </summary>
|
|
public const int IntervalsPerHour = 4;
|
|
|
|
/// <summary>
|
|
/// Maximum number of 15-minute intervals in a single day (96 = 24h * 4).
|
|
/// </summary>
|
|
public const int MaxDailyIntervals = 96;
|
|
|
|
/// <summary>
|
|
/// Maximum expected price entries when today and tomorrow are both available
|
|
/// (96 intervals per day x 2 days). Used for logging a warning if exceeded.
|
|
/// </summary>
|
|
public const int MaxExpectedPriceEntries = 192;
|
|
|
|
public const string DeviceIdentifier = "nordpool";
|
|
public const string DeviceName = "NordPool";
|
|
public const string DeviceManufacturer = "HomeAssistant App Daemon";
|
|
|
|
/// <summary>
|
|
/// Home Assistant entity id for the Nord Pool current price sensor published by this integration.
|
|
/// </summary>
|
|
public const string CurrentPriceEntityId = "sensor.nordpool_current_price";
|
|
|
|
/// <summary>
|
|
/// Home Assistant entity id for the button that triggers a manual NordPool price fetch + entity update.
|
|
/// </summary>
|
|
public const string FetchPricesButtonEntityId = "button.nordpool_fetch_prices";
|
|
|
|
/// <summary>
|
|
/// NordPool publishes tomorrow's prices in the afternoon; before this CET hour the API
|
|
/// has nothing to return for tomorrow, so polling it is pointless.
|
|
/// </summary>
|
|
public const int TomorrowPricesPublishHour = 13;
|
|
|
|
/// <summary>
|
|
/// Maximum number of retry attempts when fetching prices from the NordPool API.
|
|
/// </summary>
|
|
public const int MaxFetchRetryAttempts = 3;
|
|
|
|
/// <summary>
|
|
/// Base delay in seconds between retry attempts (used with exponential backoff).
|
|
/// </summary>
|
|
public const int RetryBaseDelaySeconds = 5;
|
|
} |