feat: add BatteryMonitor implementation with discovery, notification, and scheduling services

This commit is contained in:
Marius
2026-04-01 10:55:33 +03:00
parent 11c2574235
commit 6e4d684359
114 changed files with 22820 additions and 527 deletions
@@ -0,0 +1,40 @@
namespace HomeAssistant.HistoryReplay.Replay;
public sealed class ReplayTimeProvider : TimeProvider
{
private readonly Lock _lock = new();
private DateTimeOffset _currentUtcTime;
private readonly TimeZoneInfo _localTimeZone;
public ReplayTimeProvider(DateTimeOffset initialTime)
{
_currentUtcTime = initialTime.ToUniversalTime();
_localTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time");
}
public override DateTimeOffset GetUtcNow()
{
lock (_lock)
{
return _currentUtcTime;
}
}
public override TimeZoneInfo LocalTimeZone => _localTimeZone;
public void AdvanceTo(DateTimeOffset utcTime)
{
lock (_lock)
{
_currentUtcTime = utcTime.ToUniversalTime();
}
}
public void AdvanceBy(TimeSpan duration)
{
lock (_lock)
{
_currentUtcTime += duration;
}
}
}