This commit is contained in:
fuenmao
2026-09-21 17:27:32 +08:00
parent 8c922a3c7f
commit 2d05b6f864
4 changed files with 677 additions and 51 deletions
@@ -1,15 +1,65 @@
namespace Evergreen.Health.Application.Health.Models;
public sealed class HomeAssistantDeviceOutput
public enum HealthDeviceCategory
{
EnvironmentControl,
EnvironmentSensor,
Sleep,
BodyComposition,
Fragrance,
Lighting,
Media,
Other
}
public sealed class HomeAssistantEntityOutput
{
public string Code { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
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 string? Value { get; set; }
public bool Available { get; set; }
public string? Unit { get; set; }
public bool IsAvailable { get; set; }
public DateTimeOffset? LastUpdated { get; set; }
public Dictionary<string, object?>? Attributes { get; set; }
}
public sealed class HomeAssistantDiscoveredDeviceOutput
{
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 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
@@ -17,8 +67,10 @@ public sealed class HomeAssistantStatusOutput
public bool Connected { get; set; }
public string Message { get; set; } = string.Empty;
public DateTimeOffset CheckedAt { get; set; } = DateTimeOffset.Now;
public List<HomeAssistantDeviceOutput> Devices { get; set; } = [];
public List<HomeAssistantDeviceOutput> Environment { get; set; } = [];
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 sealed class HomeAssistantSceneOutput