111111
This commit is contained in:
@@ -16,6 +16,7 @@ internal sealed class FakeHaGateway : IHomeAssistantGateway
|
||||
public string? FailEntity { get; set; }
|
||||
public int ReadsToFail { get; set; }
|
||||
public string? CoverCloseResult { get; set; }
|
||||
public string? HumidifierTurnOnResult { get; set; }
|
||||
public TimeProvider Time { get; set; } = TimeProvider.System;
|
||||
|
||||
public Task<IReadOnlyList<HomeAssistantState>> GetStatesAsync(CancellationToken cancellationToken = default)
|
||||
@@ -34,6 +35,7 @@ internal sealed class FakeHaGateway : IHomeAssistantGateway
|
||||
if (entity == FailEntity) throw new IOException("模拟设备命令失败");
|
||||
var state = service switch
|
||||
{
|
||||
"turn_on" when domain == "humidifier" && HumidifierTurnOnResult is not null => HumidifierTurnOnResult,
|
||||
"turn_on" => "on", "turn_off" => "off",
|
||||
"close_cover" when CoverCloseResult is not null => CoverCloseResult,
|
||||
"select_option" => data["option"]!.ToString()!,
|
||||
|
||||
Reference in New Issue
Block a user