diff --git a/src/dialogs/quick-bar/ha-quick-bar.ts b/src/dialogs/quick-bar/ha-quick-bar.ts index ed4e22cd1b..6ae9e25264 100644 --- a/src/dialogs/quick-bar/ha-quick-bar.ts +++ b/src/dialogs/quick-bar/ha-quick-bar.ts @@ -573,21 +573,27 @@ export class QuickBar extends LitElement { for (const sectionKey of Object.keys(configSections)) { for (const page of configSections[sectionKey]) { - if (canShowPage(this.hass, page)) { - if (page.component) { - const info = this._getNavigationInfoFromConfig(page); - - // Add to list, but only if we do not already have an entry for the same path and component - if ( - info && - !items.some( - (e) => e.path === info.path && e.component === info.component - ) - ) { - items.push(info); - } - } + if (!canShowPage(this.hass, page)) { + continue; } + if (!page.component) { + continue; + } + const info = this._getNavigationInfoFromConfig(page); + + if (!info) { + continue; + } + // Add to list, but only if we do not already have an entry for the same path and component + if ( + items.some( + (e) => e.path === info.path && e.component === info.component + ) + ) { + continue; + } + + items.push(info); } } @@ -597,14 +603,15 @@ export class QuickBar extends LitElement { private _getNavigationInfoFromConfig( page: PageNavigation ): NavigationInfo | undefined { - if (page.component) { - const caption = this.hass.localize( - `ui.dialogs.quick-bar.commands.navigation.${page.component}` - ); + if (!page.component) { + return undefined; + } + const caption = this.hass.localize( + `ui.dialogs.quick-bar.commands.navigation.${page.component}` + ); - if (page.translationKey && caption) { - return { ...page, primaryText: caption }; - } + if (page.translationKey && caption) { + return { ...page, primaryText: caption }; } return undefined; diff --git a/src/panels/config/ha-panel-config.ts b/src/panels/config/ha-panel-config.ts index 07720ced4d..fa83f43105 100644 --- a/src/panels/config/ha-panel-config.ts +++ b/src/panels/config/ha-panel-config.ts @@ -6,6 +6,7 @@ import { mdiDevices, mdiHomeAssistant, mdiInformation, + mdiLightningBolt, mdiMapMarkerRadius, mdiMathLog, mdiNfcVariant, @@ -192,6 +193,16 @@ export const configSections: { [name: string]: PageNavigation[] } = { iconColor: "#616161", }, ], + // Not used as a tab, but this way it will stay in the quick bar + energy: [ + { + component: "energy", + path: "/config/energy", + translationKey: "ui.panel.config.energy.caption", + iconPath: mdiLightningBolt, + iconColor: "#F1C447", + }, + ], lovelace: [ { component: "lovelace", diff --git a/src/translations/en.json b/src/translations/en.json index 52b9f9bfa5..a9f48033a5 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -616,7 +616,7 @@ "person": "[%key:ui::panel::config::person::caption%]", "devices": "[%key:ui::panel::config::devices::caption%]", "entities": "[%key:ui::panel::config::entities::caption%]", - "energy": "[%key:ui::panel::config::energy::caption%]", + "energy": "Energy Configuration", "lovelace": "[%key:ui::panel::config::lovelace::caption%]", "core": "[%key:ui::panel::config::core::caption%]", "zone": "[%key:ui::panel::config::zone::caption%]",