enable debug data
This commit is contained in:
parent
571e1951bb
commit
2f0b3f6228
@ -5,11 +5,12 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
builder.Services.AddScoped(_ => new HttpClient
|
||||
{
|
||||
BaseAddress = new Uri(builder.HostEnvironment.BaseAddress),
|
||||
Timeout = TimeSpan.FromSeconds(3)
|
||||
});
|
||||
builder.Services.AddScoped(
|
||||
_ => new HttpClient
|
||||
{
|
||||
BaseAddress = new(builder.HostEnvironment.BaseAddress),
|
||||
Timeout = TimeSpan.FromSeconds(3)
|
||||
});
|
||||
_ = InverterMon.Client.Pages.Index.StartStatusStreaming(builder.HostEnvironment.BaseAddress);
|
||||
_ = InverterMon.Client.Pages.BMS.StartStatusStreaming(builder.HostEnvironment.BaseAddress);
|
||||
await builder.Build().RunAsync();
|
||||
@ -128,7 +128,7 @@ public class JkBms
|
||||
Status.PackVoltage = 25.6f;
|
||||
Status.IsCharging = true;
|
||||
Status.AvgCurrentAmps = 21.444f;
|
||||
Status.CapacityPct = 90;
|
||||
Status.CapacityPct = 50;
|
||||
Status.PackCapacity = 320;
|
||||
Status.PackNominalVoltage = 51.2f;
|
||||
Status.IsWarning = false;
|
||||
|
||||
@ -31,28 +31,27 @@ public class Endpoint : EndpointWithoutRequest<object>
|
||||
{
|
||||
while (!c.IsCancellationRequested && !AppLife.ApplicationStopping.IsCancellationRequested)
|
||||
{
|
||||
// if (Env.IsDevelopment())
|
||||
// {
|
||||
// var status = new InverterStatus
|
||||
// {
|
||||
// OutputVoltage = Random.Shared.Next(240),
|
||||
// LoadWatts = Random.Shared.Next(3500),
|
||||
// LoadPercentage = Random.Shared.Next(100),
|
||||
// BatteryVoltage = Random.Shared.Next(24),
|
||||
// BatteryChargeCurrent = Random.Shared.Next(20),
|
||||
// BatteryDischargeCurrent = Random.Shared.Next(300),
|
||||
// HeatSinkTemperature = Random.Shared.Next(300),
|
||||
// PVInputCurrent = Random.Shared.Next(300),
|
||||
// PVInputVoltage = Random.Shared.Next(300),
|
||||
// PVInputWatt = Random.Shared.Next(1000),
|
||||
// PV_MaxCapacity = 1000,
|
||||
// BatteryCapacity = 100
|
||||
// };
|
||||
//
|
||||
// yield return status;
|
||||
// }
|
||||
// else
|
||||
yield return Inverter.Status;
|
||||
if (Env.IsDevelopment())
|
||||
{
|
||||
var status = new InverterStatus
|
||||
{
|
||||
OutputVoltage = Random.Shared.Next(240),
|
||||
LoadWatts = Random.Shared.Next(3500),
|
||||
LoadPercentage = Random.Shared.Next(100),
|
||||
BatteryVoltage = Random.Shared.Next(24),
|
||||
BatteryChargeCurrent = Random.Shared.Next(20),
|
||||
BatteryDischargeCurrent = Random.Shared.Next(300),
|
||||
PVInputCurrent = Random.Shared.Next(300),
|
||||
PVInputVoltage = Random.Shared.Next(300),
|
||||
PVInputWatt = Random.Shared.Next(1000),
|
||||
PV_MaxCapacity = 1000,
|
||||
BatteryCapacity = 100
|
||||
};
|
||||
|
||||
yield return status;
|
||||
}
|
||||
else
|
||||
yield return Inverter.Status;
|
||||
|
||||
await Task.Delay(2000, c);
|
||||
}
|
||||
|
||||
@ -17,25 +17,25 @@ public class Endpoint : EndpointWithoutRequest<CurrentSettings>
|
||||
|
||||
public override async Task HandleAsync(CancellationToken c)
|
||||
{
|
||||
// if (Env.IsDevelopment())
|
||||
// {
|
||||
// var res = new CurrentSettings
|
||||
// {
|
||||
// BackToBatteryVoltage = 48.1,
|
||||
// BackToGridVoltage = 48.2,
|
||||
// FloatChargeVoltage = 48.3,
|
||||
// ChargePriority = ChargePriority.OnlySolar,
|
||||
// DischargeCuttOffVoltage = 48.4,
|
||||
// BulkChargeVoltage = 48.5,
|
||||
// MaxACChargeCurrent = 10,
|
||||
// MaxCombinedChargeCurrent = 20,
|
||||
// OutputPriority = OutputPriority.SolarFirst,
|
||||
// SystemSpec = UserSettings.ToSystemSpec()
|
||||
// };
|
||||
// await SendAsync(res, cancellation: c);
|
||||
//
|
||||
// return;
|
||||
// }
|
||||
if (Env.IsDevelopment())
|
||||
{
|
||||
var res = new CurrentSettings
|
||||
{
|
||||
BackToBatteryVoltage = 48.1,
|
||||
BackToGridVoltage = 48.2,
|
||||
FloatChargeVoltage = 48.3,
|
||||
ChargePriority = ChargePriority.OnlySolar,
|
||||
DischargeCuttOffVoltage = 48.4,
|
||||
BulkChargeVoltage = 48.5,
|
||||
MaxACChargeCurrent = 10,
|
||||
MaxCombinedChargeCurrent = 20,
|
||||
OutputPriority = OutputPriority.SolarFirst,
|
||||
SystemSpec = UserSettings.ToSystemSpec()
|
||||
};
|
||||
await SendAsync(res, cancellation: c);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@ -23,12 +23,11 @@ bld.Services
|
||||
.AddSingleton<FelicitySolarInverter>()
|
||||
.AddSingleton<JkBms>();
|
||||
|
||||
// if (!bld.Environment.IsDevelopment())
|
||||
// {
|
||||
bld.Services
|
||||
.AddHostedService<StatusRetriever>();
|
||||
|
||||
// }
|
||||
if (!bld.Environment.IsDevelopment())
|
||||
{
|
||||
bld.Services
|
||||
.AddHostedService<StatusRetriever>();
|
||||
}
|
||||
|
||||
bld.Services.AddFastEndpoints(o => o.SourceGeneratorDiscoveredTypes = DiscoveredTypes.All);
|
||||
|
||||
|
||||
@ -69,14 +69,12 @@ public class BMSStatus
|
||||
|
||||
public string GetTimeString()
|
||||
{
|
||||
var currentTime = DateTime.UtcNow
|
||||
.AddHours(5).AddMinutes(30); //only supports IST time zone :-(
|
||||
|
||||
var currentTime = DateTime.UtcNow.AddHours(5).AddMinutes(30); //only supports IST time zone :-(
|
||||
var futureTime = currentTime.AddHours(TimeHrs).AddMinutes(TimeMins);
|
||||
|
||||
if (futureTime.Date == currentTime.Date)
|
||||
return futureTime.ToString("h:mm tt");
|
||||
|
||||
return futureTime.ToString("dddd h:mm tt");
|
||||
return futureTime.ToString(
|
||||
futureTime.Date == currentTime.Date
|
||||
? "h:mm tt"
|
||||
: "dddd h:mm tt");
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
## changelog
|
||||
|
||||
- add source generator for reflection data
|
||||
- initial release
|
||||
Loading…
Reference in New Issue
Block a user