Compare commits

...

13 Commits

Author SHA1 Message Date
Bram Kragten
268eb4317c 20240930.0 (#22166) 2024-09-30 17:38:30 +02:00
Bram Kragten
4c2044e70a Bumped version to 20240930.0 2024-09-30 17:11:52 +02:00
Darren Griffin
7f96c1fbe1 Add OHF logo to README (#22165) 2024-09-30 17:10:45 +02:00
Paul Bottein
75e24780c1 Use dash for unknown and unavailable state in heading entity (#22163)
* Use dash for unknown and unavailable state in heading entity

* Update src/state-display/state-display.ts

Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>

---------

Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
2024-09-30 15:52:20 +02:00
Bram Kragten
95580bc4c0 Fix min width of checkbox column in data table (#22162)
fix min width of checkbox column in data table
2024-09-30 09:09:08 +00:00
Paul Bottein
175f68e0cf Allow to add name in heading entity badge state content (#22161) 2024-09-30 09:07:25 +00:00
Bram Kragten
394d8ddd6c 20240927.0 (#22138) 2024-09-27 17:28:42 +02:00
Bram Kragten
d4a5115a65 20240926.0 (#22107) 2024-09-26 18:30:57 +02:00
Bram Kragten
8890c7da17 20240925.0 (#22082) 2024-09-25 17:05:55 +02:00
Paul Bottein
05ad3137f1 20240909.1 (#21935) 2024-09-09 17:17:51 +02:00
Paul Bottein
ba770f8e50 20240906.0 (#21911) 2024-09-06 13:47:49 +02:00
Bram Kragten
b457d27c4c 20240904.0 (#21876) 2024-09-04 10:59:24 +02:00
Paul Bottein
9c12ab9c6d 20240903.1 (#21867) 2024-09-03 19:02:36 +02:00
8 changed files with 30 additions and 2 deletions

View File

@@ -27,3 +27,5 @@ A complete guide can be found at the following [link](https://www.home-assistant
Home Assistant is open-source and Apache 2 licensed. Feel free to browse the repository, learn and reuse parts in your own projects. Home Assistant is open-source and Apache 2 licensed. Feel free to browse the repository, learn and reuse parts in your own projects.
We use [BrowserStack](https://www.browserstack.com) to test Home Assistant on a large variety of devices. We use [BrowserStack](https://www.browserstack.com) to test Home Assistant on a large variety of devices.
[![Home Assistant - A project from the Open Home Foundation](https://www.openhomefoundation.org/badges/home-assistant.png)](https://www.openhomefoundation.org/)

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "home-assistant-frontend" name = "home-assistant-frontend"
version = "20240927.0" version = "20240930.0"
license = {text = "Apache-2.0"} license = {text = "Apache-2.0"}
description = "The Home Assistant frontend" description = "The Home Assistant frontend"
readme = "README.md" readme = "README.md"

View File

@@ -1011,6 +1011,7 @@ export class HaDataTable extends LitElement {
/* @noflip */ /* @noflip */
padding-inline-end: initial; padding-inline-end: initial;
width: 60px; width: 60px;
min-width: 60px;
} }
.mdc-data-table__table { .mdc-data-table__table {

View File

@@ -37,6 +37,7 @@ export const DEFAULT_CONFIG: Partial<EntityHeadingBadgeConfig> = {
const entityConfigStruct = object({ const entityConfigStruct = object({
type: optional(string()), type: optional(string()),
entity: string(), entity: string(),
name: optional(string()),
icon: optional(string()), icon: optional(string()),
state_content: optional(union([string(), array(string())])), state_content: optional(union([string(), array(string())])),
show_state: optional(boolean()), show_state: optional(boolean()),
@@ -86,6 +87,12 @@ export class HuiHeadingEntityEditor
name: "", name: "",
type: "grid", type: "grid",
schema: [ schema: [
{
name: "name",
selector: {
text: {},
},
},
{ {
name: "icon", name: "icon",
selector: { icon: {} }, selector: { icon: {} },
@@ -128,7 +135,7 @@ export class HuiHeadingEntityEditor
}, },
{ {
name: "state_content", name: "state_content",
selector: { ui_state_content: {} }, selector: { ui_state_content: { allow_name: true } },
context: { filter_entity: "entity" }, context: { filter_entity: "entity" },
}, },
], ],
@@ -269,6 +276,10 @@ export class HuiHeadingEntityEditor
return this.hass!.localize( return this.hass!.localize(
`ui.panel.lovelace.editor.card.heading.entity_config.${schema.name}_helper` `ui.panel.lovelace.editor.card.heading.entity_config.${schema.name}_helper`
); );
case "name":
return this.hass!.localize(
`ui.panel.lovelace.editor.card.heading.entity_config.name_helper`
);
default: default:
return undefined; return undefined;
} }

View File

@@ -125,12 +125,15 @@ export class HuiEntityHeadingBadge
"--icon-color": color, "--icon-color": color,
}; };
const name = config.name || stateObj.attributes.friendly_name;
return html` return html`
<ha-heading-badge <ha-heading-badge
.type=${hasAction(config.tap_action) ? "button" : "text"} .type=${hasAction(config.tap_action) ? "button" : "text"}
@action=${this._handleAction} @action=${this._handleAction}
.actionHandler=${actionHandler()} .actionHandler=${actionHandler()}
style=${styleMap(style)} style=${styleMap(style)}
.title=${name}
> >
${config.show_icon ${config.show_icon
? html` ? html`
@@ -148,6 +151,8 @@ export class HuiEntityHeadingBadge
.hass=${this.hass} .hass=${this.hass}
.stateObj=${stateObj} .stateObj=${stateObj}
.content=${config.state_content} .content=${config.state_content}
.name=${config.name}
dash-unavailable
></state-display> ></state-display>
` `
: nothing} : nothing}

View File

@@ -16,6 +16,7 @@ export interface ErrorBadgeConfig extends LovelaceHeadingBadgeConfig {
export interface EntityHeadingBadgeConfig extends LovelaceHeadingBadgeConfig { export interface EntityHeadingBadgeConfig extends LovelaceHeadingBadgeConfig {
type?: "entity"; type?: "entity";
entity: string; entity: string;
name?: string;
state_content?: string | string[]; state_content?: string | string[];
icon?: string; icon?: string;
show_state?: boolean; show_state?: boolean;

View File

@@ -57,6 +57,9 @@ class StateDisplay extends LitElement {
@property({ attribute: false }) public name?: string; @property({ attribute: false }) public name?: string;
@property({ type: Boolean, attribute: "dash-unavailable" })
public dashUnavailable?: boolean;
protected createRenderRoot() { protected createRenderRoot() {
return this; return this;
} }
@@ -73,6 +76,9 @@ class StateDisplay extends LitElement {
const domain = computeStateDomain(stateObj); const domain = computeStateDomain(stateObj);
if (content === "state") { if (content === "state") {
if (this.dashUnavailable && isUnavailableState(stateObj.state)) {
return "—";
}
if ( if (
(stateObj.attributes.device_class === SENSOR_DEVICE_CLASS_TIMESTAMP || (stateObj.attributes.device_class === SENSOR_DEVICE_CLASS_TIMESTAMP ||
TIMESTAMP_STATE_DOMAINS.includes(domain)) && TIMESTAMP_STATE_DOMAINS.includes(domain)) &&

View File

@@ -6026,6 +6026,8 @@
"entity_config": { "entity_config": {
"color": "[%key:ui::panel::lovelace::editor::card::tile::color%]", "color": "[%key:ui::panel::lovelace::editor::card::tile::color%]",
"color_helper": "[%key:ui::panel::lovelace::editor::card::tile::color_helper%]", "color_helper": "[%key:ui::panel::lovelace::editor::card::tile::color_helper%]",
"name": "[%key:ui::panel::lovelace::editor::card::generic::name%]",
"name_helper": "Visible if selected in state content",
"visibility": "Visibility", "visibility": "Visibility",
"visibility_explanation": "The entity will be shown when ALL conditions below are fulfilled. If no conditions are set, the entity will always be shown.", "visibility_explanation": "The entity will be shown when ALL conditions below are fulfilled. If no conditions are set, the entity will always be shown.",
"appearance": "Appearance", "appearance": "Appearance",