feat: add device relay and telemetry support
This commit is contained in:
35
src/GreenHome.Application/Dtos/Device/DeviceRelayDto.cs
Normal file
35
src/GreenHome.Application/Dtos/Device/DeviceRelayDto.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Domain = GreenHome.Domain;
|
||||
|
||||
namespace GreenHome.Application;
|
||||
|
||||
/// <summary>
|
||||
/// تنظیمات یک رله دستگاه
|
||||
/// </summary>
|
||||
public sealed class DeviceRelayDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int DeviceSettingsId { get; set; }
|
||||
public int RelayIndex { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
public Domain.RelayKind RelayKind { get; set; } = Domain.RelayKind.Generic;
|
||||
public Domain.RelayMode Mode { get; set; } = Domain.RelayMode.Auto;
|
||||
public int MinOnMinutes { get; set; } = 0;
|
||||
public int MinOffMinutes { get; set; } = 0;
|
||||
public List<DeviceRelayRuleDto> Rules { get; set; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// قانون روشن/خاموش شدن رله
|
||||
/// </summary>
|
||||
public sealed class DeviceRelayRuleDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Domain.SensorType SensorType { get; set; }
|
||||
public Domain.ComparisonType ComparisonType { get; set; }
|
||||
public decimal Value1 { get; set; }
|
||||
public decimal? Value2 { get; set; }
|
||||
public Domain.RelayAction Action { get; set; } = Domain.RelayAction.On;
|
||||
public Domain.AlertTimeType TimeType { get; set; } = Domain.AlertTimeType.Always;
|
||||
public int Order { get; set; }
|
||||
}
|
||||
@@ -25,6 +25,8 @@ public sealed class DeviceSettingsDto
|
||||
public string? VerificationCode { get; set; }
|
||||
public DateTime? TokenExpiresAt { get; set; }
|
||||
|
||||
public List<DeviceRelayDto> Relays { get; set; } = new();
|
||||
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user