mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 02:06:42 +00:00
Allow setting device_class
"outlet" again through entity settings (#12669)
* Allow setting `device_class` "outlet" again through UI * Fixes * Null check deviceClass and adjust used translation
This commit is contained in:
parent
b71b230bfd
commit
49c018c000
@ -367,9 +367,24 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
|
|||||||
@selected=${this._switchAsChanged}
|
@selected=${this._switchAsChanged}
|
||||||
@closed=${stopPropagation}
|
@closed=${stopPropagation}
|
||||||
>
|
>
|
||||||
<mwc-list-item value="switch" selected>
|
<mwc-list-item
|
||||||
${domainToName(this.hass.localize, "switch")}</mwc-list-item
|
value="switch"
|
||||||
|
.selected=${!this._deviceClass ||
|
||||||
|
this._deviceClass === "switch"}
|
||||||
>
|
>
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.dialogs.entity_registry.editor.device_classes.switch.switch"
|
||||||
|
)}
|
||||||
|
</mwc-list-item>
|
||||||
|
<mwc-list-item
|
||||||
|
value="outlet"
|
||||||
|
.selected=${!this._deviceClass ||
|
||||||
|
this._deviceClass === "outlet"}
|
||||||
|
>
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.dialogs.entity_registry.editor.device_classes.switch.outlet"
|
||||||
|
)}
|
||||||
|
</mwc-list-item>
|
||||||
<li divider role="separator"></li>
|
<li divider role="separator"></li>
|
||||||
${this._switchAsDomainsSorted(
|
${this._switchAsDomainsSorted(
|
||||||
SWITCH_AS_DOMAINS,
|
SWITCH_AS_DOMAINS,
|
||||||
@ -617,7 +632,15 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
|
|||||||
if (ev.target.value === "") {
|
if (ev.target.value === "") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._switchAs = ev.target.value;
|
|
||||||
|
// If value is "outlet" that means the user kept the "switch" domain, but actually changed
|
||||||
|
// the device_class of the switch to "outlet".
|
||||||
|
const switchAs = ev.target.value === "outlet" ? "switch" : ev.target.value;
|
||||||
|
this._switchAs = switchAs;
|
||||||
|
|
||||||
|
if (ev.target.value === "outlet" || ev.target.value === "switch") {
|
||||||
|
this._deviceClass = ev.target.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _areaPicked(ev: CustomEvent) {
|
private _areaPicked(ev: CustomEvent) {
|
||||||
|
@ -853,6 +853,10 @@
|
|||||||
"curtain": "Curtain",
|
"curtain": "Curtain",
|
||||||
"damper": "Damper",
|
"damper": "Damper",
|
||||||
"shutter": "Shutter"
|
"shutter": "Shutter"
|
||||||
|
},
|
||||||
|
"switch": {
|
||||||
|
"outlet": "Outlet",
|
||||||
|
"switch": "Switch"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"unavailable": "This entity is unavailable.",
|
"unavailable": "This entity is unavailable.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user