Files
Evergreen-Health/Evergreen.Health.Application/Health/Devices/Contracts/IHealthDeviceModule.cs
T
2026-10-09 16:46:30 +08:00

26 lines
1.3 KiB
C#

using Evergreen.Health.Application.Health.Integrations.HomeAssistant;
using Evergreen.Health.Application.Health.Models;
using Evergreen.Health.Application.Health.Scenes;
namespace Evergreen.Health.Application.Health.Devices.Contracts;
/// <summary>新增家具实现此契约并注册即可;场景和 API 不枚举具体家具类型。</summary>
public interface IHealthDeviceModule
{
string Key { get; }
string Category { get; }
string DisplayName { get; }
string PrimaryEntityId { get; }
bool PowerUsesIndependentGateway { get; }
IReadOnlyList<DeviceParameterDefinition> Parameters { get; }
IEnumerable<string> EntityIds { get; }
DeviceCommand BuildParameterCommand(string parameterType, object? value);
Task ExecuteParameterAsync(DeviceCommand command, CancellationToken cancellationToken);
bool ParameterUsesIndependentGateway(DeviceCommand command);
Task SetPowerAsync(bool turnOn, CancellationToken cancellationToken);
Task ExecuteSleepAsync(DeviceSceneContext context, PersonalizedSceneConfig config,
string constitutionCode, CancellationToken cancellationToken);
IEnumerable<DeviceCommand> GetShutdownCommands();
HomeAssistantScenePresetItem? BuildPreview(PersonalizedSceneConfig config, string constitutionCode);
}