Fix default strategy when energy is not configured (#9827)

* Fix default strategy when energy is not configured

* Address comment

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Joakim Sørensen 2021-08-18 22:16:12 +02:00 committed by GitHub
parent b802a410b9
commit f4dcce6d6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,7 +53,15 @@ export class OriginalStatesStrategy {
hass.loadBackendTranslation("title"),
]);
const energyPrefs = energyPromise ? await energyPromise : undefined;
let energyPrefs: EnergyPreferences | undefined;
if (energyPromise) {
try {
energyPrefs = await energyPromise;
} catch (_) {
// Nothing to do here
}
}
// User can override default view. If they didn't, we will add one
// that contains all entities.