ignore pv watts in inverter status response

This commit is contained in:
djnitehawk 2025-03-16 10:17:44 +05:30
parent eb62dc454d
commit 39b57cd4c4
5 changed files with 13 additions and 12 deletions

View File

@ -403,6 +403,7 @@
private void UpdateLocalSetting(Setting settingName, byte value)
{
// ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault
switch (settingName)
{
case Setting.OutputPriority:

View File

@ -14,12 +14,12 @@ public class Endpoint : Endpoint<Shared.Models.SetSetting, bool>
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
{

View File

@ -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)

View File

@ -13,7 +13,7 @@ public enum Setting
BackToBattery = 9
}
public enum WorkingMode
public enum WorkingMode : short
{
POWER = 0,
STANDBY = 1,

View File

@ -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;