diff --git a/src/data/entity_registry.ts b/src/data/entity_registry.ts index 075ce04b12..3802b26dca 100644 --- a/src/data/entity_registry.ts +++ b/src/data/entity_registry.ts @@ -61,7 +61,7 @@ export interface EntityRegistryEntryUpdateParams { hidden_by: string | null; new_entity_id?: string; options_domain?: string; - options?: SensorEntityOptions | WeatherEntityOptions; + options?: SensorEntityOptions | NumberEntityOptions | WeatherEntityOptions; } export const findBatteryEntity = ( diff --git a/src/panels/custom/ha-panel-custom.ts b/src/panels/custom/ha-panel-custom.ts index 907bc9c655..fd759575c4 100644 --- a/src/panels/custom/ha-panel-custom.ts +++ b/src/panels/custom/ha-panel-custom.ts @@ -1,6 +1,7 @@ import { PropertyValues, ReactiveElement } from "lit"; import { property } from "lit/decorators"; import { navigate, NavigateOptions } from "../../common/navigate"; +import { deepEqual } from "../../common/util/deep-equal"; import { CustomPanelInfo } from "../../data/panel_custom"; import { HomeAssistant, Route } from "../../types"; import { createCustomPanelElement } from "../../util/custom-panel/create-custom-panel-element"; @@ -54,12 +55,15 @@ export class HaPanelCustom extends ReactiveElement { protected update(changedProps: PropertyValues) { super.update(changedProps); if (changedProps.has("panel")) { - // Clean up old things if we had a panel - if (changedProps.get("panel")) { - this._cleanupPanel(); + // Clean up old things if we had a panel and the new one is different. + const oldPanel = changedProps.get("panel") as CustomPanelInfo | undefined; + if (!deepEqual(oldPanel, this.panel)) { + if (oldPanel) { + this._cleanupPanel(); + } + this._createPanel(this.panel); + return; } - this._createPanel(this.panel); - return; } if (!this._setProperties) { return;