Compare commits

...
Author SHA1 Message Date
Paul Bottein adb717873e Fix area switch for entities without their own name 2026-10-01 10:58:17 +02:00
2 changed files with 12 additions and 4 deletions
@@ -255,6 +255,8 @@ export class EntityRegistrySettingsEditor extends LitElement {
@state() private _noDeviceArea?: boolean;
@state() private _ownAreaWithoutName = false;
private _origEntityId!: string;
private _deviceClassOptions?: string[][];
@@ -279,6 +281,7 @@ export class EntityRegistrySettingsEditor extends LitElement {
this.entry.device_class || this.entry.original_device_class;
this._origEntityId = this.entry.entity_id;
this._areaId = this.entry.area_id;
this._ownAreaWithoutName = this._useDeviceName && !!this.entry.area_id;
this._labels = this.entry.labels;
this._entityId = this.entry.entity_id;
this._disabledBy = this.entry.disabled_by;
@@ -1233,7 +1236,7 @@ export class EntityRegistrySettingsEditor extends LitElement {
>
<span slot="supporting-text"
>${this.hass.localize(
this._useDeviceArea
!this._hasOwnName
? "ui.dialogs.entity_registry.editor.use_device_area_required"
: "ui.dialogs.entity_registry.editor.change_device_settings",
{
@@ -1750,10 +1753,15 @@ export class EntityRegistrySettingsEditor extends LitElement {
private _useDeviceNameChanged(ev: HASSDomCurrentTargetEvent<HaSwitch>): void {
this._useDeviceName = ev.currentTarget.checked;
this._ownAreaWithoutName = false;
}
private get _hasOwnName(): boolean {
return !!(this._computeName() ?? this._originalName);
}
private get _useDeviceArea(): boolean {
return !!this._device && this._useDeviceName;
return !!this._device && !this._hasOwnName && !this._ownAreaWithoutName;
}
private get _originalName(): string {
+2 -2
View File
@@ -2081,8 +2081,8 @@
"note": "Note: This might not work yet with all integrations.",
"use_device_area": "Use device area",
"use_device_area_confirm_title": "Use the area of the device?",
"use_device_area_confirm_text": "This entity is in {area}. Because it uses the device name, it will use the area of its device instead.",
"use_device_area_required": "An entity that uses the device name always uses the area of its device. You can {link} in the device settings.",
"use_device_area_confirm_text": "This entity is in {area}. Because it has no name of its own, it will use the area of its device instead.",
"use_device_area_required": "An entity without its own name always uses the area of its device. You can {link} in the device settings.",
"change_device_settings": "You can {link} in the device settings",
"change_device_area_link": "change the device area",
"configure_state": "{integration} options",