27 lines
679 B
C#
27 lines
679 B
C#
using InnovEnergy.Lib.Utils;
|
|
using InnovEnergy.Lib.Victron.VeDBus;
|
|
using InnovEnergy.WireFormat.VictronV1;
|
|
|
|
namespace InnovEnergy.VenusLogger.Parsers;
|
|
|
|
|
|
public static class Grid
|
|
{
|
|
public static Maybe<Device> GetGrid(this IEnumerable<ServiceProperties> services)
|
|
{
|
|
return services
|
|
.Where(VeService.IsGridService)
|
|
.Select(GetGridDevice)
|
|
.SingleOrDefault()
|
|
.Maybe();
|
|
}
|
|
|
|
private static Device GetGridDevice(this ServiceProperties serviceProps)
|
|
{
|
|
return new Device
|
|
{
|
|
Type = DeviceType.Grid,
|
|
Phases = { serviceProps.Properties.GetAcPhases() }
|
|
};
|
|
}
|
|
} |