Conversation
There was a problem hiding this comment.
Pull request overview
Ensures the room combiner’s current scenario is set when manually applying a combination scenario, preventing CurrentScenario/_currentScenario from remaining null in manual mode flows.
Changes:
- After manually applying partition states for a scenario, calls
ChangeScenario(scenario)to set/activate the scenario. - Minor formatting-only change within the partition loop block.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| } | ||
| // Activates the scenario to prevent _currentScenario from being null when starting in manual mode. | ||
| ChangeScenario(scenario); |
There was a problem hiding this comment.
ChangeScenario returns Task (async) and is being invoked without awaiting or otherwise observing the task. This can hide exceptions from Activate/Deactivate and can also allow overlapping scenario changes if this method is called multiple times quickly. Consider explicitly firing-and-forgetting with exception logging (e.g., capturing the returned task and handling faults) or introducing a serialized/queued scenario-change mechanism so only one activation runs at a time.
| ChangeScenario(scenario); | |
| var _ = ChangeScenario(scenario).ContinueWith(t => | |
| { | |
| var ex = t.Exception != null ? t.Exception.Flatten() : null; | |
| if (ex != null) | |
| { | |
| Debug.LogMessage(LogEventLevel.Error, this, | |
| "Error changing scenario to '{0}': {1}", scenario.Key, ex); | |
| } | |
| }, TaskContinuationOptions.OnlyOnFaulted); |
| { | ||
| Debug.LogMessage(LogEventLevel.Debug, this, "Unable to find partition with key: '{0}'", partitionState.PartitionKey); | ||
| } | ||
| } |
There was a problem hiding this comment.
There appears to be trailing whitespace after the closing brace on this line. Please remove the extra spaces to avoid noisy diffs and keep formatting consistent.
| } | |
| } |
|
@AECohn Can you post a config snippet for the room combiner from the config that was running when you saw this issue? The way this should work is that the default scenario has a set of partitions configured that then have their state set based on the selected scenario, then the partition feedback(s) update with their manually-set state, and that then triggers the DetermineRoomCombinationScenario which calls the ChangeScenario function. My concern is that calling ChangeScenario as you've added could cause a runway loop. It's possible that something is checking for the current scenario too early in the start up secquence, as the initial scenario, whether manual or automatic, isn't set until all devices have completed initialization, which doesn't happen until AFTER all of the activation steps. It's also possible that the configuration isn't setup correctly for the partitions. |
setting defaultToManulMode false and removing disableAutoMode fixed it, but I had to update Essentials to get this config to render |
|
Is that the whole config for the combiner? It doesn't seem to be a complete object. |
Here's the full object: |
This pull request introduces a small but important change to the
SetRoomCombinationScenariomethod in theEssentialsRoomCombinerclass. The update ensures that the scenario is activated immediately, preventing_currentScenariofrom being null when starting in manual mode.ChangeScenario(scenario)is called to activate the scenario and avoid a null_currentScenariowhen starting in manual mode.