From 5ebe1e0369c0148281b0bec4907989895a8a5e33 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Sun, 19 Nov 2023 04:31:55 -0800 Subject: [PATCH] Add shortcut from energy dashboard to energy settings (#18596) --- src/panels/energy/ha-panel-energy.ts | 24 ++++++++++++++++++- .../components/hui-energy-period-selector.ts | 1 + src/translations/en.json | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/panels/energy/ha-panel-energy.ts b/src/panels/energy/ha-panel-energy.ts index bc76cf3f6d73..2c0bcf146c3f 100644 --- a/src/panels/energy/ha-panel-energy.ts +++ b/src/panels/energy/ha-panel-energy.ts @@ -7,8 +7,10 @@ import { html, nothing, } from "lit"; +import { mdiPencil } from "@mdi/js"; import { customElement, property, state } from "lit/decorators"; import "../../components/ha-menu-button"; +import "../../components/ha-list-item"; import "../../components/ha-top-app-bar-fixed"; import { LovelaceConfig } from "../../data/lovelace/config/types"; import { haStyle } from "../../resources/styles"; @@ -16,6 +18,7 @@ import { HomeAssistant } from "../../types"; import "../lovelace/components/hui-energy-period-selector"; import { Lovelace } from "../lovelace/types"; import "../lovelace/views/hui-view"; +import { navigate } from "../../common/navigate"; const ENERGY_LOVELACE_CONFIG: LovelaceConfig = { views: [ @@ -71,7 +74,21 @@ class PanelEnergy extends LitElement { + > + ${this.hass.user?.is_admin + ? html` + + + + ${this.hass!.localize("ui.panel.energy.configure")} + + ` + : nothing} + + `; diff --git a/src/translations/en.json b/src/translations/en.json index a9c29405ced6..0a0606abf351 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -6069,6 +6069,7 @@ } }, "energy": { + "configure": "[%key:ui::dialogs::quick-bar::commands::navigation::energy%]", "compare": { "info": "You are comparing the period {start} with the period {end}" },