diff --git a/src/components/ha-area-picker.ts b/src/components/ha-area-picker.ts index 6a779119b0..c911a93650 100644 --- a/src/components/ha-area-picker.ts +++ b/src/components/ha-area-picker.ts @@ -51,6 +51,9 @@ export class HaAreaPicker extends LitElement { @property({ type: Boolean, attribute: "no-add" }) public noAdd = false; + @property({ type: Boolean, attribute: "show-label" }) + public showLabel = false; + /** * Show only areas with entities from specific domains. * @type {Array} @@ -365,9 +368,17 @@ export class HaAreaPicker extends LitElement { protected render(): TemplateResult { const placeholder = this.placeholder ?? this.hass.localize("ui.components.area-picker.area"); - const valueRenderer = this._computeValueRenderer(this.hass.areas); + let showLabel = this.showLabel; + if (this.value) { + const area = this.hass.areas[this.value]; + if (area) { + const { floor } = getAreaContext(area, this.hass.floors); + showLabel = !floor && this.showLabel; + } + } + return html` ${this.placeholder}` + : nothing; return html` ${this.value ? this.valueRenderer - ? this.valueRenderer(this.value) - : html`${this.value}` + ? html`${placeholder}${this.valueRenderer(this.value)}` + : html`${placeholder}${this.value}` : html` ${this.placeholder} diff --git a/src/panels/config/automation/automation-save-dialog/dialog-automation-save.ts b/src/panels/config/automation/automation-save-dialog/dialog-automation-save.ts index 16851ecbf2..cd6137dea3 100644 --- a/src/panels/config/automation/automation-save-dialog/dialog-automation-save.ts +++ b/src/panels/config/automation/automation-save-dialog/dialog-automation-save.ts @@ -177,6 +177,7 @@ class DialogAutomationSave extends LitElement implements HassDialog { .hass=${this.hass} .scope=${this._params.domain} .value=${this._entryUpdates.category} + show-label @value-changed=${this._registryEntryChanged} >` : nothing} @@ -193,6 +194,7 @@ class DialogAutomationSave extends LitElement implements HassDialog { id="area" .hass=${this.hass} .value=${this._entryUpdates.area} + show-label @value-changed=${this._registryEntryChanged} >` : nothing} diff --git a/src/panels/config/category/ha-category-picker.ts b/src/panels/config/category/ha-category-picker.ts index d52d55173e..27f7732243 100644 --- a/src/panels/config/category/ha-category-picker.ts +++ b/src/panels/config/category/ha-category-picker.ts @@ -39,6 +39,9 @@ export class HaCategoryPicker extends SubscribeMixin(LitElement) { @property({ type: Boolean, attribute: "no-add" }) public noAdd = false; + @property({ type: Boolean, attribute: "show-label" }) + public showLabel = false; + @property({ type: Boolean }) public disabled = false; @property({ type: Boolean }) public required = false; @@ -196,6 +199,7 @@ export class HaCategoryPicker extends SubscribeMixin(LitElement) { "ui.components.category-picker.no_categories" )} .placeholder=${placeholder} + .showLabel=${this.showLabel} .value=${this.value} .getItems=${this._getItems} .getAdditionalItems=${this._getAdditionalItems} diff --git a/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts b/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts index 4c350f46c0..7b14b44920 100644 --- a/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts +++ b/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts @@ -80,6 +80,7 @@ class DialogDeviceRegistryDetail extends LitElement { ` : ""} @@ -1012,6 +1013,7 @@ export class EntityRegistrySettingsEditor extends LitElement { ? html``