Fix bugs
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user