fix: remote_control cannot be overridden (#2297)
### Problem
When configuration overrides are removed or changed for
`remote_control`, the automations previously registered by the card were
not updated, causing stale automations to remain active.
### Fix
Re-run the remote-control and automations loaders when the effective
configuration changes due to overrides so that automation
additions/removals reflect the current config.
#### What changed
- Modified: config-manager.ts
- Call `setKeyboardShortcutsFromConfig(this._api)`,
`setRemoteControlEntityFromConfig(this._api)` and
`setAutomationsFromConfig(this._api)` inside `_processOverrideConfig()`.
- Modified: `config-manager.test.ts`
- Added ConfigManager for test setup with real AutomationsManager and
ConditionStateManager
- Added test constants to centralize test data
- Expanded test coverage for override conditions:
- loaders should re-run when overrides change
- remote-control loader with overrides
#### Testing
- Full test suite run locally: 229 files, 2852 tests — all passing (with
TZ forced to 'UTC') ✅
This commit is contained in:
@@ -108,10 +108,6 @@ export class ConfigManager {
|
||||
this._api.getMessageManager().reset();
|
||||
this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems();
|
||||
|
||||
setKeyboardShortcutsFromConfig(this._api);
|
||||
setRemoteControlEntityFromConfig(this._api);
|
||||
setAutomationsFromConfig(this._api);
|
||||
|
||||
this._processOverrideConfig();
|
||||
|
||||
this._api.getCardElementManager().update();
|
||||
@@ -132,6 +128,14 @@ export class ConfigManager {
|
||||
setFoldersFromConfig(this._api);
|
||||
this._api.getStyleManager().updateFromConfig();
|
||||
|
||||
// Ensure features that register automations or other side-effects from
|
||||
// configuration are updated when overrides change (e.g. remote_control).
|
||||
// Re-run loaders that may add/remove automations based on the current
|
||||
// effective configuration.
|
||||
setKeyboardShortcutsFromConfig(this._api);
|
||||
setRemoteControlEntityFromConfig(this._api);
|
||||
setAutomationsFromConfig(this._api);
|
||||
|
||||
if (
|
||||
previousConfig &&
|
||||
(!isEqual(previousConfig?.cameras, this._overriddenConfig?.cameras) ||
|
||||
|
||||
Reference in New Issue
Block a user