using InnovEnergy.Lib.Utils; using InnovEnergy.Lib.Victron.VeDBus; using InnovEnergy.WireFormat.VictronV1; namespace InnovEnergy.VenusLogger.Parsers; public static class PvCharger { public static Maybe GetPvCharger(this IEnumerable services) { var solarChargers = services .Where(VeService.IsSolarChargerService) .TrySelect(GetPvCharger) .ToList(); if (solarChargers.Count <= 1) return solarChargers.FirstOrDefault().Maybe(); return new Device { Type = DeviceType.Mppt, Devices = { solarChargers } }; } private static Device GetPvCharger(ServiceProperties sp) => new Device { Type = DeviceType.Mppt, Phases = { sp.Properties.GetDcPhase() } }; }