Compare commits

...

1 Commits

Author SHA1 Message Date
Aidan Timson
6f7f8cbb24 Fix inconsistency with template binary sensors with template options flow 2026-04-09 11:18:14 +01:00

View File

@@ -277,7 +277,8 @@ export class EntityRegistrySettingsEditor extends LitElement {
const deviceClasses: string[][] = OVERRIDE_DEVICE_CLASSES[domain];
if (!deviceClasses) {
if (!deviceClasses || this._hideDeviceClassOverride(domain)) {
this._deviceClassOptions = undefined;
return;
}
@@ -291,6 +292,16 @@ export class EntityRegistrySettingsEditor extends LitElement {
}
}
private _hideDeviceClassOverride(domain: string): boolean {
// Template binary sensor device_class should be edited via template options,
// not the entity registry override UI used by other binary sensors.
return (
domain === "binary_sensor" &&
this.entry.platform === "template" &&
!!this.entry.config_entry_id
);
}
private _precisionLabel(precision?: number, stateValue?: string) {
const stateValueNumber = Number(stateValue);
const value = !isNaN(stateValueNumber) ? stateValue! : 0;
@@ -525,7 +536,7 @@ export class EntityRegistrySettingsEditor extends LitElement {
`
: nothing} `
: nothing}
${this._deviceClassOptions
${this._deviceClassOptions && !this._hideDeviceClassOverride(domain)
? html`
<ha-select
.label=${this.hass.localize(