Don't run automations prior to initialization .
This commit is contained in:
@@ -27,11 +27,16 @@ export class AutomationsManager {
|
||||
}
|
||||
|
||||
public execute(): void {
|
||||
const hass = this._api.getHASSManager().getHASS();
|
||||
|
||||
// Never execute automations if there's an error (as our automation loop
|
||||
// avoidance -- which shows as an error -- would not work!).
|
||||
if (!hass || this._api.getMessageManager().hasErrorMessage()) {
|
||||
if (
|
||||
!this._api.getHASSManager().hasHASS() ||
|
||||
// Never execute automations if the card hasn't finished initializing, as
|
||||
// it could cause a view change when camera loads are not finished.
|
||||
// See: https://github.com/dermotduffy/frigate-hass-card/issues/1407
|
||||
!this._api.getInitializationManager().isInitializedMandatory() ||
|
||||
// Never execute automations if there's an error (as our automation loop
|
||||
// avoidance -- which shows as an error -- would not work!).
|
||||
this._api.getMessageManager().hasErrorMessage()
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,10 @@ export class HASSManager {
|
||||
return this._hass;
|
||||
}
|
||||
|
||||
public hasHASS(): boolean {
|
||||
return !!this._hass;
|
||||
}
|
||||
|
||||
public getStateWatcher(): StateWatcherSubscriptionInterface {
|
||||
return this._stateWatcher;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ export interface CardAutomationsAPI {
|
||||
getCardElementManager(): CardElementManager;
|
||||
getConditionsManager(): ConditionsManager;
|
||||
getHASSManager(): HASSManager;
|
||||
getInitializationManager(): InitializationManager;
|
||||
getMessageManager(): MessageManager;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user