diff --git a/src/Client/Pages/Settings.razor b/src/Client/Pages/Settings.razor index 89114cb..fafd3e4 100644 --- a/src/Client/Pages/Settings.razor +++ b/src/Client/Pages/Settings.razor @@ -403,6 +403,7 @@ private void UpdateLocalSetting(Setting settingName, byte value) { + // ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault switch (settingName) { case Setting.OutputPriority: diff --git a/src/Server/Endpoints/Settings/SetSettingValue/Endpoint.cs b/src/Server/Endpoints/Settings/SetSettingValue/Endpoint.cs index c28f671..3dd422b 100644 --- a/src/Server/Endpoints/Settings/SetSettingValue/Endpoint.cs +++ b/src/Server/Endpoints/Settings/SetSettingValue/Endpoint.cs @@ -14,12 +14,12 @@ public class Endpoint : Endpoint public override async Task HandleAsync(Shared.Models.SetSetting r, CancellationToken c) { - // if (Env.IsDevelopment()) - // { - // await SendAsync(true, cancellation: c); - // - // return; - // } + if (Env.IsDevelopment()) + { + await SendAsync(true, cancellation: c); + + return; + } try { diff --git a/src/Server/InverterService/FelicityInverter.cs b/src/Server/InverterService/FelicityInverter.cs index 4c2c393..01b4e3d 100644 --- a/src/Server/InverterService/FelicityInverter.cs +++ b/src/Server/InverterService/FelicityInverter.cs @@ -77,7 +77,7 @@ public sealed class FelicitySolarInverter Status.BatteryChargeWatts = disPow.IsDischarge is false ? disPow.PositiveValue : 0; Status.OutputVoltage = Math.Round(regs[16] / 10.0, 0); // 0x1111: AC output voltage (offset 0x1111 - 0x1101 = 16) - Status.GridVoltage = Convert.ToInt16(regs[22] / 10.0); // 0x1111: AC output voltage (offset 0x1117 - 0x1101 = 22) + Status.GridVoltage = Convert.ToInt32(regs[22] / 10.0); // 0x1111: AC output voltage (offset 0x1117 - 0x1101 = 22) Status.LoadWatts = regs[29]; // 0x111E: AC output active power (offset 0x111E - 0x1101 = 29) Status.LoadPercentage = regs[31]; // 0x1120: Load percentage (offset 0x1120 - 0x1101 = 31) Status.PVInputVoltage = Math.Round(regs[37] / 10.0, 0); // 0x1126: PV input voltage (offset 0x1126 - 0x1101 = 37) diff --git a/src/Shared/Models/InverterSetting.cs b/src/Shared/Models/InverterSetting.cs index 04e8247..6c55c91 100644 --- a/src/Shared/Models/InverterSetting.cs +++ b/src/Shared/Models/InverterSetting.cs @@ -13,7 +13,7 @@ public enum Setting BackToBattery = 9 } -public enum WorkingMode +public enum WorkingMode : short { POWER = 0, STANDBY = 1, diff --git a/src/Shared/Models/InverterStatus.cs b/src/Shared/Models/InverterStatus.cs index ab04631..6e035f5 100644 --- a/src/Shared/Models/InverterStatus.cs +++ b/src/Shared/Models/InverterStatus.cs @@ -69,18 +69,18 @@ public class InverterStatus pvInputWatt = value; var interval = (DateTime.Now - pvInputWattHourLastComputed).TotalSeconds; - PVInputWattHour += Math.Round(value / (3600 / interval), 2); + PVInputWattHour += value / (3600 / interval); pvInputWattHourLastComputed = DateTime.Now; } } - [JsonPropertyName("t")] + [JsonIgnore] public double PVInputWattHour { get; private set; } - [JsonPropertyName("u")] + [JsonPropertyName("t")] public int PV_MaxCapacity { get; set; } - [JsonPropertyName("v")] + [JsonPropertyName("u")] public int PVPotential => PVInputWatt > 0 ? Convert.ToInt32(Convert.ToDouble(PVInputWatt) / PV_MaxCapacity * 100) : 0; int pvInputWatt;