Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ public async Task TestSaveStateAsyncReturnsCorrectStateDisabled()
// ASSERT
haConnectionMock.Verify(n =>
n.GetApiCallAsync<HassState>("states/input_boolean.netdaemon_helloapp", It.IsAny<CancellationToken>()));
// It exists so it should turn it on
// It is on so it should turn it off
haConnectionMock.Verify(n =>
n.SendCommandAsync(It.IsAny<CallServiceCommand>(),
It.IsAny<CancellationToken>()));
n.SendCommandAsync(It.Is<CallServiceCommand>(c => c.Domain == "input_boolean" && c.Service == "turn_off"),
It.IsAny<CancellationToken>()), Times.Once);
}

[Fact]
Expand Down Expand Up @@ -156,10 +156,10 @@ public async Task TestSetStateAsyncEnabled()
// ASSERT
haConnectionMock.Verify(n =>
n.GetApiCallAsync<HassState>("states/input_boolean.netdaemon_helloapp", It.IsAny<CancellationToken>()));
// It exists so it should turn it on
// It is off so it should turn it on
haConnectionMock.Verify(n =>
n.SendCommandAsync(It.IsAny<CallServiceCommand>(),
It.IsAny<CancellationToken>()));
n.SendCommandAsync(It.Is<CallServiceCommand>(c => c.Domain == "input_boolean" && c.Service == "turn_on"),
It.IsAny<CancellationToken>()), Times.Once);
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/NetDaemon.Runtime/Internal/AppStateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public async Task SaveStateAsync(string applicationId, ApplicationState state)
(state == ApplicationState.Disabled && isEnabled)
)
{
await appStateRepository.UpdateAsync(applicationId, isEnabled, _cancelTokenSource.Token)
await appStateRepository.UpdateAsync(applicationId, state == ApplicationState.Enabled, _cancelTokenSource.Token)
.ConfigureAwait(false);
}
}
Expand Down
Loading