add batteryVoltage and percent

This commit is contained in:
2026-01-13 06:59:45 +03:30
parent 3e62c8bf96
commit b6ff393d0d
6 changed files with 1296 additions and 0 deletions

View File

@@ -26,6 +26,8 @@ public sealed class TelemetryDto
public decimal SoilPercent { get; set; }
public int GasPPM { get; set; }
public decimal? Voltage { get; set; }
public decimal? BatteryVoltage { get; set; }
public decimal? BatteryPercent { get; set; }
public byte? Power { get; set; }
public byte? OldPower { get; set; }
public decimal Lux { get; set; }

View File

@@ -16,6 +16,8 @@ public sealed class TelemetryRecord
[Column(TypeName = "decimal(18,2)")]
public decimal? Voltage { get; set; }
public decimal? BatteryVoltage { get; set; }
public decimal? BatteryPercent { get; set; }
public byte? Power { get; set; }
public int PersianYear { get; set; }
public int PersianMonth { get; set; }

View File

@@ -55,6 +55,8 @@ public sealed class GreenHomeDbContext : DbContext
b.Property(x => x.Lux).HasColumnType("decimal(18,2)");
b.Property(x => x.PersianDate).HasMaxLength(10);
b.Property(x => x.Voltage).HasColumnType("decimal(18,2)");
b.Property(x => x.BatteryVoltage).HasColumnType("decimal(18,2)");
b.Property(x => x.BatteryPercent).HasColumnType("decimal(18,2)");
b.HasIndex(x => new { x.DeviceId, x.PersianYear, x.PersianMonth });
b.HasIndex(x => new { x.DeviceId, x.TimestampUtc });
b.HasIndex(x => new { x.DeviceId, x.ServerTimestampUtc });

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GreenHome.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddBatteryInfoFields : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<decimal>(
name: "BatteryPercent",
table: "Telemetry",
type: "decimal(18,2)",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "BatteryVoltage",
table: "Telemetry",
type: "decimal(18,2)",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "BatteryPercent",
table: "Telemetry");
migrationBuilder.DropColumn(
name: "BatteryVoltage",
table: "Telemetry");
}
}
}

View File

@@ -727,6 +727,12 @@ namespace GreenHome.Infrastructure.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<decimal?>("BatteryPercent")
.HasColumnType("decimal(18,2)");
b.Property<decimal?>("BatteryVoltage")
.HasColumnType("decimal(18,2)");
b.Property<int>("DeviceId")
.HasColumnType("int");