- ${this.hass.localize(
+
+
+
+ ${this.hass.localize(
+ "ui.dialogs.entity_registry.editor.entity_status"
+ )}:
+
+
+ ${this._disabledBy && this._disabledBy !== "user"
+ ? this.hass.localize(
+ "ui.dialogs.entity_registry.editor.enabled_cause",
+ "cause",
+ this.hass.localize(
+ `config_entry.disabled_by.${this._disabledBy}`
+ )
+ )
+ : ""}
+
+
+
-
- ${this._disabledBy && this._disabledBy !== "user"
- ? this.hass.localize(
- "ui.dialogs.entity_registry.editor.enabled_cause",
- "cause",
- this.hass.localize(
- `config_entry.disabled_by.${this._disabledBy}`
- )
- )
- : ""}
- ${this.hass.localize(
- "ui.dialogs.entity_registry.editor.enabled_description"
+ >
+
+
+ ${this.hass.localize(
- "ui.dialogs.entity_registry.editor.note"
+ >
+
+
+
+ >
+
+
-
+
+ ${this._disabledBy !== null
+ ? html`
+
+ ${this.hass.localize(
+ "ui.dialogs.entity_registry.editor.enabled_description"
+ )}
+
+ `
+ : this._hiddenBy !== null
+ ? html`
+
+ ${this.hass.localize(
+ "ui.dialogs.entity_registry.editor.hidden_description"
+ )}
+
+ `
+ : ""}
+
`;
}
@@ -180,8 +249,21 @@ export class HaEntityRegistryBasicEditor extends SubscribeMixin(LitElement) {
this._entityId = ev.target.value;
}
- private _disabledByChanged(ev: Event): void {
- this._disabledBy = (ev.target as HaSwitch).checked ? null : "user";
+ private _viewStatusChanged(ev: CustomEvent): void {
+ switch ((ev.target as any).value) {
+ case "enabled":
+ this._disabledBy = null;
+ this._hiddenBy = null;
+ break;
+ case "disabled":
+ this._disabledBy = "user";
+ this._hiddenBy = null;
+ break;
+ case "hidden":
+ this._hiddenBy = "user";
+ this._disabledBy = null;
+ break;
+ }
}
static get styles() {
@@ -202,6 +284,12 @@ export class HaEntityRegistryBasicEditor extends SubscribeMixin(LitElement) {
display: block;
margin-bottom: 8px;
}
+ ha-expansion-panel {
+ margin-top: 8px;
+ }
+ .label {
+ margin-top: 16px;
+ }
`;
}
}
diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts
index 542a730d32..c4278a7936 100644
--- a/src/panels/config/entities/entity-registry-settings.ts
+++ b/src/panels/config/entities/entity-registry-settings.ts
@@ -1,3 +1,5 @@
+import "@material/mwc-formfield/mwc-formfield";
+import "../../../components/ha-radio";
import "@material/mwc-button/mwc-button";
import "@material/mwc-list/mwc-list-item";
import { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket";
@@ -20,7 +22,6 @@ import "../../../components/ha-expansion-panel";
import "../../../components/ha-icon-picker";
import "../../../components/ha-select";
import "../../../components/ha-switch";
-import type { HaSwitch } from "../../../components/ha-switch";
import "../../../components/ha-textfield";
import {
DeviceRegistryEntry,
@@ -76,6 +77,8 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
@state() private _disabledBy!: string | null;
+ @state() private _hiddenBy!: string | null;
+
private _deviceLookup?: Record
;
@state() private _device?: DeviceRegistryEntry;
@@ -112,6 +115,7 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
this._areaId = this.entry.area_id;
this._entityId = this.entry.entity_id;
this._disabledBy = this.entry.disabled_by;
+ this._hiddenBy = this.entry.hidden_by;
this._device =
this.entry.device_id && this._deviceLookup
? this._deviceLookup[this.entry.device_id]
@@ -211,75 +215,126 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
@value-changed=${this._areaPicked}
>`
: ""}
-
-
-
-
-
- ${this.hass.localize(
+
+
+ ${this.hass.localize(
+ "ui.dialogs.entity_registry.editor.entity_status"
+ )}:
+
+
+ ${this._disabledBy && this._disabledBy !== "user"
+ ? this.hass.localize(
+ "ui.dialogs.entity_registry.editor.enabled_cause",
+ "cause",
+ this.hass.localize(
+ `config_entry.disabled_by.${this._disabledBy}`
+ )
+ )
+ : ""}
+
+
+
-
- ${this._disabledBy && this._disabledBy !== "user"
- ? this.hass.localize(
- "ui.dialogs.entity_registry.editor.enabled_cause",
- "cause",
- this.hass.localize(
- `config_entry.disabled_by.${this._disabledBy}`
- )
- )
- : ""}
- ${this.hass.localize(
- "ui.dialogs.entity_registry.editor.enabled_description"
- )}
-
${this.hass.localize(
- "ui.dialogs.entity_registry.editor.note"
- )}
-
-
-
-
- ${this.entry.device_id
- ? html`
-
- ${this.hass.localize(
- "ui.dialogs.entity_registry.editor.area_note"
- )}
-
- ${this._areaId
- ? html`${this.hass.localize(
- "ui.dialogs.entity_registry.editor.follow_device_area"
- )}`
- : this._device
- ? html`${this.hass.localize(
- "ui.dialogs.entity_registry.editor.change_device_area"
- )}`
- : ""}
- `
- : ""}
+
+
+
+
+
+
+
+
+
+
+ ${this._disabledBy !== null
+ ? html`
+
+ ${this.hass.localize(
+ "ui.dialogs.entity_registry.editor.enabled_description"
+ )}
+
+ `
+ : this._hiddenBy !== null
+ ? html`
+
+ ${this.hass.localize(
+ "ui.dialogs.entity_registry.editor.hidden_description"
+ )}
+
+ `
+ : ""}
+ ${this.entry.device_id
+ ? html`
+
+ ${this.hass.localize(
+ "ui.dialogs.entity_registry.editor.change_area"
+ )}:
+
+
+
+ ${this.hass.localize(
+ "ui.dialogs.entity_registry.editor.area_note"
+ )}
+ ${this._device
+ ? html`
+
+ `
+ : ""}
+
+ `
+ : ""}
+