From 1b74e94f14cb5c1d7722f6218ec656635865bfe4 Mon Sep 17 00:00:00 2001 From: arthanoss <72643066+arthanoss@users.noreply.github.com> Date: Sun, 24 Nov 2024 16:04:01 +0100 Subject: [PATCH] Remove redundant action handler and wrapper from sensor entity row (#22975) --- .../entity-rows/hui-sensor-entity-row.ts | 54 +++++-------------- 1 file changed, 13 insertions(+), 41 deletions(-) diff --git a/src/panels/lovelace/entity-rows/hui-sensor-entity-row.ts b/src/panels/lovelace/entity-rows/hui-sensor-entity-row.ts index 5c89884419..df47cd3690 100644 --- a/src/panels/lovelace/entity-rows/hui-sensor-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-sensor-entity-row.ts @@ -1,14 +1,10 @@ -import type { CSSResultGroup, PropertyValues } from "lit"; -import { LitElement, css, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isUnavailableState } from "../../../data/entity"; -import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import { SENSOR_DEVICE_CLASS_TIMESTAMP } from "../../../data/sensor"; import type { HomeAssistant } from "../../../types"; import type { EntitiesCardEntityConfig } from "../cards/types"; -import { actionHandler } from "../common/directives/action-handler-directive"; -import { handleAction } from "../common/handle-action"; -import { hasAction } from "../common/has-action"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import "../components/hui-timestamp-display"; @@ -54,44 +50,20 @@ class HuiSensorEntityRow extends LitElement implements LovelaceRow { return html` -
- ${stateObj.attributes.device_class === - SENSOR_DEVICE_CLASS_TIMESTAMP && !isUnavailableState(stateObj.state) - ? html` - - ` - : this.hass.formatEntityState(stateObj)} -
+ ${stateObj.attributes.device_class === SENSOR_DEVICE_CLASS_TIMESTAMP && + !isUnavailableState(stateObj.state) + ? html` + + ` + : this.hass.formatEntityState(stateObj)}
`; } - - private _handleAction(ev: ActionHandlerEvent) { - handleAction(this, this.hass!, this._config!, ev.detail.action); - } - - static get styles(): CSSResultGroup { - return css` - div { - text-align: right; - } - .value { - direction: ltr; - } - `; - } } declare global {