charging stage

This commit is contained in:
djnitehawk 2025-03-16 10:47:52 +05:30
parent 0fd4f76713
commit b9091495fc
5 changed files with 21 additions and 5 deletions

View File

@ -145,7 +145,7 @@
</div>
<div class="col-4">
<div class="container bg-light rounded-1 p-1 m-0 fw-bold text-muted fs-1">
<div class="fs-4 voltage">Voltage</div>
<div class="fs-6 voltage">@status?.ChargeMode</div>
<div class="text-black charge-discharge">@status?.BatteryVoltage</div>
<div class="fs-4 text-black-50">V</div>
<div class="fs-6 bg-white text-dark">@GetCRate() C</div>

View File

@ -35,6 +35,7 @@ public class Endpoint : EndpointWithoutRequest<object>
{
var status = new InverterStatus
{
ChargeMode = ChargeMode.ABSORPTION,
OutputVoltage = Random.Shared.Next(240),
LoadWatts = Random.Shared.Next(3500),
LoadPercentage = Random.Shared.Next(100),

View File

@ -63,9 +63,8 @@ public sealed class FelicitySolarInverter
return;
}
// BatteryChargingStage = regs[1], // 0x1102: Battery charging stage (offset 1)
Status.WorkingMode = (WorkingMode)regs[0]; // 0x1101: Working mode (offset 0)
Status.ChargeMode = (ChargeMode)regs[1]; // 0x1102: Battery charging stage (offset 1)
Status.BatteryVoltage = Math.Round(regs[7] / 100.0, 1); // 0x1108: Battery voltage (offset 0x1108 - 0x1101 = 7)
var disCur = ChargeStatus(regs[8]); // 0x1109: Battery current (offset 8) -- signed value

View File

@ -1,4 +1,6 @@
namespace InverterMon.Shared.Models;
using System.Diagnostics.CodeAnalysis;
namespace InverterMon.Shared.Models;
public enum Setting : ushort
{
@ -13,7 +15,8 @@ public enum Setting : ushort
BackToBattery = 0x2159
}
public enum WorkingMode : short
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum WorkingMode : ushort
{
POWER = 0,
STANDBY = 1,
@ -22,4 +25,12 @@ public enum WorkingMode : short
FAULT = 4,
LINE = 5,
CHARGING = 6
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ChargeMode : ushort
{
BULK = 1,
ABSORPTION = 2,
FLOAT = 3
}

View File

@ -1,5 +1,7 @@
using System.Text.Json.Serialization;
// ReSharper disable InconsistentNaming
namespace InverterMon.Shared.Models;
public class InverterStatus
@ -83,6 +85,9 @@ public class InverterStatus
[JsonPropertyName("u")]
public int PVPotential => PVInputWatt > 0 ? Convert.ToInt32(Convert.ToDouble(PVInputWatt) / PV_MaxCapacity * 100) : 0;
[JsonPropertyName("v")]
public ChargeMode ChargeMode { get; set; }
int pvInputWatt;
DateTime pvInputWattHourLastComputed;