feat: Add support for config and initialized conditions (#1894)

These conditions are probably not hugely useful for most card users, but
allows the inbuilt automation systems to be used for card internal
operations.

[skip ci]
This commit is contained in:
Dermot Duffy
2025-02-16 14:17:04 -08:00
committed by GitHub
parent 7fb710d45d
commit da79664a67
10 changed files with 313 additions and 35 deletions
@@ -184,6 +184,18 @@ export class ConfigManager {
await this._api.getDefaultManager().initializeIfNecessary(previousConfig);
await this._api.getMediaPlayerManager().initializeIfNecessary(previousConfig);
// The config is only set in the state if the card is already fully
// initialized. If not, the config will be set post initialization in the
// InitializationManager.
if (
this._overriddenConfig &&
this._api.getInitializationManager().isInitializedMandatory()
) {
this._api.getConditionStateManager().setState({
config: this._overriddenConfig,
});
}
this._api.getCardElementManager().update();
}
}