feat: migrate boiler control implementation to BoilerMonitor namespace and add budget handling logic
This commit is contained in:
@@ -1,13 +1,21 @@
|
||||
using HomeAssistant.Models;
|
||||
using HomeAssistant.Models;
|
||||
using NetDaemon.Extensions.MqttEntityManager;
|
||||
|
||||
namespace NordPool.Models;
|
||||
|
||||
public class NordPoolEntity : EntityCreateModel
|
||||
{
|
||||
public string Domain { get; set; } // example: sensor
|
||||
public string Identifier { get; set; } // example: name of the sensor
|
||||
public string Name { get; set; } // friendly name for UI
|
||||
private static readonly object DeviceBlock = new
|
||||
{
|
||||
identifiers = new[] { NordPoolConsts.DeviceIdentifier },
|
||||
name = NordPoolConsts.DeviceName,
|
||||
model = NordPoolConsts.DeviceName,
|
||||
manufacturer = NordPoolConsts.DeviceManufacturer
|
||||
};
|
||||
|
||||
public string Domain { get; set; }
|
||||
public string Identifier { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public NordPoolEntity(string domain, string identifier, string name)
|
||||
{
|
||||
@@ -20,7 +28,22 @@ public class NordPoolEntity : EntityCreateModel
|
||||
{
|
||||
UniqueId = EntityId,
|
||||
Name = Name
|
||||
|
||||
};
|
||||
|
||||
AdditionalConfig = new { device = DeviceBlock };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an AdditionalConfig that merges custom properties with the NordPool device block.
|
||||
/// Use this when an entity needs extra config beyond the default device assignment.
|
||||
/// </summary>
|
||||
public static object CreateAdditionalConfig(object extraProperties)
|
||||
{
|
||||
var extras = extraProperties.GetType().GetProperties()
|
||||
.ToDictionary(p => p.Name, p => p.GetValue(extraProperties));
|
||||
|
||||
extras["device"] = DeviceBlock;
|
||||
|
||||
return extras;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user