Files
Evergreen-Health/Evergreen.Health.Application/Health/Models/HomeAssistantModels.cs
T
2026-10-09 16:46:30 +08:00

166 lines
5.7 KiB
C#

namespace Evergreen.Health.Application.Health.Models;
public enum HealthDeviceCategory
{
EnvironmentControl,
EnvironmentSensor,
Sleep,
BodyComposition,
Fragrance,
Lighting,
Media,
Other,
Climate,
Curtain,
SleepMonitoring,
Outlet
}
public sealed class HomeAssistantEntityOutput
{
public string EntityId { get; set; } = string.Empty;
public string Domain { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string State { get; set; } = string.Empty;
public bool Available { get; set; }
public string? Unit { get; set; }
public Dictionary<string, object?>? Attributes { get; set; }
}
public sealed class HomeAssistantDiscoveredDeviceOutput
{
public string ModuleKey { get; set; } = string.Empty;
public string DeviceId { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string Manufacturer { get; set; } = string.Empty;
public string Model { get; set; } = string.Empty;
public string? AreaName { get; set; }
public string Category { get; set; } = nameof(HealthDeviceCategory.Other);
public bool Online { get; set; }
public string? PrimaryControlEntityId { get; set; }
public List<HomeAssistantEntityOutput> Entities { get; set; } = [];
public Dictionary<string, object?> Metrics { get; set; } = [];
}
public sealed class HomeAssistantSummaryOutput
{
public int TotalDevices { get; set; }
public int OnlineDevices { get; set; }
public int OfflineDevices { get; set; }
public int TotalEntities { get; set; }
public int AvailableEntities { get; set; }
}
public sealed class HomeAssistantSceneDevicesSummaryOutput
{
public int Total { get; set; } = 4;
public int Available { get; set; }
}
public sealed class HomeAssistantEnvironmentOutput
{
public double? Temperature { get; set; }
public double? Humidity { get; set; }
public double? Pm25 { get; set; }
public double? Pm10 { get; set; }
public double? Co2 { get; set; }
public double? Hcho { get; set; }
public double? Tvoc { get; set; }
}
public sealed class HomeAssistantStatusOutput
{
public bool Connected { get; set; }
public string Message { get; set; } = string.Empty;
public DateTimeOffset CheckedAt { get; set; } = DateTimeOffset.Now;
public HomeAssistantSummaryOutput Summary { get; set; } = new();
public List<HomeAssistantDiscoveredDeviceOutput> Devices { get; set; } = [];
public HomeAssistantSceneDevicesSummaryOutput SceneDevices { get; set; } = new();
public HomeAssistantEnvironmentOutput Environment { get; set; } = new();
public List<HomeAssistantScenePresetItem> ScenePresets { get; set; } = [];
public Dictionary<string, HomeAssistantParameterStateOutput> ControlParameters { get; set; } = [];
}
public sealed class HomeAssistantParameterStateOutput
{
public string EntityId { get; set; } = string.Empty;
public string State { get; set; } = string.Empty;
public bool Available { get; set; }
public Dictionary<string, object?>? Attributes { get; set; }
}
public sealed class HomeAssistantScenePresetItem
{
public string DeviceName { get; set; } = string.Empty;
public string Category { get; set; } = string.Empty;
public string EntityId { get; set; } = string.Empty;
public bool Available { get; set; }
public string AvailabilityMessage { get; set; } = string.Empty;
public string Action { get; set; } = string.Empty;
public string Detail { get; set; } = string.Empty;
public Dictionary<string, object?> Parameters { get; set; } = [];
}
public sealed class HomeAssistantDeviceSwitchInput
{
public string DeviceId { get; set; } = string.Empty;
public string? EntityId { get; set; }
public bool TurnOn { get; set; }
}
public sealed class HomeAssistantDeviceSwitchOutput
{
public bool Success { get; set; }
public string DeviceId { get; set; } = string.Empty;
public string EntityId { get; set; } = string.Empty;
public string State { get; set; } = string.Empty;
public bool? IsMuted { get; set; }
public string Message { get; set; } = string.Empty;
}
public sealed class HomeAssistantLightTransitionOutput
{
public bool Success { get; set; } = true;
public bool Running { get; set; }
public string Mode { get; set; } = "none";
public int BrightnessPercent { get; set; }
public int TargetPercent { get; set; }
public string Message { get; set; } = string.Empty;
}
public sealed class HomeAssistantSetParameterInput
{
public string DeviceId { get; set; } = string.Empty;
public string? EntityId { get; set; }
public string ParameterType { get; set; } = string.Empty;
public object? Value { get; set; }
}
public sealed class HomeAssistantSetParameterOutput
{
public bool Success { get; set; }
public string DeviceId { get; set; } = string.Empty;
public string ParameterType { get; set; } = string.Empty;
public string Message { get; set; } = string.Empty;
}
public sealed class HomeAssistantSceneOutput
{
public ClimateAdviceOutput? ClimateAdvice { get; set; }
public string SceneCode { get; set; } = string.Empty;
public string SceneName { get; set; } = string.Empty;
public bool Success { get; set; }
public string Status { get; set; } = string.Empty;
public string Message { get; set; } = string.Empty;
public DateTimeOffset ExecutedAt { get; set; } = DateTimeOffset.Now;
public List<HomeAssistantSceneActionOutput> Actions { get; set; } = [];
}
public sealed class HomeAssistantSceneActionOutput
{
public string Name { get; set; } = string.Empty;
public string EntityId { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public string Message { get; set; } = string.Empty;
}