Add shared test data builders and Qodana configuration
- Extract per-monitor *TestData helper classes and rework tests to use them - Add boiler run-time tracker abstraction (implementation pending) - Drop unused NordPool init/update-result types and stale PLAN.md - Add qodana.yaml with the inspection set to keep the analysis focused
This commit is contained in:
@@ -29,7 +29,7 @@ public sealed class BoilerConfigReader(IHaContext haContext, ILogger<BoilerConfi
|
||||
var deadline = DateTime.Today.AddDays(1);
|
||||
var readyByState = haContext.GetState(BoilerReadyByEntityId)?.State;
|
||||
|
||||
if (!string.IsNullOrEmpty(readyByState) && TimeSpan.TryParse(readyByState, out var readyByTime))
|
||||
if (!string.IsNullOrEmpty(readyByState) && TimeSpan.TryParse(readyByState, CultureInfo.InvariantCulture, out var readyByTime))
|
||||
{
|
||||
deadline = DateTime.Today.Add(readyByTime);
|
||||
}
|
||||
@@ -47,7 +47,6 @@ public sealed class BoilerConfigReader(IHaContext haContext, ILogger<BoilerConfi
|
||||
SkipPriceCap = skipPriceCap
|
||||
};
|
||||
|
||||
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.5" />
|
||||
<PackageReference Include="NetDaemon.Extensions.Scheduling" Version="26.11.0" />
|
||||
<PackageReference Include="NetDaemon.HassModel" Version="26.11.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="11.0.0" />
|
||||
<PackageReference Include="NetDaemon.Extensions.Scheduling" Version="26.43.1" />
|
||||
<PackageReference Include="NetDaemon.HassModel" Version="26.43.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -384,7 +384,7 @@ public sealed class BoilerMonitorEntityService(
|
||||
{
|
||||
boiler_switch_state = ctx.BoilerSwitchState ?? "unknown",
|
||||
boiler_power_watts = ctx.BoilerPowerWatts,
|
||||
cooldown_since = ctx.CooldownSince?.ToString("O"),
|
||||
cooldown_since = ctx.CooldownSince?.ToString("O", CultureInfo.InvariantCulture),
|
||||
friendly_name = "Boiler water ready",
|
||||
last_updated = timestamp
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
@@ -23,7 +23,8 @@ public static class BoilerMonitorServiceRegistration
|
||||
.AddNetDaemonApp<BoilerMonitorInit>()
|
||||
.AddSingleton<IBoilerControlService, BoilerControlService>()
|
||||
.AddTransient<IBoilerMonitorEntityService, BoilerMonitorEntityService>()
|
||||
.AddSingleton<IWaterReadyService, WaterReadyService>();
|
||||
.AddSingleton<IWaterReadyService, WaterReadyService>()
|
||||
.AddSingleton<IBoilerRunTimeTracker, BoilerRunTimeTracker>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using BoilerMonitorManager.Interface;
|
||||
using BoilerMonitorManager.Models;
|
||||
|
||||
namespace BoilerMonitorManager;
|
||||
|
||||
public class BoilerRunTimeTracker : IBoilerRunTimeTracker
|
||||
{
|
||||
public void RecordPollResult(bool isHeating, TimeSpan pollInterval)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RunTimeSnapshot GetSnapshot()
|
||||
{
|
||||
return new RunTimeSnapshot
|
||||
{
|
||||
AccumulatedRunTime = TimeSpan.Zero,
|
||||
SessionCount = 0,
|
||||
IsInSession = false
|
||||
};
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RestoreFromSnapshot(TimeSpan accumulatedRunTime, int sessionCount)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user