This commit is contained in:
2026-06-28 14:22:13 +03:00
parent e6bf8258bb
commit 7f280bea7b
10 changed files with 54 additions and 17 deletions
@@ -46,7 +46,11 @@ public sealed class ExhaustFanControlService(IOptions<ShowerMonitorOptions> opti
{
if (_fanTurnedOnByUs)
{
haContext.CallService("switch", "turn_off", ServiceTarget.FromEntity(_options.ExhaustFanEntityId));
var fanState = haContext.GetState(_options.ExhaustFanEntityId)?.State;
if (string.Equals(fanState, "on", StringComparison.OrdinalIgnoreCase))
{
haContext.CallService("switch", "turn_off", ServiceTarget.FromEntity(_options.ExhaustFanEntityId));
}
}
_fanTurnedOnByUs = false;