diff --git a/src/components/ha-target-picker.ts b/src/components/ha-target-picker.ts index b98d969d05..8df2bea571 100644 --- a/src/components/ha-target-picker.ts +++ b/src/components/ha-target-picker.ts @@ -573,6 +573,8 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) { .horizontal-container { display: flex; flex-wrap: wrap; + min-height: 56px; + align-items: center; } .mdc-chip { color: var(--primary-text-color); diff --git a/src/panels/history/ha-panel-history.ts b/src/panels/history/ha-panel-history.ts index 83a5dba36b..06d8be2834 100644 --- a/src/panels/history/ha-panel-history.ts +++ b/src/panels/history/ha-panel-history.ts @@ -10,9 +10,12 @@ import { startOfWeek, startOfYesterday, } from "date-fns/esm"; +import { UnsubscribeFunc } from "home-assistant-js-websocket/dist/types"; import { css, html, LitElement, PropertyValues } from "lit"; import { property, state } from "lit/decorators"; -import { UnsubscribeFunc } from "home-assistant-js-websocket/dist/types"; +import { LocalStorage } from "../../common/decorators/local-storage"; +import { computeDomain } from "../../common/entity/compute_domain"; +import { computeStateName } from "../../common/entity/compute_state_name"; import { navigate } from "../../common/navigate"; import { createSearchParam, @@ -20,45 +23,43 @@ import { } from "../../common/url/search-params"; import { computeRTL } from "../../common/util/compute_rtl"; import "../../components/chart/state-history-charts"; -import "../../components/ha-target-picker"; import "../../components/ha-circular-progress"; import "../../components/ha-date-range-picker"; import type { DateRangePickerRanges } from "../../components/ha-date-range-picker"; import "../../components/ha-icon-button"; import "../../components/ha-menu-button"; -import { computeHistory, fetchDateWS } from "../../data/history"; -import "../../layouts/ha-app-layout"; -import { haStyle } from "../../resources/styles"; -import { HomeAssistant } from "../../types"; -import { - EntityRegistryEntry, - subscribeEntityRegistry, -} from "../../data/entity_registry"; +import "../../components/ha-target-picker"; import { DeviceRegistryEntry, subscribeDeviceRegistry, } from "../../data/device_registry"; +import { + EntityRegistryEntry, + subscribeEntityRegistry, +} from "../../data/entity_registry"; +import { computeHistory, fetchDateWS } from "../../data/history"; +import "../../layouts/ha-app-layout"; import { SubscribeMixin } from "../../mixins/subscribe-mixin"; -import { computeStateName } from "../../common/entity/compute_state_name"; -import { computeDomain } from "../../common/entity/compute_domain"; +import { haStyle } from "../../resources/styles"; +import { HomeAssistant } from "../../types"; class HaPanelHistory extends SubscribeMixin(LitElement) { - @property() hass!: HomeAssistant; + @property({ attribute: false }) hass!: HomeAssistant; @property({ reflect: true, type: Boolean }) narrow!: boolean; - @property() _startDate: Date; - - @property() _endDate: Date; - - @property() _targetPickerValue?; - - @property() _isLoading = false; - - @property() _stateHistory?; - @property({ reflect: true, type: Boolean }) rtl = false; + @state() private _startDate: Date; + + @state() private _endDate: Date; + + @LocalStorage("historyPickedValue", true, false) private _targetPickerValue?; + + @state() private _isLoading = false; + + @state() private _stateHistory?; + @state() private _ranges?: DateRangePickerRanges; @state() private _devices?: { [deviceId: string]: DeviceRegistryEntry }; @@ -154,14 +155,18 @@ class HaPanelHistory extends SubscribeMixin(LitElement) { .narrow=${this.narrow} >