diff --git a/src/data/entity_registry.ts b/src/data/entity_registry.ts index 7b6a34a1d3..cbc5459b3b 100644 --- a/src/data/entity_registry.ts +++ b/src/data/entity_registry.ts @@ -30,7 +30,6 @@ export interface ExtEntityRegistryEntry extends EntityRegistryEntry { device_class?: string; original_device_class?: string; aliases: string[]; - options: EntityRegistryOptions | null; } export interface UpdateEntityRegistryEntryResult { @@ -40,7 +39,6 @@ export interface UpdateEntityRegistryEntryResult { } export interface SensorEntityOptions { - precision?: number | null; unit_of_measurement?: string | null; } @@ -56,12 +54,6 @@ export interface WeatherEntityOptions { wind_speed_unit?: string | null; } -export interface EntityRegistryOptions { - number?: NumberEntityOptions; - sensor?: SensorEntityOptions; - weather?: WeatherEntityOptions; -} - export interface EntityRegistryEntryUpdateParams { name?: string | null; icon?: string | null; diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts index 60c1f62dc4..d1afbb6b50 100644 --- a/src/panels/config/entities/entity-registry-settings.ts +++ b/src/panels/config/entities/entity-registry-settings.ts @@ -63,7 +63,6 @@ import { EntityRegistryEntry, EntityRegistryEntryUpdateParams, ExtEntityRegistryEntry, - SensorEntityOptions, fetchEntityRegistry, removeEntityRegistryEntry, updateEntityRegistryEntry, @@ -127,16 +126,6 @@ const OVERRIDE_WEATHER_UNITS = { const SWITCH_AS_DOMAINS = ["cover", "fan", "light", "lock", "siren"]; -const PRECISIONS = [0, 1, 2, 3, 4, 5, 6]; - -function precisionLabel(precision: number, _state?: string) { - const state_float = - _state === undefined || isNaN(parseFloat(_state)) - ? 0.0 - : parseFloat(_state); - return state_float.toFixed(precision); -} - @customElement("entity-registry-settings") export class EntityRegistrySettings extends SubscribeMixin(LitElement) { @property({ attribute: false }) public hass!: HomeAssistant; @@ -165,8 +154,6 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { @state() private _unit_of_measurement?: string | null; - @state() private _precision?: number | null; - @state() private _precipitation_unit?: string | null; @state() private _pressure_unit?: string | null; @@ -264,10 +251,6 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { this._unit_of_measurement = stateObj?.attributes?.unit_of_measurement; } - if (domain === "sensor") { - this._precision = this.entry.options?.sensor?.precision; - } - if (domain === "weather") { const stateObj: HassEntity | undefined = this.hass.states[this.entry.entity_id]; @@ -485,44 +468,6 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { ` : ""} - ${domain === "sensor" && - // Allow customizing the precision for a sensor with numerical device class, - // a unit of measurement or state class - ((this._deviceClass && - !["date", "enum", "timestamp"].includes(this._deviceClass)) || - stateObj?.attributes.unit_of_measurement || - stateObj?.attributes.state_class) - ? html` - - ${this.hass.localize( - "ui.dialogs.entity_registry.editor.precision_default" - )} - ${PRECISIONS.map( - (precision) => html` - - ${precisionLabel( - precision, - this.hass.states[this.entry.entity_id]?.state - )} - - ` - )} - - ` - : ""} ${domain === "weather" ? html`