From d95f1235ab5215375b2e1ffd95d1c422a5c9a3c5 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Mon, 15 Jul 2024 10:37:26 +0200 Subject: [PATCH] Rename live timer to remaining time and remove remaining attribute from state content list --- .../entity/ha-entity-state-content-picker.ts | 5 +++-- src/panels/lovelace/cards/hui-tile-card.ts | 4 ++-- .../lovelace/entity-rows/hui-timer-entity-row.ts | 6 +++--- ...e-display-timer.ts => ha-timer-remaining-time.ts} | 6 +++--- src/state-display/state-display.ts | 12 ++++++------ src/state-summary/state-card-timer.ts | 6 +++--- src/translations/en.json | 2 +- 7 files changed, 21 insertions(+), 20 deletions(-) rename src/state-display/{state-display-timer.ts => ha-timer-remaining-time.ts} (92%) diff --git a/src/components/entity/ha-entity-state-content-picker.ts b/src/components/entity/ha-entity-state-content-picker.ts index 94d5de61ae69..72bdb2a17b7d 100644 --- a/src/components/entity/ha-entity-state-content-picker.ts +++ b/src/components/entity/ha-entity-state-content-picker.ts @@ -18,6 +18,8 @@ import type { HaComboBox } from "../ha-combo-box"; const HIDDEN_ATTRIBUTES = [ "access_token", "available_modes", + "battery_icon", + "battery_level", "code_arm_required", "code_format", "color_modes", @@ -51,6 +53,7 @@ const HIDDEN_ATTRIBUTES = [ "precipitation_unit", "preset_modes", "pressure_unit", + "remaining", "sound_mode_list", "source_list", "state_class", @@ -64,8 +67,6 @@ const HIDDEN_ATTRIBUTES = [ "unit_of_measurement", "visibility_unit", "wind_speed_unit", - "battery_icon", - "battery_level", ]; @customElement("ha-entity-state-content-picker") diff --git a/src/panels/lovelace/cards/hui-tile-card.ts b/src/panels/lovelace/cards/hui-tile-card.ts index 1098b762cc18..0cae348c7701 100644 --- a/src/panels/lovelace/cards/hui-tile-card.ts +++ b/src/panels/lovelace/cards/hui-tile-card.ts @@ -216,10 +216,10 @@ export class HuiTileCard extends LitElement implements LovelaceCard { return ["state", "current_temperature"]; } if (domain === "update") { - return "update_state"; + return "install_status"; } if (domain === "timer") { - return "timer_state"; + return "reamining_time"; } return "state"; } diff --git a/src/panels/lovelace/entity-rows/hui-timer-entity-row.ts b/src/panels/lovelace/entity-rows/hui-timer-entity-row.ts index 8cb3cac9a185..cb6e6d17a1b9 100644 --- a/src/panels/lovelace/entity-rows/hui-timer-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-timer-entity-row.ts @@ -1,6 +1,6 @@ import { LitElement, PropertyValues, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import "../../../state-display/state-display-timer"; +import "../../../state-display/ha-timer-remaining-time"; import { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; @@ -38,10 +38,10 @@ class HuiTimerEntityRow extends LitElement { return html`
- + >
`; diff --git a/src/state-display/state-display-timer.ts b/src/state-display/ha-timer-remaining-time.ts similarity index 92% rename from src/state-display/state-display-timer.ts rename to src/state-display/ha-timer-remaining-time.ts index 13960c088cc4..36d242f92a5e 100644 --- a/src/state-display/state-display-timer.ts +++ b/src/state-display/ha-timer-remaining-time.ts @@ -4,8 +4,8 @@ import { customElement, property, state } from "lit/decorators"; import { computeDisplayTimer, timerTimeRemaining } from "../data/timer"; import type { HomeAssistant } from "../types"; -@customElement("state-display-timer") -class StateDisplayTimer extends ReactiveElement { +@customElement("ha-timer-remaining-time") +class HaTimerRemainingTime extends ReactiveElement { @property({ attribute: false }) public hass!: HomeAssistant; @property({ attribute: false }) public stateObj!: HassEntity; @@ -69,6 +69,6 @@ class StateDisplayTimer extends ReactiveElement { declare global { interface HTMLElementTagNameMap { - "state-display-timer": StateDisplayTimer; + "ha-timer-remaining-time": HaTimerRemainingTime; } } diff --git a/src/state-display/state-display.ts b/src/state-display/state-display.ts index 6532ad3c549f..1fc07d0dd36c 100644 --- a/src/state-display/state-display.ts +++ b/src/state-display/state-display.ts @@ -13,7 +13,7 @@ import type { HomeAssistant } from "../types"; const TIMESTAMP_STATE_DOMAINS = ["button", "input_button", "scene"]; export const STATE_DISPLAY_SPECIAL_CONTENT = [ - "live_timer", + "remaining_time", "install_status", ] as const; @@ -21,7 +21,7 @@ export const STATE_DISPLAY_SPECIAL_CONTENT_DOMAINS: Record< (typeof STATE_DISPLAY_SPECIAL_CONTENT)[number], string[] > = { - live_timer: ["timer"], + remaining_time: ["timer"], install_status: ["update"], }; @@ -94,13 +94,13 @@ class StateDisplay extends LitElement { ${computeUpdateStateDisplay(stateObj as UpdateEntity, this.hass!)} `; } - if (content === "live_timer") { - import("./state-display-timer"); + if (content === "remaining_time") { + import("./ha-timer-remaining-time"); return html` - + > `; } } diff --git a/src/state-summary/state-card-timer.ts b/src/state-summary/state-card-timer.ts index 134ebdb89c61..661ce17bdc6b 100644 --- a/src/state-summary/state-card-timer.ts +++ b/src/state-summary/state-card-timer.ts @@ -3,7 +3,7 @@ import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; import { customElement, property } from "lit/decorators"; import "../components/entity/state-info"; import { haStyle } from "../resources/styles"; -import "../state-display/state-display-timer"; +import "../state-display/ha-timer-remaining-time"; import { HomeAssistant } from "../types"; @customElement("state-card-timer") @@ -23,10 +23,10 @@ class StateCardTimer extends LitElement { .inDialog=${this.inDialog} >
- + >
`; diff --git a/src/translations/en.json b/src/translations/en.json index 6825aaf7701f..1a2f6d871fa5 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1023,7 +1023,7 @@ "state": "State", "last_changed": "Last changed", "last_updated": "Last updated", - "live_timer": "Live timer", + "remaining_time": "Remaining time", "install_status": "Install status" } },