feat: add PowerMonitor shared models, CostAccumulator, and entity types
Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using HomeAssistant.Models;
|
||||
using NetDaemon.Extensions.MqttEntityManager;
|
||||
|
||||
namespace PowerMonitor.Models;
|
||||
|
||||
public class PowerMonitorEntity : EntityCreateModel
|
||||
{
|
||||
public string Domain { get; set; }
|
||||
public string Identifier { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public PowerMonitorEntity(string domain, string identifier, string name)
|
||||
{
|
||||
Domain = domain;
|
||||
Identifier = identifier;
|
||||
EntityId = $"{Domain}.{Identifier}";
|
||||
Name = string.IsNullOrWhiteSpace(name) ? identifier : name;
|
||||
|
||||
Options = new EntityCreationOptions
|
||||
{
|
||||
UniqueId = EntityId,
|
||||
Name = Name
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace PowerMonitor.Models;
|
||||
|
||||
public sealed class PowerSensorInfo
|
||||
{
|
||||
public required string EntityId { get; init; }
|
||||
public required string FriendlyName { get; init; }
|
||||
public required string DeviceName { get; init; }
|
||||
public string UnitOfMeasurement { get; init; } = "W";
|
||||
}
|
||||
Reference in New Issue
Block a user