feat: add PowerMonitor configuration model and constants
Made-with: Cursor
This commit is contained in:
@@ -24,5 +24,15 @@
|
||||
"Namespace": "HomeAssistantGenerated",
|
||||
"OutputFile": "HomeAssistantGenerated.cs",
|
||||
"UseAttributeBaseClasses" : "false"
|
||||
},
|
||||
"PowerMonitor": {
|
||||
"MainMeterEntityId": "sensor.p1_meter_power",
|
||||
"PollIntervalSeconds": 15,
|
||||
"SmoothingWindowSize": 10,
|
||||
"AnomalyThresholdWatts": 500,
|
||||
"ExcludedSensorPatterns": [
|
||||
"sensor.nordpool_*",
|
||||
"sensor.powermonitor_*"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace PowerMonitorManager.Models.Consts;
|
||||
|
||||
public static class PowerMonitorConsts
|
||||
{
|
||||
public const int DefaultPollIntervalSeconds = 15;
|
||||
public const int DefaultSmoothingWindowSize = 10;
|
||||
public const double DefaultAnomalyThresholdWatts = 500.0;
|
||||
public const int SecondsPerHour = 3600;
|
||||
public const double WattsPerKilowatt = 1000.0;
|
||||
|
||||
public const string PowerDeviceClass = "power";
|
||||
public const string WattUnit = "W";
|
||||
public const string KilowattUnit = "kW";
|
||||
public const string EurUnit = "EUR";
|
||||
public const string MonetaryDeviceClass = "monetary";
|
||||
public const string TotalStateClass = "total";
|
||||
public const string MeasurementStateClass = "measurement";
|
||||
|
||||
public const int MainMeterMaxConsecutiveFailures = 5;
|
||||
|
||||
public const int MinutesPerQuarterHour = 15;
|
||||
public const int MinutesPerHour = 60;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using PowerMonitorManager.Models.Consts;
|
||||
|
||||
namespace PowerMonitorManager.Models;
|
||||
|
||||
public sealed class PowerMonitorOptions
|
||||
{
|
||||
public const string SectionName = "PowerMonitor";
|
||||
|
||||
public string MainMeterEntityId { get; set; } = string.Empty;
|
||||
public int PollIntervalSeconds { get; set; } = PowerMonitorConsts.DefaultPollIntervalSeconds;
|
||||
public int SmoothingWindowSize { get; set; } = PowerMonitorConsts.DefaultSmoothingWindowSize;
|
||||
public double AnomalyThresholdWatts { get; set; } = PowerMonitorConsts.DefaultAnomalyThresholdWatts;
|
||||
public string[] ExcludedSensorPatterns { get; set; } = [];
|
||||
}
|
||||
Reference in New Issue
Block a user