Add manual mode guard to prevent partition sensor changes in manual mode

- Add guard clause in DetermineRoomCombinationScenario() to block ChangeScenario() when IsInAutoMode=false
- Add RoomCombinationScenarioChanged event invocation to SetRoomCombinationScenario() so manual scenario changes notify subscribers
- Ensures partition sensor events don't trigger automatic scenario changes in manual mode
- Allows UI/API scenario changes to still fire notification events for messenger updates
This commit is contained in:
equinoy 2026-05-21 17:55:36 -05:00
parent cbf92408c8
commit 9a818f81a8

View file

@ -262,6 +262,11 @@ namespace PepperDash.Essentials.Core
if (currentScenario != null) if (currentScenario != null)
{ {
this.LogInformation("Found combination Scenario {scenarioKey}", currentScenario.Key); this.LogInformation("Found combination Scenario {scenarioKey}", currentScenario.Key);
if (!IsInAutoMode)
{
this.LogDebug("ROOM_COMBINER_PARTITION_EVENT_IGNORED IsInAutoMode=false manual mode prevents sensor-driven scenario changes");
return;
}
ChangeScenario(currentScenario); ChangeScenario(currentScenario);
} }
} }
@ -459,6 +464,10 @@ namespace PepperDash.Essentials.Core
Debug.LogMessage(LogEventLevel.Debug, this, "Unable to find partition with key: '{0}'", partitionState.PartitionKey); Debug.LogMessage(LogEventLevel.Debug, this, "Unable to find partition with key: '{0}'", partitionState.PartitionKey);
} }
} }
// Update _currentScenario and fire event to notify subscribers
_currentScenario = scenario;
RoomCombinationScenarioChanged?.Invoke(this, new EventArgs());
} }
else else
{ {