From a70811be5278af0a4ca0065718bddf78a1d4399b Mon Sep 17 00:00:00 2001 From: Atticus Maximus Date: Fri, 4 Oct 2024 14:17:09 +0200 Subject: [PATCH] feat: Add link support for entity names (#232) * Add link support for names * Update src/label.ts Co-authored-by: Petar Petrov * Update README.md Co-authored-by: Petar Petrov --------- Co-authored-by: Petar Petrov --- README.md | 2 ++ src/label.ts | 2 +- src/types.ts | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 99ad5c5..4116eca 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,8 @@ Install through [HACS](https://hacs.xyz/) | color_limit | string | **Optional** | 1 | State value for coloring the box based on state value | color_above | string | **Optional** | var(--paper-item-icon-color)| Color for state value above color_limit | color_below | string | **Optional** | var(--primary-color)| Color for state value below color_limit +| url | string | **Optional** | | Specifying a URL will make the entity label into a link + | add_entities | list | **Optional** | | Experimental. List of entity ids. Their states will be added to this entity, showing a sum. | subtract_entities | list | **Optional** | | Experimental. List of entity ids. Their states will be subtracted from this entity's state | tap_action | action | **Optional** | more-info | Home assistant action to perform on tap. Supported action types are `more-info`, `zoom`, `navigate`, `url`, `toggle`, `call-service`, `fire-dom-event` diff --git a/src/label.ts b/src/label.ts index 15fa2b6..0c0dde2 100644 --- a/src/label.ts +++ b/src/label.ts @@ -67,7 +67,7 @@ export function renderLabel( ` : null} ${show_names - ? html`${!vertical ? html` ` : null}${name}` + ? html`${!vertical ? html` ` : null}${!box.config.url ? html`${name}` : html`${name}`}` : null} `; } diff --git a/src/types.ts b/src/types.ts index 7d042e6..5e8b9bc 100644 --- a/src/types.ts +++ b/src/types.ts @@ -67,6 +67,7 @@ export interface EntityConfig { color_above?: string; color_below?: string; color_limit?: number; + url?: string; tap_action?: ActionConfigExtended; double_tap_action?: ActionConfigExtended; hold_action?: ActionConfigExtended;