Skip to content
1 change: 1 addition & 0 deletions src/data/frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface HomeFrontendSystemData {
favorite_entities?: string[];
welcome_banner_dismissed?: boolean;
hidden_summaries?: string[];
hide_welcome_message?: boolean;
}

declare global {
Expand Down
28 changes: 28 additions & 0 deletions src/panels/home/dialogs/dialog-edit-home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "../../../components/ha-alert";
import "../../../components/ha-button";
import "../../../components/ha-dialog-footer";
import "../../../components/ha-dialog";
import "../../../components/ha-form/ha-form";
import "../../../components/ha-icon";
import "../../../components/ha-switch";
import type { HomeFrontendSystemData } from "../../../data/frontend";
Expand Down Expand Up @@ -114,6 +115,20 @@ export class DialogEditHome
@value-changed=${this._favoriteEntitiesChanged}
></ha-entities-picker>

<ha-form
.hass=${this.hass}
.data=${{ welcome_message: !this._config?.hide_welcome_message }}
.schema=${[
{
name: "welcome_message",
selector: { boolean: {} },
},
]}
Comment thread
pcan08 marked this conversation as resolved.
Outdated
.computeLabel=${this._computeWelcomeLabel}
.computeHelper=${this._computeWelcomeHelper}
@value-changed=${this._welcomeMessageToggleChanged}
></ha-form>

<h3 class="section-header">
${this.hass.localize("ui.panel.home.editor.summaries")}
</h3>
Expand Down Expand Up @@ -204,6 +219,19 @@ export class DialogEditHome
};
}

private _computeWelcomeLabel = () =>
this.hass.localize("ui.panel.home.editor.welcome_message");

private _computeWelcomeHelper = () =>
this.hass.localize("ui.panel.home.editor.welcome_message_helper");

private _welcomeMessageToggleChanged(ev: CustomEvent): void {
this._config = {
...this._config,
hide_welcome_message: ev.detail.value.welcome_message ? undefined : true,
};
}

private _favoriteEntitiesChanged(ev: CustomEvent): void {
const entities = ev.detail.value as string[];
this._config = {
Expand Down
1 change: 1 addition & 0 deletions src/panels/home/ha-panel-home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ class PanelHome extends LitElement {
favorite_entities: this._config.favorite_entities,
home_panel: true,
hidden_summaries: this._config.hidden_summaries,
hide_welcome_message: this._config.hide_welcome_message,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface HomeDashboardStrategyConfig {
favorite_entities?: string[];
home_panel?: boolean;
hidden_summaries?: string[];
hide_welcome_message?: boolean;
}

@customElement("home-dashboard-strategy")
Expand Down Expand Up @@ -96,6 +97,7 @@ export class HomeDashboardStrategy extends ReactiveElement {
favorite_entities: config.favorite_entities,
home_panel: config.home_panel,
hidden_summaries: config.hidden_summaries,
hide_welcome_message: config.hide_welcome_message,
} satisfies HomeOverviewViewStrategyConfig,
},
...areaViews,
Expand Down
19 changes: 11 additions & 8 deletions src/panels/lovelace/strategies/home/home-overview-view-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface HomeOverviewViewStrategyConfig {
favorite_entities?: string[];
home_panel?: boolean;
hidden_summaries?: string[];
hide_welcome_message?: boolean;
}

const computeAreaCard = (
Expand Down Expand Up @@ -474,14 +475,16 @@ export class HomeOverviewViewStrategy extends ReactiveElement {
type: "sections",
max_columns: maxColumns,
sections: sections,
header: {
layout: "responsive",
card: {
type: "markdown",
text_only: true,
content: `## ${hass.localize("ui.panel.lovelace.strategy.home.welcome_user", { user: "{{ user }}" })}`,
} satisfies MarkdownCardConfig,
},
...(!config.hide_welcome_message && {
header: {
layout: "responsive",
card: {
type: "markdown",
text_only: true,
content: `## ${hass.localize("ui.panel.lovelace.strategy.home.welcome_user", { user: "{{ user }}" })}`,
} satisfies MarkdownCardConfig,
},
}),
...(sidebarSection && {
sidebar: {
sections: [sidebarSection],
Expand Down
2 changes: 2 additions & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2467,6 +2467,8 @@
"save_failed": "Failed to save Overview page configuration",
"areas_hint": "You can rearrange your floors and areas in the order that best represents your house on the {areas_page}.",
"areas_page": "areas page",
"welcome_message": "Welcome message",
"welcome_message_helper": "Show the personalized greeting at the top of your overview page.",
"summaries": "Summaries",
"summaries_description": "Choose which summaries to show on your overview page."
},
Expand Down
Loading