From 9f16ce7341ba338c2f3be7d956ff46711016daee Mon Sep 17 00:00:00 2001 From: Wendelin <12148533+wendevlin@users.noreply.github.com> Date: Thu, 11 Dec 2025 08:28:45 +0100 Subject: [PATCH] Fix picker initial sort and reorganize picker data (#28476) --- demo/src/stubs/device_registry.ts | 2 +- demo/src/stubs/entity_registry.ts | 2 +- demo/src/stubs/label_registry.ts | 2 +- gallery/src/pages/components/ha-form.ts | 2 +- gallery/src/pages/components/ha-selector.ts | 4 +- gallery/src/pages/misc/integration-card.ts | 4 +- .../entity/compute_attribute_display.ts | 4 +- src/common/entity/compute_device_name.ts | 6 +- src/common/entity/compute_entity_name.ts | 2 +- src/common/entity/compute_state_display.ts | 6 +- .../entity/context/get_device_context.ts | 2 +- .../entity/context/get_entity_context.ts | 4 +- src/common/entity/delete_entity.ts | 18 +- src/common/entity/get_states.ts | 6 +- src/common/entity/group_entities.ts | 4 +- src/common/entity/state_active.ts | 2 +- src/common/entity/state_card_type.ts | 2 +- src/common/entity/state_color.ts | 2 +- src/common/number/format_number.ts | 2 +- src/components/chart/timeline-color.ts | 6 +- .../data-table/ha-data-table-labels.ts | 2 +- .../device/ha-device-action-picker.ts | 4 +- .../device/ha-device-automation-picker.ts | 10 +- .../device/ha-device-condition-picker.ts | 4 +- src/components/device/ha-device-picker.ts | 4 +- .../device/ha-device-trigger-picker.ts | 4 +- src/components/entity/ha-entities-picker.ts | 2 +- src/components/entity/ha-entity-picker.ts | 4 +- src/components/entity/ha-entity-toggle.ts | 6 +- src/components/entity/ha-state-label-badge.ts | 8 +- src/components/ha-area-picker.ts | 7 +- src/components/ha-attributes.ts | 4 +- src/components/ha-climate-state.ts | 2 +- .../ha-conversation-agent-picker.ts | 4 +- src/components/ha-filter-labels.ts | 4 +- src/components/ha-floor-picker.ts | 7 +- src/components/ha-humidifier-state.ts | 2 +- src/components/ha-label-picker.ts | 7 +- src/components/ha-labels-picker.ts | 4 +- src/components/ha-picker-combo-box.ts | 29 +- .../ha-selector/ha-selector-action.ts | 2 +- .../ha-selector/ha-selector-area.ts | 10 +- .../ha-selector/ha-selector-device.ts | 10 +- .../ha-selector/ha-selector-entity.ts | 6 +- .../ha-selector/ha-selector-floor.ts | 10 +- .../ha-selector/ha-selector-target.ts | 10 +- src/components/ha-target-picker.ts | 29 +- .../media-player/dialog-join-media-players.ts | 2 +- .../media-player/ha-media-player-browse.ts | 2 +- .../dialog/show-dialog-target-details.ts | 2 +- .../ha-target-picker-item-group.ts | 2 +- .../ha-target-picker-item-row.ts | 6 +- .../ha-target-picker-value-chip.ts | 2 +- src/components/trace/ha-trace-path-details.ts | 30 +- src/components/trace/hat-trace-timeline.ts | 6 +- src/data/alarm_control_panel.ts | 2 +- .../{area_floor.ts => area_floor_picker.ts} | 6 +- src/data/area_registry.ts | 4 +- src/data/assist_satellite.ts | 4 +- src/data/automation.ts | 5 +- src/data/automation_i18n.ts | 9 +- src/data/calendar.ts | 2 +- src/data/context.ts | 4 +- src/data/cover.ts | 2 +- src/data/{ => device}/device_automation.ts | 14 +- src/data/device/device_picker.ts | 182 +++++++++ src/data/device/device_registry.ts | 169 +++++++++ src/data/device_registry.ts | 345 ------------------ src/data/{ => entity}/entity.ts | 2 +- src/data/{ => entity}/entity_attributes.ts | 4 +- src/data/entity/entity_picker.ts | 155 ++++++++ src/data/{ => entity}/entity_registry.ts | 167 +-------- src/data/{ => entity}/entity_sources.ts | 4 +- src/data/icons.ts | 4 +- .../label_picker.ts} | 106 +----- src/data/label/label_registry.ts | 90 +++++ src/data/lawn_mower.ts | 2 +- src/data/lock.ts | 4 +- src/data/logbook.ts | 2 +- src/data/matter.ts | 4 +- src/data/media-player.ts | 4 +- src/data/regenerate_entity_ids.ts | 4 +- src/data/script_i18n.ts | 8 +- src/data/selector.ts | 8 +- src/data/target.ts | 13 +- src/data/todo.ts | 4 +- src/data/update.ts | 4 +- src/data/vacuum.ts | 2 +- src/data/valve.ts | 2 +- src/data/ws-device_registry.ts | 2 +- src/data/ws-entity_registry_display.ts | 4 +- .../config-flow/dialog-data-entry-flow.ts | 8 +- .../previews/entity-preview-row.ts | 2 +- .../config-flow/step-flow-create-entry.ts | 8 +- .../components/ha-more-info-state-header.ts | 2 +- .../lights/dialog-light-color-favorite.ts | 14 +- .../ha-more-info-light-favorite-colors.ts | 6 +- .../lights/light-color-temp-picker.ts | 4 +- .../show-dialog-light-color-favorite.ts | 2 +- .../ha-more-info-view-voice-assistants.ts | 2 +- .../controls/more-info-automation.ts | 4 +- .../more-info/controls/more-info-camera.ts | 2 +- .../more-info/controls/more-info-climate.ts | 2 +- .../more-info/controls/more-info-counter.ts | 4 +- .../more-info/controls/more-info-date.ts | 2 +- .../more-info/controls/more-info-datetime.ts | 2 +- .../more-info/controls/more-info-fan.ts | 2 +- .../controls/more-info-humidifier.ts | 4 +- .../controls/more-info-input_datetime.ts | 2 +- .../controls/more-info-lawn_mower.ts | 6 +- .../more-info/controls/more-info-light.ts | 4 +- .../controls/more-info-media_player.ts | 20 +- .../more-info/controls/more-info-script.ts | 4 +- .../more-info/controls/more-info-time.ts | 2 +- .../more-info/controls/more-info-update.ts | 12 +- .../more-info/controls/more-info-vacuum.ts | 6 +- .../controls/more-info-water_heater.ts | 2 +- src/dialogs/more-info/ha-more-info-dialog.ts | 4 +- src/dialogs/more-info/ha-more-info-info.ts | 4 +- .../more-info/ha-more-info-settings.ts | 2 +- src/dialogs/more-info/more-info-content.ts | 2 +- .../voice-assistant-setup-dialog.ts | 4 +- .../voice-assistant-setup-step-area.ts | 2 +- .../voice-assistant-setup-step-local.ts | 4 +- .../voice-assistant-setup-step-success.ts | 2 +- .../voice-assistant-setup-step-update.ts | 2 +- .../voice-assistant-setup-step-wake-word.ts | 6 +- src/fake_data/provide_hass.ts | 2 +- .../config/areas/ha-config-area-page.ts | 8 +- .../action/ha-automation-action-row.ts | 4 +- .../types/ha-automation-action-device_id.ts | 8 +- .../add-automation-element-dialog.ts | 8 +- .../ha-automation-add-from-target.ts | 10 +- .../ha-automation-add-search.ts | 10 +- .../dialog-automation-save.ts | 4 +- .../show-dialog-automation-save.ts | 2 +- .../condition/ha-automation-condition-row.ts | 2 +- .../types/ha-automation-condition-device.ts | 8 +- .../ha-automation-condition-numeric_state.ts | 4 +- .../config/automation/ha-automation-editor.ts | 4 +- .../config/automation/ha-automation-picker.ts | 12 +- .../option/ha-automation-option-row.ts | 2 +- .../trigger/ha-automation-trigger-row.ts | 2 +- .../types/ha-automation-trigger-device.ts | 10 +- .../config/category/dialog-assign-category.ts | 4 +- .../category/show-dialog-assign-category.ts | 2 +- .../config/dashboard/ha-config-updates.ts | 10 +- .../ha-device-automation-dialog.ts | 6 +- .../device-detail/ha-device-entities-card.ts | 4 +- .../device-detail/ha-device-info-card.ts | 16 +- .../ha-device-via-devices-card.ts | 2 +- .../esphome/device-actions.ts | 2 +- .../matter/device-actions.ts | 12 +- .../matter/ha-device-info-matter.ts | 2 +- .../mqtt/device-actions.ts | 2 +- .../show-dialog-mqtt-device-debug-info.ts | 2 +- .../zha/device-actions.ts | 2 +- .../zha/ha-device-info-zha.ts | 2 +- .../zwave_js/device-actions.ts | 10 +- .../zwave_js/device-alerts.ts | 2 +- .../zwave_js/ha-device-info-zwave_js.ts | 2 +- .../show-dialog-device-automation.ts | 4 +- .../dialog-device-registry-detail.ts | 4 +- .../show-dialog-device-registry-detail.ts | 2 +- .../config/devices/ha-config-device-page.ts | 8 +- .../devices/ha-config-devices-dashboard.ts | 12 +- .../settings/entity-settings-helper-tab.ts | 4 +- .../entity-registry-settings-editor.ts | 8 +- .../entities/entity-registry-settings.ts | 6 +- .../config/entities/ha-config-entities.ts | 16 +- src/panels/config/ha-panel-config.ts | 4 +- .../config/helpers/ha-config-helpers.ts | 40 +- .../ha-config-entry-device-row.ts | 4 +- .../integrations/ha-config-entry-row.ts | 8 +- .../ha-config-integration-page.ts | 8 +- .../ha-config-integrations-dashboard.ts | 6 +- .../integrations/ha-config-sub-entry-row.ts | 4 +- .../integrations/ha-integration-card.ts | 4 +- .../bluetooth-advertisement-monitor.ts | 8 +- .../bluetooth/bluetooth-connection-monitor.ts | 12 +- .../bluetooth-network-visualization.ts | 2 +- .../integration-panels/zha/zha-device-card.ts | 6 +- .../zha/zha-network-visualization-page.ts | 4 +- .../add-node/dialog-zwave_js-add-node.ts | 6 +- ...wave_js-capability-control-color-switch.ts | 6 +- .../zwave_js-capability-control-door-lock.ts | 24 +- ...js-capability-control-multilevel-switch.ts | 18 +- ...s-capability-control-thermostat-setback.ts | 22 +- .../dialog-zwave_js-node-statistics.ts | 4 +- .../dialog-zwave_js-rebuild-node-routes.ts | 4 +- .../zwave_js/dialog-zwave_js-remove-node.ts | 12 +- .../dialog-zwave_js-update-firmware-node.ts | 2 +- .../show-dialog-zwave_js-node-statistics.ts | 2 +- ...how-dialog-zwave_js-rebuild-node-routes.ts | 2 +- ...ow-dialog-zwave_js-update-firmware-node.ts | 2 +- .../zwave_js-network-visualization.ts | 2 +- .../config/labels/dialog-label-detail.ts | 2 +- src/panels/config/labels/ha-config-labels.ts | 4 +- .../config/labels/show-dialog-label-detail.ts | 2 +- src/panels/config/scene/ha-scene-dashboard.ts | 12 +- src/panels/config/scene/ha-scene-editor.ts | 6 +- src/panels/config/script/ha-config-script.ts | 2 +- src/panels/config/script/ha-script-editor.ts | 4 +- src/panels/config/script/ha-script-picker.ts | 12 +- src/panels/config/script/ha-script-trace.ts | 2 +- .../voice-assistants/entity-voice-settings.ts | 4 +- .../ha-config-voice-assistants-expose.ts | 14 +- .../show-dialog-voice-settings.ts | 2 +- src/panels/config/zone/ha-config-zone.ts | 6 +- src/panels/logbook/ha-panel-logbook.ts | 2 +- .../hui-alarm-modes-card-feature.ts | 2 +- .../hui-climate-fan-modes-card-feature.ts | 2 +- .../hui-climate-hvac-modes-card-feature.ts | 2 +- .../hui-climate-preset-modes-card-feature.ts | 2 +- ...ate-swing-horizontal-modes-card-feature.ts | 2 +- .../hui-climate-swing-modes-card-feature.ts | 2 +- .../hui-counter-actions-card-feature.ts | 2 +- .../hui-cover-position-card-feature.ts | 4 +- .../hui-cover-tilt-position-card-feature.ts | 4 +- .../hui-fan-direction-card-feature.ts | 4 +- .../hui-fan-oscillate-card-feature.ts | 4 +- .../hui-fan-preset-modes-card-feature.ts | 2 +- .../hui-fan-speed-card-feature.ts | 4 +- .../hui-humidifier-modes-card-feature.ts | 2 +- .../hui-humidifier-toggle-card-feature.ts | 2 +- .../hui-lawn-mower-commands-card-feature.ts | 2 +- .../hui-light-brightness-card-feature.ts | 2 +- .../hui-light-color-temp-card-feature.ts | 4 +- .../hui-media-player-playback-card-feature.ts | 32 +- ...edia-player-volume-buttons-card-feature.ts | 4 +- ...media-player-volume-slider-card-feature.ts | 2 +- .../hui-numeric-input-card-feature.ts | 2 +- .../hui-select-options-card-feature.ts | 2 +- .../hui-target-humidity-card-feature.ts | 2 +- .../hui-target-temperature-card-feature.ts | 2 +- .../card-features/hui-toggle-card-feature.ts | 2 +- .../hui-update-actions-card-feature.ts | 2 +- .../hui-vacuum-commands-card-feature.ts | 2 +- .../hui-valve-open-close-card-feature.ts | 10 +- .../hui-valve-position-card-feature.ts | 6 +- ...ter-heater-operation-modes-card-feature.ts | 6 +- .../lovelace/cards/hui-alarm-panel-card.ts | 6 +- src/panels/lovelace/cards/hui-area-card.ts | 2 +- src/panels/lovelace/cards/hui-button-card.ts | 2 +- src/panels/lovelace/cards/hui-entity-card.ts | 2 +- src/panels/lovelace/cards/hui-gauge-card.ts | 2 +- src/panels/lovelace/cards/hui-glance-card.ts | 2 +- src/panels/lovelace/cards/hui-light-card.ts | 2 +- .../lovelace/cards/hui-media-control-card.ts | 6 +- .../lovelace/cards/hui-todo-list-card.ts | 2 +- .../cards/hui-weather-forecast-card.ts | 10 +- .../lovelace/cards/tile/badges/tile-badge.ts | 6 +- src/panels/lovelace/common/has-changed.ts | 2 +- .../lovelace/common/validate-condition.ts | 6 +- .../lovelace/components/hui-entity-editor.ts | 2 +- src/panels/lovelace/components/hui-image.ts | 4 +- .../editor/badge-editor/hui-badge-picker.ts | 2 +- .../editor/card-editor/hui-card-picker.ts | 2 +- .../config-elements/hui-gauge-card-editor.ts | 2 +- .../hui-logbook-card-editor.ts | 2 +- .../hui-weather-forecast-card-editor.ts | 2 +- .../elements/hui-state-badge-element.ts | 6 +- .../elements/hui-state-icon-element.ts | 2 +- .../elements/hui-state-label-element.ts | 2 +- .../entity-rows/hui-button-entity-row.ts | 6 +- .../entity-rows/hui-date-entity-row.ts | 2 +- .../entity-rows/hui-datetime-entity-row.ts | 4 +- .../entity-rows/hui-event-entity-row.ts | 2 +- .../hui-input-button-entity-row.ts | 4 +- .../hui-input-datetime-entity-row.ts | 2 +- .../hui-input-number-entity-row.ts | 2 +- .../hui-input-select-entity-row.ts | 2 +- .../entity-rows/hui-input-text-entity-row.ts | 2 +- .../entity-rows/hui-lock-entity-row.ts | 8 +- .../hui-media-player-entity-row.ts | 2 +- .../entity-rows/hui-number-entity-row.ts | 2 +- .../entity-rows/hui-scene-entity-row.ts | 4 +- .../entity-rows/hui-script-entity-row.ts | 8 +- .../entity-rows/hui-select-entity-row.ts | 2 +- .../entity-rows/hui-sensor-entity-row.ts | 2 +- .../entity-rows/hui-text-entity-row.ts | 4 +- .../entity-rows/hui-time-entity-row.ts | 4 +- .../entity-rows/hui-toggle-entity-row.ts | 2 +- .../entity-rows/hui-valve-entity-row.ts | 2 +- .../entity-rows/hui-weather-entity-row.ts | 4 +- .../media-browser/ha-bar-media-player.ts | 2 +- src/panels/todo/ha-panel-todo.ts | 2 +- ...state-control-alarm_control_panel-modes.ts | 2 +- .../ha-state-control-climate-humidity.ts | 2 +- .../ha-state-control-climate-temperature.ts | 2 +- .../cover/ha-state-control-cover-position.ts | 4 +- .../ha-state-control-cover-tilt-position.ts | 4 +- .../cover/ha-state-control-cover-toggle.ts | 2 +- .../fan/ha-state-control-fan-speed.ts | 4 +- src/state-control/ha-state-control-toggle.ts | 2 +- .../ha-state-control-humidifier-humidity.ts | 4 +- .../ha-state-control-light-brightness.ts | 2 +- .../lock/ha-state-control-lock-toggle.ts | 4 +- .../valve/ha-state-control-valve-position.ts | 4 +- .../valve/ha-state-control-valve-toggle.ts | 2 +- ...-state-control-water_heater-temperature.ts | 2 +- src/state-display/state-display.ts | 2 +- src/state-summary/state-card-button.ts | 2 +- src/state-summary/state-card-display.ts | 2 +- src/state-summary/state-card-input_button.ts | 2 +- src/state-summary/state-card-input_number.ts | 2 +- src/state-summary/state-card-input_select.ts | 2 +- src/state-summary/state-card-number.ts | 6 +- src/state-summary/state-card-script.ts | 4 +- src/state-summary/state-card-select.ts | 2 +- src/state-summary/state-card-text.ts | 6 +- src/state/connection-mixin.ts | 2 +- src/state/context-mixin.ts | 2 +- src/types.ts | 4 +- .../entity/compute_state_display.test.ts | 10 +- test/common/entity/context/context-mock.ts | 4 +- test/common/entity/delete_entity.test.ts | 10 +- 317 files changed, 1394 insertions(+), 1352 deletions(-) rename src/data/{area_floor.ts => area_floor_picker.ts} (98%) rename src/data/{ => device}/device_automation.ts (94%) create mode 100644 src/data/device/device_picker.ts create mode 100644 src/data/device/device_registry.ts delete mode 100644 src/data/device_registry.ts rename src/data/{ => entity}/entity.ts (87%) rename src/data/{ => entity}/entity_attributes.ts (96%) create mode 100644 src/data/entity/entity_picker.ts rename src/data/{ => entity}/entity_registry.ts (64%) rename src/data/{ => entity}/entity_sources.ts (81%) rename src/data/{label_registry.ts => label/label_picker.ts} (67%) create mode 100644 src/data/label/label_registry.ts diff --git a/demo/src/stubs/device_registry.ts b/demo/src/stubs/device_registry.ts index d7c43bd6f6..79cf004366 100644 --- a/demo/src/stubs/device_registry.ts +++ b/demo/src/stubs/device_registry.ts @@ -1,4 +1,4 @@ -import type { DeviceRegistryEntry } from "../../../src/data/device_registry"; +import type { DeviceRegistryEntry } from "../../../src/data/device/device_registry"; import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockDeviceRegistry = ( diff --git a/demo/src/stubs/entity_registry.ts b/demo/src/stubs/entity_registry.ts index 0a157b7683..3e860ccf5b 100644 --- a/demo/src/stubs/entity_registry.ts +++ b/demo/src/stubs/entity_registry.ts @@ -1,4 +1,4 @@ -import type { EntityRegistryEntry } from "../../../src/data/entity_registry"; +import type { EntityRegistryEntry } from "../../../src/data/entity/entity_registry"; import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockEntityRegistry = ( diff --git a/demo/src/stubs/label_registry.ts b/demo/src/stubs/label_registry.ts index 0d953dc79c..b1db1c2fb6 100644 --- a/demo/src/stubs/label_registry.ts +++ b/demo/src/stubs/label_registry.ts @@ -1,4 +1,4 @@ -import type { LabelRegistryEntry } from "../../../src/data/label_registry"; +import type { LabelRegistryEntry } from "../../../src/data/label/label_registry"; import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockLabelRegistry = ( diff --git a/gallery/src/pages/components/ha-form.ts b/gallery/src/pages/components/ha-form.ts index 9602ca288c..508f63e1dd 100644 --- a/gallery/src/pages/components/ha-form.ts +++ b/gallery/src/pages/components/ha-form.ts @@ -11,11 +11,11 @@ import { computeInitialHaFormData } from "../../../../src/components/ha-form/com import "../../../../src/components/ha-form/ha-form"; import type { HaFormSchema } from "../../../../src/components/ha-form/types"; import type { AreaRegistryEntry } from "../../../../src/data/area_registry"; +import type { DeviceRegistryEntry } from "../../../../src/data/device/device_registry"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; import type { HomeAssistant } from "../../../../src/types"; import "../../components/demo-black-white-row"; -import type { DeviceRegistryEntry } from "../../../../src/data/device_registry"; const ENTITIES = [ getEntity("alarm_control_panel", "alarm", "disarmed", { diff --git a/gallery/src/pages/components/ha-selector.ts b/gallery/src/pages/components/ha-selector.ts index ef87cad816..9eb13bdee2 100644 --- a/gallery/src/pages/components/ha-selector.ts +++ b/gallery/src/pages/components/ha-selector.ts @@ -13,9 +13,9 @@ import "../../../../src/components/ha-selector/ha-selector"; import "../../../../src/components/ha-settings-row"; import type { AreaRegistryEntry } from "../../../../src/data/area_registry"; import type { BlueprintInput } from "../../../../src/data/blueprint"; -import type { DeviceRegistryEntry } from "../../../../src/data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../src/data/device/device_registry"; import type { FloorRegistryEntry } from "../../../../src/data/floor_registry"; -import type { LabelRegistryEntry } from "../../../../src/data/label_registry"; +import type { LabelRegistryEntry } from "../../../../src/data/label/label_registry"; import { showDialog } from "../../../../src/dialogs/make-dialog-manager"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/misc/integration-card.ts b/gallery/src/pages/misc/integration-card.ts index 11d513331b..bd06eba0eb 100644 --- a/gallery/src/pages/misc/integration-card.ts +++ b/gallery/src/pages/misc/integration-card.ts @@ -6,8 +6,8 @@ import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import type { IntegrationManifest } from "../../../../src/data/integration"; -import type { DeviceRegistryEntry } from "../../../../src/data/device_registry"; -import type { EntityRegistryEntry } from "../../../../src/data/entity_registry"; +import type { DeviceRegistryEntry } from "../../../../src/data/device/device_registry"; +import type { EntityRegistryEntry } from "../../../../src/data/entity/entity_registry"; import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../../../src/panels/config/integrations/ha-config-flow-card"; import type { diff --git a/src/common/entity/compute_attribute_display.ts b/src/common/entity/compute_attribute_display.ts index bee5735f01..951b25b960 100644 --- a/src/common/entity/compute_attribute_display.ts +++ b/src/common/entity/compute_attribute_display.ts @@ -3,8 +3,8 @@ import { DOMAIN_ATTRIBUTES_FORMATERS, DOMAIN_ATTRIBUTES_UNITS, TEMPERATURE_ATTRIBUTES, -} from "../../data/entity_attributes"; -import type { EntityRegistryDisplayEntry } from "../../data/entity_registry"; +} from "../../data/entity/entity_attributes"; +import type { EntityRegistryDisplayEntry } from "../../data/entity/entity_registry"; import type { FrontendLocaleData } from "../../data/translation"; import type { WeatherEntity } from "../../data/weather"; import { getWeatherUnit } from "../../data/weather"; diff --git a/src/common/entity/compute_device_name.ts b/src/common/entity/compute_device_name.ts index f107f55096..60f82c083c 100644 --- a/src/common/entity/compute_device_name.ts +++ b/src/common/entity/compute_device_name.ts @@ -1,12 +1,12 @@ import memoizeOne from "memoize-one"; -import type { DeviceRegistryEntry } from "../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../data/device/device_registry"; import type { EntityRegistryDisplayEntry, EntityRegistryEntry, -} from "../../data/entity_registry"; +} from "../../data/entity/entity_registry"; import type { HomeAssistant } from "../../types"; -import { computeStateName } from "./compute_state_name"; import { getDuplicates } from "../string/get_duplicates"; +import { computeStateName } from "./compute_state_name"; export const computeDeviceName = ( device: DeviceRegistryEntry diff --git a/src/common/entity/compute_entity_name.ts b/src/common/entity/compute_entity_name.ts index 172c45dad3..f395e01dd7 100644 --- a/src/common/entity/compute_entity_name.ts +++ b/src/common/entity/compute_entity_name.ts @@ -2,7 +2,7 @@ import type { HassEntity } from "home-assistant-js-websocket"; import type { EntityRegistryDisplayEntry, EntityRegistryEntry, -} from "../../data/entity_registry"; +} from "../../data/entity/entity_registry"; import type { HomeAssistant } from "../../types"; import { computeDeviceName } from "./compute_device_name"; import { computeStateName } from "./compute_state_name"; diff --git a/src/common/entity/compute_state_display.ts b/src/common/entity/compute_state_display.ts index cf69669ac6..7574d1c6ab 100644 --- a/src/common/entity/compute_state_display.ts +++ b/src/common/entity/compute_state_display.ts @@ -1,12 +1,12 @@ import type { HassConfig, HassEntity } from "home-assistant-js-websocket"; -import { UNAVAILABLE, UNKNOWN } from "../../data/entity"; -import type { EntityRegistryDisplayEntry } from "../../data/entity_registry"; +import { UNAVAILABLE, UNKNOWN } from "../../data/entity/entity"; +import type { EntityRegistryDisplayEntry } from "../../data/entity/entity_registry"; import type { FrontendLocaleData } from "../../data/translation"; import { TimeZone } from "../../data/translation"; import type { HomeAssistant } from "../../types"; -import { DURATION_UNITS, formatDuration } from "../datetime/format_duration"; import { formatDate } from "../datetime/format_date"; import { formatDateTime } from "../datetime/format_date_time"; +import { DURATION_UNITS, formatDuration } from "../datetime/format_duration"; import { formatTime } from "../datetime/format_time"; import { formatNumber, diff --git a/src/common/entity/context/get_device_context.ts b/src/common/entity/context/get_device_context.ts index ae690bc334..a41e917945 100644 --- a/src/common/entity/context/get_device_context.ts +++ b/src/common/entity/context/get_device_context.ts @@ -1,5 +1,5 @@ import type { AreaRegistryEntry } from "../../../data/area_registry"; -import type { DeviceRegistryEntry } from "../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../data/device/device_registry"; import type { FloorRegistryEntry } from "../../../data/floor_registry"; import type { HomeAssistant } from "../../../types"; diff --git a/src/common/entity/context/get_entity_context.ts b/src/common/entity/context/get_entity_context.ts index 8244e42d90..0edb352f86 100644 --- a/src/common/entity/context/get_entity_context.ts +++ b/src/common/entity/context/get_entity_context.ts @@ -1,11 +1,11 @@ import type { HassEntity } from "home-assistant-js-websocket"; import type { AreaRegistryEntry } from "../../../data/area_registry"; -import type { DeviceRegistryEntry } from "../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../data/device/device_registry"; import type { EntityRegistryDisplayEntry, EntityRegistryEntry, ExtEntityRegistryEntry, -} from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; import type { FloorRegistryEntry } from "../../../data/floor_registry"; import type { HomeAssistant } from "../../../types"; diff --git a/src/common/entity/delete_entity.ts b/src/common/entity/delete_entity.ts index 4f10471669..d4b67b905b 100644 --- a/src/common/entity/delete_entity.ts +++ b/src/common/entity/delete_entity.ts @@ -1,14 +1,14 @@ -import type { HomeAssistant } from "../../types"; -import type { IntegrationManifest } from "../../data/integration"; -import { computeDomain } from "./compute_domain"; -import { HELPERS_CRUD } from "../../data/helpers_crud"; -import type { Helper } from "../../panels/config/helpers/const"; -import { isHelperDomain } from "../../panels/config/helpers/const"; -import { isComponentLoaded } from "../config/is_component_loaded"; -import type { EntityRegistryEntry } from "../../data/entity_registry"; -import { removeEntityRegistryEntry } from "../../data/entity_registry"; import type { ConfigEntry } from "../../data/config_entries"; import { deleteConfigEntry } from "../../data/config_entries"; +import type { EntityRegistryEntry } from "../../data/entity/entity_registry"; +import { removeEntityRegistryEntry } from "../../data/entity/entity_registry"; +import { HELPERS_CRUD } from "../../data/helpers_crud"; +import type { IntegrationManifest } from "../../data/integration"; +import type { Helper } from "../../panels/config/helpers/const"; +import { isHelperDomain } from "../../panels/config/helpers/const"; +import type { HomeAssistant } from "../../types"; +import { isComponentLoaded } from "../config/is_component_loaded"; +import { computeDomain } from "./compute_domain"; export const isDeletableEntity = ( hass: HomeAssistant, diff --git a/src/common/entity/get_states.ts b/src/common/entity/get_states.ts index 8f6f6c8fd8..d902c6ca57 100644 --- a/src/common/entity/get_states.ts +++ b/src/common/entity/get_states.ts @@ -1,9 +1,9 @@ import type { HassEntity } from "home-assistant-js-websocket"; -import { computeStateDomain } from "./compute_state_domain"; -import { UNAVAILABLE_STATES } from "../../data/entity"; +import { UNAVAILABLE_STATES } from "../../data/entity/entity"; import type { HomeAssistant } from "../../types"; -import { computeDomain } from "./compute_domain"; import { stringCompare } from "../string/compare"; +import { computeDomain } from "./compute_domain"; +import { computeStateDomain } from "./compute_state_domain"; export const FIXED_DOMAIN_STATES = { alarm_control_panel: [ diff --git a/src/common/entity/group_entities.ts b/src/common/entity/group_entities.ts index 26237a699c..1b22b42cc8 100644 --- a/src/common/entity/group_entities.ts +++ b/src/common/entity/group_entities.ts @@ -1,7 +1,7 @@ import type { HassEntity } from "home-assistant-js-websocket"; -import { computeStateDomain } from "./compute_state_domain"; -import { isUnavailableState, UNAVAILABLE } from "../../data/entity"; +import { isUnavailableState, UNAVAILABLE } from "../../data/entity/entity"; import type { HomeAssistant } from "../../types"; +import { computeStateDomain } from "./compute_state_domain"; export const computeGroupEntitiesState = (states: HassEntity[]): string => { if (!states.length) { diff --git a/src/common/entity/state_active.ts b/src/common/entity/state_active.ts index 4f4c928fac..c8358c15ae 100644 --- a/src/common/entity/state_active.ts +++ b/src/common/entity/state_active.ts @@ -1,5 +1,5 @@ import type { HassEntity } from "home-assistant-js-websocket"; -import { isUnavailableState, OFF, UNAVAILABLE } from "../../data/entity"; +import { isUnavailableState, OFF, UNAVAILABLE } from "../../data/entity/entity"; import { computeDomain } from "./compute_domain"; export function stateActive(stateObj: HassEntity, state?: string): boolean { diff --git a/src/common/entity/state_card_type.ts b/src/common/entity/state_card_type.ts index df6a17b1d9..937c1bf0ca 100644 --- a/src/common/entity/state_card_type.ts +++ b/src/common/entity/state_card_type.ts @@ -1,5 +1,5 @@ import type { HassEntity } from "home-assistant-js-websocket"; -import { UNAVAILABLE } from "../../data/entity"; +import { UNAVAILABLE } from "../../data/entity/entity"; import type { HomeAssistant } from "../../types"; import { DOMAINS_WITH_CARD } from "../const"; import { canToggleState } from "./can_toggle_state"; diff --git a/src/common/entity/state_color.ts b/src/common/entity/state_color.ts index db2044800b..8405e95818 100644 --- a/src/common/entity/state_color.ts +++ b/src/common/entity/state_color.ts @@ -1,6 +1,6 @@ /** Return a color representing a state. */ import type { HassEntity } from "home-assistant-js-websocket"; -import { UNAVAILABLE } from "../../data/entity"; +import { UNAVAILABLE } from "../../data/entity/entity"; import type { GroupEntity } from "../../data/group"; import { computeGroupDomain } from "../../data/group"; import { computeCssVariable } from "../../resources/css-variables"; diff --git a/src/common/number/format_number.ts b/src/common/number/format_number.ts index 63ebb30bda..0d97bc6e48 100644 --- a/src/common/number/format_number.ts +++ b/src/common/number/format_number.ts @@ -2,7 +2,7 @@ import type { HassEntity, HassEntityAttributeBase, } from "home-assistant-js-websocket"; -import type { EntityRegistryDisplayEntry } from "../../data/entity_registry"; +import type { EntityRegistryDisplayEntry } from "../../data/entity/entity_registry"; import type { FrontendLocaleData } from "../../data/translation"; import { NumberFormat } from "../../data/translation"; import { round } from "./round"; diff --git a/src/components/chart/timeline-color.ts b/src/components/chart/timeline-color.ts index 449191ff73..806aca6a2a 100644 --- a/src/components/chart/timeline-color.ts +++ b/src/components/chart/timeline-color.ts @@ -3,11 +3,11 @@ import { getGraphColorByIndex } from "../../common/color/colors"; import { hex2rgb, lab2hex, rgb2lab } from "../../common/color/convert-color"; import { labBrighten } from "../../common/color/lab"; import { computeDomain } from "../../common/entity/compute_domain"; -import { stateColorProperties } from "../../common/entity/state_color"; -import { UNAVAILABLE, UNKNOWN } from "../../data/entity"; -import { computeCssValue } from "../../resources/css-variables"; import { computeStateDomain } from "../../common/entity/compute_state_domain"; import { FIXED_DOMAIN_STATES } from "../../common/entity/get_states"; +import { stateColorProperties } from "../../common/entity/state_color"; +import { UNAVAILABLE, UNKNOWN } from "../../data/entity/entity"; +import { computeCssValue } from "../../resources/css-variables"; const DOMAIN_STATE_SHADES: Record> = { media_player: { diff --git a/src/components/data-table/ha-data-table-labels.ts b/src/components/data-table/ha-data-table-labels.ts index b8c300024b..141c211fee 100644 --- a/src/components/data-table/ha-data-table-labels.ts +++ b/src/components/data-table/ha-data-table-labels.ts @@ -6,7 +6,7 @@ import { computeCssColor } from "../../common/color/compute-color"; import { fireEvent } from "../../common/dom/fire_event"; import { stopPropagation } from "../../common/dom/stop_propagation"; import { stringCompare } from "../../common/string/compare"; -import type { LabelRegistryEntry } from "../../data/label_registry"; +import type { LabelRegistryEntry } from "../../data/label/label_registry"; import "../chips/ha-chip-set"; import "../ha-dropdown"; import "../ha-dropdown-item"; diff --git a/src/components/device/ha-device-action-picker.ts b/src/components/device/ha-device-action-picker.ts index 7e6dea1acb..172d62c29e 100644 --- a/src/components/device/ha-device-action-picker.ts +++ b/src/components/device/ha-device-action-picker.ts @@ -1,9 +1,9 @@ import { customElement } from "lit/decorators"; -import type { DeviceAction } from "../../data/device_automation"; +import type { DeviceAction } from "../../data/device/device_automation"; import { fetchDeviceActions, localizeDeviceAutomationAction, -} from "../../data/device_automation"; +} from "../../data/device/device_automation"; import { HaDeviceAutomationPicker } from "./ha-device-automation-picker"; @customElement("ha-device-action-picker") diff --git a/src/components/device/ha-device-automation-picker.ts b/src/components/device/ha-device-automation-picker.ts index 8e0c9bf9b3..a6f645a845 100644 --- a/src/components/device/ha-device-automation-picker.ts +++ b/src/components/device/ha-device-automation-picker.ts @@ -2,17 +2,17 @@ import { consume } from "@lit/context"; import { css, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; +import { stopPropagation } from "../../common/dom/stop_propagation"; import { fullEntitiesContext } from "../../data/context"; -import type { DeviceAutomation } from "../../data/device_automation"; +import type { DeviceAutomation } from "../../data/device/device_automation"; import { deviceAutomationsEqual, sortDeviceAutomations, -} from "../../data/device_automation"; -import type { EntityRegistryEntry } from "../../data/entity_registry"; +} from "../../data/device/device_automation"; +import type { EntityRegistryEntry } from "../../data/entity/entity_registry"; import type { HomeAssistant } from "../../types"; -import "../ha-md-select-option"; import "../ha-md-select"; -import { stopPropagation } from "../../common/dom/stop_propagation"; +import "../ha-md-select-option"; const NO_AUTOMATION_KEY = "NO_AUTOMATION"; const UNKNOWN_AUTOMATION_KEY = "UNKNOWN_AUTOMATION"; diff --git a/src/components/device/ha-device-condition-picker.ts b/src/components/device/ha-device-condition-picker.ts index af59d0a4c6..a7a4e28dc0 100644 --- a/src/components/device/ha-device-condition-picker.ts +++ b/src/components/device/ha-device-condition-picker.ts @@ -1,9 +1,9 @@ import { customElement } from "lit/decorators"; -import type { DeviceCondition } from "../../data/device_automation"; +import type { DeviceCondition } from "../../data/device/device_automation"; import { fetchDeviceConditions, localizeDeviceAutomationCondition, -} from "../../data/device_automation"; +} from "../../data/device/device_automation"; import { HaDeviceAutomationPicker } from "./ha-device-automation-picker"; @customElement("ha-device-condition-picker") diff --git a/src/components/device/ha-device-picker.ts b/src/components/device/ha-device-picker.ts index b3542e8bb1..904569b6a8 100644 --- a/src/components/device/ha-device-picker.ts +++ b/src/components/device/ha-device-picker.ts @@ -12,8 +12,8 @@ import { deviceComboBoxKeys, getDevices, type DevicePickerItem, - type DeviceRegistryEntry, -} from "../../data/device_registry"; +} from "../../data/device/device_picker"; +import type { DeviceRegistryEntry } from "../../data/device/device_registry"; import type { HomeAssistant } from "../../types"; import { brandsUrl } from "../../util/brands-url"; import "../ha-generic-picker"; diff --git a/src/components/device/ha-device-trigger-picker.ts b/src/components/device/ha-device-trigger-picker.ts index a57ab1c8fc..310e5575a1 100644 --- a/src/components/device/ha-device-trigger-picker.ts +++ b/src/components/device/ha-device-trigger-picker.ts @@ -1,9 +1,9 @@ import { customElement } from "lit/decorators"; -import type { DeviceTrigger } from "../../data/device_automation"; +import type { DeviceTrigger } from "../../data/device/device_automation"; import { fetchDeviceTriggers, localizeDeviceAutomationTrigger, -} from "../../data/device_automation"; +} from "../../data/device/device_automation"; import { HaDeviceAutomationPicker } from "./ha-device-automation-picker"; @customElement("ha-device-trigger-picker") diff --git a/src/components/entity/ha-entities-picker.ts b/src/components/entity/ha-entities-picker.ts index 6aaacab031..c20f25904f 100644 --- a/src/components/entity/ha-entities-picker.ts +++ b/src/components/entity/ha-entities-picker.ts @@ -4,7 +4,7 @@ import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; import { isValidEntityId } from "../../common/entity/valid_entity_id"; -import type { HaEntityPickerEntityFilterFunc } from "../../data/entity"; +import type { HaEntityPickerEntityFilterFunc } from "../../data/entity/entity"; import type { HomeAssistant, ValueChangedEvent } from "../../types"; import "../ha-sortable"; import "./ha-entity-picker"; diff --git a/src/components/entity/ha-entity-picker.ts b/src/components/entity/ha-entity-picker.ts index 1f0a70a6ba..3f4741b11a 100644 --- a/src/components/entity/ha-entity-picker.ts +++ b/src/components/entity/ha-entity-picker.ts @@ -7,12 +7,12 @@ import { fireEvent } from "../../common/dom/fire_event"; import { computeEntityNameList } from "../../common/entity/compute_entity_name_display"; import { isValidEntityId } from "../../common/entity/valid_entity_id"; import { computeRTL } from "../../common/util/compute_rtl"; -import type { HaEntityPickerEntityFilterFunc } from "../../data/entity"; +import type { HaEntityPickerEntityFilterFunc } from "../../data/entity/entity"; import { entityComboBoxKeys, getEntities, type EntityComboBoxItem, -} from "../../data/entity_registry"; +} from "../../data/entity/entity_picker"; import { domainToName } from "../../data/integration"; import { isHelperDomain, diff --git a/src/components/entity/ha-entity-toggle.ts b/src/components/entity/ha-entity-toggle.ts index d998610679..d3662bcc06 100644 --- a/src/components/entity/ha-entity-toggle.ts +++ b/src/components/entity/ha-entity-toggle.ts @@ -6,7 +6,11 @@ import { customElement, property, state } from "lit/decorators"; import { STATES_OFF } from "../../common/const"; import { computeStateDomain } from "../../common/entity/compute_state_domain"; import { computeStateName } from "../../common/entity/compute_state_name"; -import { UNAVAILABLE, UNKNOWN, isUnavailableState } from "../../data/entity"; +import { + UNAVAILABLE, + UNKNOWN, + isUnavailableState, +} from "../../data/entity/entity"; import { forwardHaptic } from "../../data/haptics"; import type { HomeAssistant } from "../../types"; import "../ha-formfield"; diff --git a/src/components/entity/ha-state-label-badge.ts b/src/components/entity/ha-state-label-badge.ts index 497eb7e714..3e23fe4242 100644 --- a/src/components/entity/ha-state-label-badge.ts +++ b/src/components/entity/ha-state-label-badge.ts @@ -14,8 +14,12 @@ import { getNumberFormatOptions, isNumericState, } from "../../common/number/format_number"; -import { isUnavailableState, UNAVAILABLE, UNKNOWN } from "../../data/entity"; -import type { EntityRegistryDisplayEntry } from "../../data/entity_registry"; +import { + isUnavailableState, + UNAVAILABLE, + UNKNOWN, +} from "../../data/entity/entity"; +import type { EntityRegistryDisplayEntry } from "../../data/entity/entity_registry"; import { timerTimeRemaining } from "../../data/timer"; import type { HomeAssistant } from "../../types"; import "../ha-label-badge"; diff --git a/src/components/ha-area-picker.ts b/src/components/ha-area-picker.ts index a031fd224d..727a23ad1c 100644 --- a/src/components/ha-area-picker.ts +++ b/src/components/ha-area-picker.ts @@ -13,9 +13,9 @@ import { createAreaRegistryEntry } from "../data/area_registry"; import type { DeviceEntityDisplayLookup, DeviceRegistryEntry, -} from "../data/device_registry"; -import { getDeviceEntityDisplayLookup } from "../data/device_registry"; -import type { EntityRegistryDisplayEntry } from "../data/entity_registry"; +} from "../data/device/device_registry"; +import { getDeviceEntityDisplayLookup } from "../data/device/device_registry"; +import type { EntityRegistryDisplayEntry } from "../data/entity/entity_registry"; import { showAlertDialog } from "../dialogs/generic/show-dialog-box"; import { showAreaRegistryDetailDialog } from "../panels/config/areas/show-dialog-area-registry-detail"; import type { HomeAssistant, ValueChangedEvent } from "../types"; @@ -296,7 +296,6 @@ export class HaAreaPicker extends LitElement { secondary: floorName, icon: area.icon || undefined, icon_path: area.icon ? undefined : mdiTextureBox, - sorting_label: areaName, search_labels: { areaName: areaName || null, floorName: floorName || null, diff --git a/src/components/ha-attributes.ts b/src/components/ha-attributes.ts index 7dc3116bd7..a990e5292a 100644 --- a/src/components/ha-attributes.ts +++ b/src/components/ha-attributes.ts @@ -3,15 +3,15 @@ import type { CSSResultGroup, PropertyValues } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeAttributeNameDisplay } from "../common/entity/compute_attribute_display"; +import { computeStateDomain } from "../common/entity/compute_state_domain"; import { STATE_ATTRIBUTES, STATE_ATTRIBUTES_DOMAIN_CLASS, -} from "../data/entity_attributes"; +} from "../data/entity/entity_attributes"; import { haStyle } from "../resources/styles"; import type { HomeAssistant } from "../types"; import "./ha-attribute-value"; import "./ha-expansion-panel"; -import { computeStateDomain } from "../common/entity/compute_state_domain"; @customElement("ha-attributes") class HaAttributes extends LitElement { diff --git a/src/components/ha-climate-state.ts b/src/components/ha-climate-state.ts index 2fd0044eda..978088d5d1 100644 --- a/src/components/ha-climate-state.ts +++ b/src/components/ha-climate-state.ts @@ -3,7 +3,7 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import type { ClimateEntity } from "../data/climate"; import { CLIMATE_PRESET_NONE } from "../data/climate"; -import { isUnavailableState, OFF } from "../data/entity"; +import { isUnavailableState, OFF } from "../data/entity/entity"; import type { HomeAssistant } from "../types"; @customElement("ha-climate-state") diff --git a/src/components/ha-conversation-agent-picker.ts b/src/components/ha-conversation-agent-picker.ts index a6f45ae495..e576549b90 100644 --- a/src/components/ha-conversation-agent-picker.ts +++ b/src/components/ha-conversation-agent-picker.ts @@ -9,14 +9,14 @@ import type { ConfigEntry, SubEntry } from "../data/config_entries"; import { getConfigEntry, getSubEntries } from "../data/config_entries"; import type { Agent } from "../data/conversation"; import { listAgents } from "../data/conversation"; +import { getExtendedEntityRegistryEntry } from "../data/entity/entity_registry"; import { fetchIntegrationManifest } from "../data/integration"; import { showOptionsFlowDialog } from "../dialogs/config-flow/show-dialog-options-flow"; +import { showSubConfigFlowDialog } from "../dialogs/config-flow/show-dialog-sub-config-flow"; import type { HomeAssistant } from "../types"; import "./ha-list-item"; import "./ha-select"; import type { HaSelect } from "./ha-select"; -import { getExtendedEntityRegistryEntry } from "../data/entity_registry"; -import { showSubConfigFlowDialog } from "../dialogs/config-flow/show-dialog-sub-config-flow"; const NONE = "__NONE_OPTION__"; diff --git a/src/components/ha-filter-labels.ts b/src/components/ha-filter-labels.ts index 71b5a27c55..962a8ad6d1 100644 --- a/src/components/ha-filter-labels.ts +++ b/src/components/ha-filter-labels.ts @@ -10,8 +10,8 @@ import { computeCssColor } from "../common/color/compute-color"; import { fireEvent } from "../common/dom/fire_event"; import { navigate } from "../common/navigate"; import { stringCompare } from "../common/string/compare"; -import type { LabelRegistryEntry } from "../data/label_registry"; -import { subscribeLabelRegistry } from "../data/label_registry"; +import type { LabelRegistryEntry } from "../data/label/label_registry"; +import { subscribeLabelRegistry } from "../data/label/label_registry"; import { SubscribeMixin } from "../mixins/subscribe-mixin"; import { haStyleScrollbar } from "../resources/styles"; import type { HomeAssistant } from "../types"; diff --git a/src/components/ha-floor-picker.ts b/src/components/ha-floor-picker.ts index 9627b59e55..13bde5b212 100644 --- a/src/components/ha-floor-picker.ts +++ b/src/components/ha-floor-picker.ts @@ -12,9 +12,9 @@ import { updateAreaRegistryEntry } from "../data/area_registry"; import type { DeviceEntityDisplayLookup, DeviceRegistryEntry, -} from "../data/device_registry"; -import { getDeviceEntityDisplayLookup } from "../data/device_registry"; -import type { EntityRegistryDisplayEntry } from "../data/entity_registry"; +} from "../data/device/device_registry"; +import { getDeviceEntityDisplayLookup } from "../data/device/device_registry"; +import type { EntityRegistryDisplayEntry } from "../data/entity/entity_registry"; import { createFloorRegistryEntry, getFloorAreaLookup, @@ -291,7 +291,6 @@ export class HaFloorPicker extends LitElement { id: floor.floor_id, primary: floorName, floor: floor, - sorting_label: floor.level?.toString() || "zzzzz", search_labels: { floorName, floor_id: floor.floor_id, diff --git a/src/components/ha-humidifier-state.ts b/src/components/ha-humidifier-state.ts index e1a94409e7..4fe2946de4 100644 --- a/src/components/ha-humidifier-state.ts +++ b/src/components/ha-humidifier-state.ts @@ -1,7 +1,7 @@ import type { TemplateResult } from "lit"; import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { isUnavailableState, OFF } from "../data/entity"; +import { isUnavailableState, OFF } from "../data/entity/entity"; import type { HumidifierEntity } from "../data/humidifier"; import type { HomeAssistant } from "../types"; diff --git a/src/components/ha-label-picker.ts b/src/components/ha-label-picker.ts index f52e6eeeb5..6b44741564 100644 --- a/src/components/ha-label-picker.ts +++ b/src/components/ha-label-picker.ts @@ -11,13 +11,12 @@ import { } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; -import type { LabelRegistryEntry } from "../data/label_registry"; +import { getLabels, labelComboBoxKeys } from "../data/label/label_picker"; import { createLabelRegistryEntry, - getLabels, - labelComboBoxKeys, subscribeLabelRegistry, -} from "../data/label_registry"; + type LabelRegistryEntry, +} from "../data/label/label_registry"; import { showAlertDialog } from "../dialogs/generic/show-dialog-box"; import { SubscribeMixin } from "../mixins/subscribe-mixin"; import { showLabelDetailDialog } from "../panels/config/labels/show-dialog-label-detail"; diff --git a/src/components/ha-labels-picker.ts b/src/components/ha-labels-picker.ts index 8963554b70..51470b9a85 100644 --- a/src/components/ha-labels-picker.ts +++ b/src/components/ha-labels-picker.ts @@ -8,11 +8,11 @@ import memoizeOne from "memoize-one"; import { computeCssColor } from "../common/color/compute-color"; import { fireEvent } from "../common/dom/fire_event"; import { stringCompare } from "../common/string/compare"; -import type { LabelRegistryEntry } from "../data/label_registry"; +import type { LabelRegistryEntry } from "../data/label/label_registry"; import { subscribeLabelRegistry, updateLabelRegistryEntry, -} from "../data/label_registry"; +} from "../data/label/label_registry"; import { SubscribeMixin } from "../mixins/subscribe-mixin"; import { showLabelDetailDialog } from "../panels/config/labels/show-dialog-label-detail"; import type { HomeAssistant, ValueChangedEvent } from "../types"; diff --git a/src/components/ha-picker-combo-box.ts b/src/components/ha-picker-combo-box.ts index 1402763b07..42647de188 100644 --- a/src/components/ha-picker-combo-box.ts +++ b/src/components/ha-picker-combo-box.ts @@ -288,13 +288,30 @@ export class HaPickerComboBox extends ScrollableFadeMixin(LitElement) { let items = [...this.getItems(this._search, this.selectedSection)]; if (!this.sections?.length) { - items = items.sort((entityA, entityB) => - caseInsensitiveStringCompare( - (entityA as PickerComboBoxItem).sorting_label!, - (entityB as PickerComboBoxItem).sorting_label!, + items = items.sort((entityA, entityB) => { + const sortLabelA = + typeof entityA === "string" ? entityA : entityA.sorting_label; + const sortLabelB = + typeof entityB === "string" ? entityB : entityB.sorting_label; + + if (!sortLabelA || !sortLabelB) { + return 0; + } + + if (!sortLabelB) { + return -1; + } + + if (!sortLabelA) { + return 1; + } + + return caseInsensitiveStringCompare( + sortLabelA, + sortLabelB, this.hass?.locale.language ?? navigator.language - ) - ); + ); + }); } if (!items.length) { diff --git a/src/components/ha-selector/ha-selector-action.ts b/src/components/ha-selector/ha-selector-action.ts index b4f437c8b0..b578ac5d0e 100644 --- a/src/components/ha-selector/ha-selector-action.ts +++ b/src/components/ha-selector/ha-selector-action.ts @@ -7,7 +7,7 @@ import { fullEntitiesContext } from "../../data/context"; import { subscribeEntityRegistry, type EntityRegistryEntry, -} from "../../data/entity_registry"; +} from "../../data/entity/entity_registry"; import type { Action } from "../../data/script"; import { migrateAutomationAction } from "../../data/script"; import type { ActionSelector } from "../../data/selector"; diff --git a/src/components/ha-selector/ha-selector-area.ts b/src/components/ha-selector/ha-selector-area.ts index d2abf64449..e8fcff9c3d 100644 --- a/src/components/ha-selector/ha-selector-area.ts +++ b/src/components/ha-selector/ha-selector-area.ts @@ -4,14 +4,14 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { ensureArray } from "../../common/array/ensure-array"; -import type { DeviceRegistryEntry } from "../../data/device_registry"; -import { getDeviceIntegrationLookup } from "../../data/device_registry"; import { fireEvent } from "../../common/dom/fire_event"; -import type { EntitySources } from "../../data/entity_sources"; -import { fetchEntitySourcesWithCache } from "../../data/entity_sources"; -import type { AreaSelector } from "../../data/selector"; import type { ConfigEntry } from "../../data/config_entries"; import { getConfigEntries } from "../../data/config_entries"; +import type { DeviceRegistryEntry } from "../../data/device/device_registry"; +import { getDeviceIntegrationLookup } from "../../data/device/device_registry"; +import type { EntitySources } from "../../data/entity/entity_sources"; +import { fetchEntitySourcesWithCache } from "../../data/entity/entity_sources"; +import type { AreaSelector } from "../../data/selector"; import { filterSelectorDevices, filterSelectorEntities, diff --git a/src/components/ha-selector/ha-selector-device.ts b/src/components/ha-selector/ha-selector-device.ts index fa86106ff7..efa26dcff9 100644 --- a/src/components/ha-selector/ha-selector-device.ts +++ b/src/components/ha-selector/ha-selector-device.ts @@ -5,13 +5,13 @@ import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { ensureArray } from "../../common/array/ensure-array"; import { fireEvent } from "../../common/dom/fire_event"; -import type { DeviceRegistryEntry } from "../../data/device_registry"; -import { getDeviceIntegrationLookup } from "../../data/device_registry"; -import type { EntitySources } from "../../data/entity_sources"; -import { fetchEntitySourcesWithCache } from "../../data/entity_sources"; -import type { DeviceSelector } from "../../data/selector"; import type { ConfigEntry } from "../../data/config_entries"; import { getConfigEntries } from "../../data/config_entries"; +import type { DeviceRegistryEntry } from "../../data/device/device_registry"; +import { getDeviceIntegrationLookup } from "../../data/device/device_registry"; +import type { EntitySources } from "../../data/entity/entity_sources"; +import { fetchEntitySourcesWithCache } from "../../data/entity/entity_sources"; +import type { DeviceSelector } from "../../data/selector"; import { filterSelectorDevices, filterSelectorEntities, diff --git a/src/components/ha-selector/ha-selector-entity.ts b/src/components/ha-selector/ha-selector-entity.ts index 7d8a7dc68e..d05e470a83 100644 --- a/src/components/ha-selector/ha-selector-entity.ts +++ b/src/components/ha-selector/ha-selector-entity.ts @@ -4,12 +4,12 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ensureArray } from "../../common/array/ensure-array"; import { fireEvent } from "../../common/dom/fire_event"; -import type { EntitySources } from "../../data/entity_sources"; -import { fetchEntitySourcesWithCache } from "../../data/entity_sources"; +import type { EntitySources } from "../../data/entity/entity_sources"; +import { fetchEntitySourcesWithCache } from "../../data/entity/entity_sources"; import type { EntitySelector } from "../../data/selector"; import { - filterSelectorEntities, computeCreateDomains, + filterSelectorEntities, } from "../../data/selector"; import type { HomeAssistant } from "../../types"; import "../entity/ha-entities-picker"; diff --git a/src/components/ha-selector/ha-selector-floor.ts b/src/components/ha-selector/ha-selector-floor.ts index f7135c2158..feff510da7 100644 --- a/src/components/ha-selector/ha-selector-floor.ts +++ b/src/components/ha-selector/ha-selector-floor.ts @@ -4,14 +4,14 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { ensureArray } from "../../common/array/ensure-array"; -import type { DeviceRegistryEntry } from "../../data/device_registry"; -import { getDeviceIntegrationLookup } from "../../data/device_registry"; import { fireEvent } from "../../common/dom/fire_event"; -import type { EntitySources } from "../../data/entity_sources"; -import { fetchEntitySourcesWithCache } from "../../data/entity_sources"; -import type { FloorSelector } from "../../data/selector"; import type { ConfigEntry } from "../../data/config_entries"; import { getConfigEntries } from "../../data/config_entries"; +import type { DeviceRegistryEntry } from "../../data/device/device_registry"; +import { getDeviceIntegrationLookup } from "../../data/device/device_registry"; +import type { EntitySources } from "../../data/entity/entity_sources"; +import { fetchEntitySourcesWithCache } from "../../data/entity/entity_sources"; +import type { FloorSelector } from "../../data/selector"; import { filterSelectorDevices, filterSelectorEntities, diff --git a/src/components/ha-selector/ha-selector-target.ts b/src/components/ha-selector/ha-selector-target.ts index 00282b2ddb..68c512a143 100644 --- a/src/components/ha-selector/ha-selector-target.ts +++ b/src/components/ha-selector/ha-selector-target.ts @@ -7,15 +7,15 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { ensureArray } from "../../common/array/ensure-array"; -import type { DeviceRegistryEntry } from "../../data/device_registry"; -import { getDeviceIntegrationLookup } from "../../data/device_registry"; -import type { EntitySources } from "../../data/entity_sources"; -import { fetchEntitySourcesWithCache } from "../../data/entity_sources"; +import type { DeviceRegistryEntry } from "../../data/device/device_registry"; +import { getDeviceIntegrationLookup } from "../../data/device/device_registry"; +import type { EntitySources } from "../../data/entity/entity_sources"; +import { fetchEntitySourcesWithCache } from "../../data/entity/entity_sources"; import type { TargetSelector } from "../../data/selector"; import { + computeCreateDomains, filterSelectorDevices, filterSelectorEntities, - computeCreateDomains, } from "../../data/selector"; import type { HomeAssistant } from "../../types"; import "../ha-target-picker"; diff --git a/src/components/ha-target-picker.ts b/src/components/ha-target-picker.ts index ad9d38ab84..67903b946e 100644 --- a/src/components/ha-target-picker.ts +++ b/src/components/ha-target-picker.ts @@ -13,32 +13,30 @@ import memoizeOne from "memoize-one"; import { ensureArray } from "../common/array/ensure-array"; import { fireEvent } from "../common/dom/fire_event"; import { isValidEntityId } from "../common/entity/valid_entity_id"; +import { caseInsensitiveStringCompare } from "../common/string/compare"; import { computeRTL } from "../common/util/compute_rtl"; import { areaFloorComboBoxKeys, getAreasAndFloors, type AreaFloorValue, type FloorComboBoxItem, -} from "../data/area_floor"; +} from "../data/area_floor_picker"; import { getConfigEntries, type ConfigEntry } from "../data/config_entries"; import { labelsContext } from "../data/context"; import { deviceComboBoxKeys, getDevices, type DevicePickerItem, -} from "../data/device_registry"; -import type { HaEntityPickerEntityFilterFunc } from "../data/entity"; +} from "../data/device/device_picker"; +import type { HaEntityPickerEntityFilterFunc } from "../data/entity/entity"; import { entityComboBoxKeys, getEntities, type EntityComboBoxItem, -} from "../data/entity_registry"; +} from "../data/entity/entity_picker"; import { domainToName } from "../data/integration"; -import { - getLabels, - labelComboBoxKeys, - type LabelRegistryEntry, -} from "../data/label_registry"; +import { getLabels, labelComboBoxKeys } from "../data/label/label_picker"; +import type { LabelRegistryEntry } from "../data/label/label_registry"; import { areaMeetsFilter, deviceMeetsFilter, @@ -745,7 +743,7 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) { : undefined, undefined, `entity${SEPARATOR}` - ); + ).sort(this._sortBySortingLabel); if (searchTerm) { entityItems = this._filterGroup( @@ -778,7 +776,7 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) { : undefined, undefined, `device${SEPARATOR}` - ); + ).sort(this._sortBySortingLabel); if (searchTerm) { deviceItems = this._filterGroup( @@ -864,7 +862,7 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) { entityFilter, targetValue?.label_id ? ensureArray(targetValue.label_id) : undefined, `label${SEPARATOR}` - ); + ).sort(this._sortBySortingLabel); if (searchTerm) { labels = this._filterGroup( @@ -1070,6 +1068,13 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) { term: html`‘${search}’`, }); + private _sortBySortingLabel = (entityA, entityB) => + caseInsensitiveStringCompare( + (entityA as PickerComboBoxItem).sorting_label!, + (entityB as PickerComboBoxItem).sorting_label!, + this.hass?.locale.language ?? navigator.language + ); + static get styles(): CSSResultGroup { return css` .add-target-wrapper { diff --git a/src/components/media-player/dialog-join-media-players.ts b/src/components/media-player/dialog-join-media-players.ts index 514d3a4cb8..e4f3804925 100644 --- a/src/components/media-player/dialog-join-media-players.ts +++ b/src/components/media-player/dialog-join-media-players.ts @@ -7,7 +7,7 @@ import { fireEvent } from "../../common/dom/fire_event"; import { computeDomain } from "../../common/entity/compute_domain"; import { computeStateName } from "../../common/entity/compute_state_name"; import { supportsFeature } from "../../common/entity/supports-feature"; -import type { EntityRegistryDisplayEntry } from "../../data/entity_registry"; +import type { EntityRegistryDisplayEntry } from "../../data/entity/entity_registry"; import { extractApiErrorMessage } from "../../data/hassio/common"; import { type MediaPlayerEntity, diff --git a/src/components/media-player/ha-media-player-browse.ts b/src/components/media-player/ha-media-player-browse.ts index 29ae9bc749..33c8329d2b 100644 --- a/src/components/media-player/ha-media-player-browse.ts +++ b/src/components/media-player/ha-media-player-browse.ts @@ -17,7 +17,7 @@ import { until } from "lit/directives/until"; import { fireEvent } from "../../common/dom/fire_event"; import { slugify } from "../../common/string/slugify"; import { debounce } from "../../common/util/debounce"; -import { isUnavailableState } from "../../data/entity"; +import { isUnavailableState } from "../../data/entity/entity"; import type { MediaPickedEvent, MediaPlayerBrowseAction, diff --git a/src/components/target-picker/dialog/show-dialog-target-details.ts b/src/components/target-picker/dialog/show-dialog-target-details.ts index 8758703e95..472c10da50 100644 --- a/src/components/target-picker/dialog/show-dialog-target-details.ts +++ b/src/components/target-picker/dialog/show-dialog-target-details.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import type { HaEntityPickerEntityFilterFunc } from "../../../data/entity"; +import type { HaEntityPickerEntityFilterFunc } from "../../../data/entity/entity"; import type { TargetType } from "../../../data/target"; import type { HaDevicePickerDeviceFilterFunc } from "../../device/ha-device-picker"; diff --git a/src/components/target-picker/ha-target-picker-item-group.ts b/src/components/target-picker/ha-target-picker-item-group.ts index a037999adf..f196b182af 100644 --- a/src/components/target-picker/ha-target-picker-item-group.ts +++ b/src/components/target-picker/ha-target-picker-item-group.ts @@ -1,6 +1,6 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; -import type { HaEntityPickerEntityFilterFunc } from "../../data/entity"; +import type { HaEntityPickerEntityFilterFunc } from "../../data/entity/entity"; import type { TargetType, TargetTypeFloorless } from "../../data/target"; import type { HomeAssistant } from "../../types"; import type { HaDevicePickerDeviceFilterFunc } from "../device/ha-device-picker"; diff --git a/src/components/target-picker/ha-target-picker-item-row.ts b/src/components/target-picker/ha-target-picker-item-row.ts index cfc07474b6..4d9d82c0c8 100644 --- a/src/components/target-picker/ha-target-picker-item-row.ts +++ b/src/components/target-picker/ha-target-picker-item-row.ts @@ -23,11 +23,11 @@ import { computeRTL } from "../../common/util/compute_rtl"; import type { AreaRegistryEntry } from "../../data/area_registry"; import { getConfigEntry } from "../../data/config_entries"; import { labelsContext } from "../../data/context"; -import type { DeviceRegistryEntry } from "../../data/device_registry"; -import type { HaEntityPickerEntityFilterFunc } from "../../data/entity"; +import type { DeviceRegistryEntry } from "../../data/device/device_registry"; +import type { HaEntityPickerEntityFilterFunc } from "../../data/entity/entity"; import type { FloorRegistryEntry } from "../../data/floor_registry"; import { domainToName } from "../../data/integration"; -import type { LabelRegistryEntry } from "../../data/label_registry"; +import type { LabelRegistryEntry } from "../../data/label/label_registry"; import { areaMeetsFilter, deviceMeetsFilter, diff --git a/src/components/target-picker/ha-target-picker-value-chip.ts b/src/components/target-picker/ha-target-picker-value-chip.ts index 957ab0e839..c4b650b48c 100644 --- a/src/components/target-picker/ha-target-picker-value-chip.ts +++ b/src/components/target-picker/ha-target-picker-value-chip.ts @@ -23,7 +23,7 @@ import { slugify } from "../../common/string/slugify"; import { getConfigEntry } from "../../data/config_entries"; import { labelsContext } from "../../data/context"; import { domainToName } from "../../data/integration"; -import type { LabelRegistryEntry } from "../../data/label_registry"; +import type { LabelRegistryEntry } from "../../data/label/label_registry"; import type { TargetType } from "../../data/target"; import type { HomeAssistant } from "../../types"; import { brandsUrl } from "../../util/brands-url"; diff --git a/src/components/trace/ha-trace-path-details.ts b/src/components/trace/ha-trace-path-details.ts index 7a513d734a..27f925f540 100644 --- a/src/components/trace/ha-trace-path-details.ts +++ b/src/components/trace/ha-trace-path-details.ts @@ -1,14 +1,21 @@ -import { dump } from "js-yaml"; import { consume } from "@lit/context"; +import { dump } from "js-yaml"; import type { CSSResultGroup, TemplateResult } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { formatDateTimeWithSeconds } from "../../common/datetime/format_date_time"; -import "../ha-code-editor"; -import "../ha-icon-button"; -import "./hat-logbook-note"; +import { describeCondition, describeTrigger } from "../../data/automation_i18n"; +import { + floorsContext, + fullEntitiesContext, + labelsContext, +} from "../../data/context"; +import type { EntityRegistryEntry } from "../../data/entity/entity_registry"; +import type { FloorRegistryEntry } from "../../data/floor_registry"; +import type { LabelRegistryEntry } from "../../data/label/label_registry"; import type { LogbookEntry } from "../../data/logbook"; +import { describeAction } from "../../data/script_i18n"; import type { ActionTraceStep, ChooseActionTraceStep, @@ -16,19 +23,12 @@ import type { } from "../../data/trace"; import { getDataFromPath } from "../../data/trace"; import "../../panels/logbook/ha-logbook-renderer"; -import { traceTabStyles } from "./trace-tab-styles"; import type { HomeAssistant } from "../../types"; +import "../ha-code-editor"; +import "../ha-icon-button"; +import "./hat-logbook-note"; import type { NodeInfo } from "./hat-script-graph"; -import { describeCondition, describeTrigger } from "../../data/automation_i18n"; -import type { EntityRegistryEntry } from "../../data/entity_registry"; -import type { LabelRegistryEntry } from "../../data/label_registry"; -import type { FloorRegistryEntry } from "../../data/floor_registry"; -import { - floorsContext, - fullEntitiesContext, - labelsContext, -} from "../../data/context"; -import { describeAction } from "../../data/script_i18n"; +import { traceTabStyles } from "./trace-tab-styles"; const TRACE_PATH_TABS = [ "step_config", diff --git a/src/components/trace/hat-trace-timeline.ts b/src/components/trace/hat-trace-timeline.ts index 2ffbf04256..44c3df45ad 100644 --- a/src/components/trace/hat-trace-timeline.ts +++ b/src/components/trace/hat-trace-timeline.ts @@ -20,14 +20,14 @@ import { fullEntitiesContext, labelsContext, } from "../../data/context"; -import type { EntityRegistryEntry } from "../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../data/entity/entity_registry"; import type { FloorRegistryEntry } from "../../data/floor_registry"; -import type { LabelRegistryEntry } from "../../data/label_registry"; +import type { LabelRegistryEntry } from "../../data/label/label_registry"; import type { LogbookEntry } from "../../data/logbook"; import type { ChooseAction, - Option, IfAction, + Option, ParallelAction, RepeatAction, SequenceAction, diff --git a/src/data/alarm_control_panel.ts b/src/data/alarm_control_panel.ts index e5169ff71b..7cf04433d0 100644 --- a/src/data/alarm_control_panel.ts +++ b/src/data/alarm_control_panel.ts @@ -13,7 +13,7 @@ import type { import { supportsFeature } from "../common/entity/supports-feature"; import { showEnterCodeDialog } from "../dialogs/enter-code/show-enter-code-dialog"; import type { HomeAssistant } from "../types"; -import { getExtendedEntityRegistryEntry } from "./entity_registry"; +import { getExtendedEntityRegistryEntry } from "./entity/entity_registry"; export const FORMAT_TEXT = "text"; export const FORMAT_NUMBER = "number"; diff --git a/src/data/area_floor.ts b/src/data/area_floor_picker.ts similarity index 98% rename from src/data/area_floor.ts rename to src/data/area_floor_picker.ts index 821b3978fb..984ba51a41 100644 --- a/src/data/area_floor.ts +++ b/src/data/area_floor_picker.ts @@ -11,9 +11,9 @@ import { getDeviceEntityDisplayLookup, type DeviceEntityDisplayLookup, type DeviceRegistryEntry, -} from "./device_registry"; -import type { HaEntityPickerEntityFilterFunc } from "./entity"; -import type { EntityRegistryDisplayEntry } from "./entity_registry"; +} from "./device/device_registry"; +import type { HaEntityPickerEntityFilterFunc } from "./entity/entity"; +import type { EntityRegistryDisplayEntry } from "./entity/entity_registry"; import type { FloorRegistryEntry } from "./floor_registry"; export interface FloorComboBoxItem extends PickerComboBoxItem { diff --git a/src/data/area_registry.ts b/src/data/area_registry.ts index 15a0a19fff..e5174e0869 100644 --- a/src/data/area_registry.ts +++ b/src/data/area_registry.ts @@ -1,9 +1,9 @@ import type { HomeAssistant } from "../types"; -import type { DeviceRegistryEntry } from "./device_registry"; +import type { DeviceRegistryEntry } from "./device/device_registry"; import type { EntityRegistryDisplayEntry, EntityRegistryEntry, -} from "./entity_registry"; +} from "./entity/entity_registry"; import type { RegistryEntry } from "./registry"; export { subscribeAreaRegistry } from "./ws-area_registry"; diff --git a/src/data/assist_satellite.ts b/src/data/assist_satellite.ts index 7b13c4a47c..2ad488ce55 100644 --- a/src/data/assist_satellite.ts +++ b/src/data/assist_satellite.ts @@ -1,7 +1,7 @@ import type { HassEntity } from "home-assistant-js-websocket"; -import type { HomeAssistant } from "../types"; import { supportsFeature } from "../common/entity/supports-feature"; -import { UNAVAILABLE } from "./entity"; +import type { HomeAssistant } from "../types"; +import { UNAVAILABLE } from "./entity/entity"; export const enum AssistSatelliteEntityFeature { ANNOUNCE = 1, diff --git a/src/data/automation.ts b/src/data/automation.ts index 7b6578c06a..0e5bd0c753 100644 --- a/src/data/automation.ts +++ b/src/data/automation.ts @@ -12,7 +12,10 @@ import type { Context, HomeAssistant } from "../types"; import type { BlueprintInput } from "./blueprint"; import type { ConditionDescription } from "./condition"; import { CONDITION_BUILDING_BLOCKS } from "./condition"; -import type { DeviceCondition, DeviceTrigger } from "./device_automation"; +import type { + DeviceCondition, + DeviceTrigger, +} from "./device/device_automation"; import type { Action, Field, MODES } from "./script"; import { migrateAutomationAction } from "./script"; import type { TriggerDescription } from "./trigger"; diff --git a/src/data/automation_i18n.ts b/src/data/automation_i18n.ts index 0e6ac522cd..0790fb9db3 100644 --- a/src/data/automation_i18n.ts +++ b/src/data/automation_i18n.ts @@ -26,12 +26,15 @@ import type { Trigger, } from "./automation"; import { getConditionDomain, getConditionObjectId } from "./condition"; -import type { DeviceCondition, DeviceTrigger } from "./device_automation"; +import type { + DeviceCondition, + DeviceTrigger, +} from "./device/device_automation"; import { localizeDeviceAutomationCondition, localizeDeviceAutomationTrigger, -} from "./device_automation"; -import type { EntityRegistryEntry } from "./entity_registry"; +} from "./device/device_automation"; +import type { EntityRegistryEntry } from "./entity/entity_registry"; import type { FrontendLocaleData } from "./translation"; import { getTriggerDomain, getTriggerObjectId, isTriggerList } from "./trigger"; diff --git a/src/data/calendar.ts b/src/data/calendar.ts index 77d7e5d435..3aa69f6250 100644 --- a/src/data/calendar.ts +++ b/src/data/calendar.ts @@ -2,7 +2,7 @@ import { getColorByIndex } from "../common/color/colors"; import { computeDomain } from "../common/entity/compute_domain"; import { computeStateName } from "../common/entity/compute_state_name"; import type { HomeAssistant } from "../types"; -import { isUnavailableState } from "./entity"; +import { isUnavailableState } from "./entity/entity"; export interface Calendar { entity_id: string; diff --git a/src/data/context.ts b/src/data/context.ts index 92223f8bfc..2dcdc9832a 100644 --- a/src/data/context.ts +++ b/src/data/context.ts @@ -1,8 +1,8 @@ import { createContext } from "@lit/context"; import type { HassConfig } from "home-assistant-js-websocket"; import type { HomeAssistant } from "../types"; -import type { EntityRegistryEntry } from "./entity_registry"; -import type { LabelRegistryEntry } from "./label_registry"; +import type { EntityRegistryEntry } from "./entity/entity_registry"; +import type { LabelRegistryEntry } from "./label/label_registry"; export const connectionContext = createContext("connection"); diff --git a/src/data/cover.ts b/src/data/cover.ts index 1c5a4e5afb..d86ba7e578 100644 --- a/src/data/cover.ts +++ b/src/data/cover.ts @@ -5,7 +5,7 @@ import type { import { stateActive } from "../common/entity/state_active"; import { supportsFeature } from "../common/entity/supports-feature"; import type { HomeAssistant } from "../types"; -import { UNAVAILABLE } from "./entity"; +import { UNAVAILABLE } from "./entity/entity"; export const enum CoverEntityFeature { OPEN = 1, diff --git a/src/data/device_automation.ts b/src/data/device/device_automation.ts similarity index 94% rename from src/data/device_automation.ts rename to src/data/device/device_automation.ts index 9bc011a591..d8a0fdd10c 100644 --- a/src/data/device_automation.ts +++ b/src/data/device/device_automation.ts @@ -1,14 +1,14 @@ -import { computeStateName } from "../common/entity/compute_state_name"; -import type { HaFormSchema } from "../components/ha-form/types"; -import type { HomeAssistant } from "../types"; -import type { BaseTrigger } from "./automation"; -import { migrateAutomationTrigger } from "./automation"; -import type { EntityRegistryEntry } from "./entity_registry"; +import { computeStateName } from "../../common/entity/compute_state_name"; +import type { HaFormSchema } from "../../components/ha-form/types"; +import type { HomeAssistant } from "../../types"; +import type { BaseTrigger } from "../automation"; +import { migrateAutomationTrigger } from "../automation"; +import type { EntityRegistryEntry } from "../entity/entity_registry"; import { computeEntityRegistryName, entityRegistryByEntityId, entityRegistryById, -} from "./entity_registry"; +} from "../entity/entity_registry"; export interface DeviceAutomation { alias?: string; diff --git a/src/data/device/device_picker.ts b/src/data/device/device_picker.ts new file mode 100644 index 0000000000..d4fe7644a5 --- /dev/null +++ b/src/data/device/device_picker.ts @@ -0,0 +1,182 @@ +import { computeAreaName } from "../../common/entity/compute_area_name"; +import { computeDeviceNameDisplay } from "../../common/entity/compute_device_name"; +import { computeDomain } from "../../common/entity/compute_domain"; +import { getDeviceContext } from "../../common/entity/context/get_device_context"; +import type { HaDevicePickerDeviceFilterFunc } from "../../components/device/ha-device-picker"; +import type { PickerComboBoxItem } from "../../components/ha-picker-combo-box"; +import type { FuseWeightedKey } from "../../resources/fuseMultiTerm"; +import type { HomeAssistant } from "../../types"; +import type { ConfigEntry } from "../config_entries"; +import type { HaEntityPickerEntityFilterFunc } from "../entity/entity"; +import { domainToName } from "../integration"; +import { + getDeviceEntityDisplayLookup, + type DeviceEntityDisplayLookup, +} from "./device_registry"; + +export interface DevicePickerItem extends PickerComboBoxItem { + domain?: string; + domain_name?: string; +} + +export const deviceComboBoxKeys: FuseWeightedKey[] = [ + { + name: "search_labels.deviceName", + weight: 10, + }, + { + name: "search_labels.areaName", + weight: 8, + }, + { + name: "search_labels.domainName", + weight: 4, + }, + { + name: "search_labels.domain", + weight: 4, + }, +]; + +export const getDevices = ( + hass: HomeAssistant, + configEntryLookup: Record, + includeDomains?: string[], + excludeDomains?: string[], + includeDeviceClasses?: string[], + deviceFilter?: HaDevicePickerDeviceFilterFunc, + entityFilter?: HaEntityPickerEntityFilterFunc, + excludeDevices?: string[], + value?: string, + idPrefix = "" +): DevicePickerItem[] => { + const devices = Object.values(hass.devices); + const entities = Object.values(hass.entities); + + let deviceEntityLookup: DeviceEntityDisplayLookup = {}; + + if ( + includeDomains || + excludeDomains || + includeDeviceClasses || + entityFilter + ) { + deviceEntityLookup = getDeviceEntityDisplayLookup(entities); + } + + let inputDevices = devices.filter( + (device) => device.id === value || !device.disabled_by + ); + + if (includeDomains) { + inputDevices = inputDevices.filter((device) => { + const devEntities = deviceEntityLookup[device.id]; + if (!devEntities || !devEntities.length) { + return false; + } + return deviceEntityLookup[device.id].some((entity) => + includeDomains.includes(computeDomain(entity.entity_id)) + ); + }); + } + + if (excludeDomains) { + inputDevices = inputDevices.filter((device) => { + const devEntities = deviceEntityLookup[device.id]; + if (!devEntities || !devEntities.length) { + return true; + } + return entities.every( + (entity) => !excludeDomains.includes(computeDomain(entity.entity_id)) + ); + }); + } + + if (excludeDevices) { + inputDevices = inputDevices.filter( + (device) => !excludeDevices!.includes(device.id) + ); + } + + if (includeDeviceClasses) { + inputDevices = inputDevices.filter((device) => { + const devEntities = deviceEntityLookup[device.id]; + if (!devEntities || !devEntities.length) { + return false; + } + return deviceEntityLookup[device.id].some((entity) => { + const stateObj = hass.states[entity.entity_id]; + if (!stateObj) { + return false; + } + return ( + stateObj.attributes.device_class && + includeDeviceClasses.includes(stateObj.attributes.device_class) + ); + }); + }); + } + + if (entityFilter) { + inputDevices = inputDevices.filter((device) => { + const devEntities = deviceEntityLookup[device.id]; + if (!devEntities || !devEntities.length) { + return false; + } + return devEntities.some((entity) => { + const stateObj = hass.states[entity.entity_id]; + if (!stateObj) { + return false; + } + return entityFilter(stateObj); + }); + }); + } + + if (deviceFilter) { + inputDevices = inputDevices.filter( + (device) => + // We always want to include the device of the current value + device.id === value || deviceFilter!(device) + ); + } + + const outputDevices = inputDevices.map((device) => { + const deviceName = computeDeviceNameDisplay( + device, + hass, + deviceEntityLookup[device.id] + ); + + const { area } = getDeviceContext(device, hass); + + const areaName = area ? computeAreaName(area) : undefined; + + const configEntry = device.primary_config_entry + ? configEntryLookup?.[device.primary_config_entry] + : undefined; + + const domain = configEntry?.domain; + const domainName = domain ? domainToName(hass.localize, domain) : undefined; + const primary = + deviceName || hass.localize("ui.components.device-picker.unnamed_device"); + + return { + id: `${idPrefix}${device.id}`, + label: "", + primary, + secondary: areaName, + domain: configEntry?.domain, + domain_name: domainName, + search_labels: { + deviceName, + areaName: areaName || null, + domain: domain || null, + domainName: domainName || null, + }, + sorting_label: [primary, areaName, domainName].filter(Boolean).join("_"), + }; + }); + + return outputDevices; +}; diff --git a/src/data/device/device_registry.ts b/src/data/device/device_registry.ts new file mode 100644 index 0000000000..dfcb95f5b0 --- /dev/null +++ b/src/data/device/device_registry.ts @@ -0,0 +1,169 @@ +import { computeStateName } from "../../common/entity/compute_state_name"; +import { caseInsensitiveStringCompare } from "../../common/string/compare"; +import type { HomeAssistant } from "../../types"; +import type { ConfigEntry } from "../config_entries"; +import type { + EntityRegistryDisplayEntry, + EntityRegistryEntry, +} from "../entity/entity_registry"; +import type { EntitySources } from "../entity/entity_sources"; +import type { RegistryEntry } from "../registry"; + +export { + fetchDeviceRegistry, + subscribeDeviceRegistry, +} from "../ws-device_registry"; + +export interface DeviceRegistryEntry extends RegistryEntry { + id: string; + config_entries: string[]; + config_entries_subentries: Record; + connections: [string, string][]; + identifiers: [string, string][]; + manufacturer: string | null; + model: string | null; + model_id: string | null; + name: string | null; + labels: string[]; + sw_version: string | null; + hw_version: string | null; + serial_number: string | null; + via_device_id: string | null; + area_id: string | null; + name_by_user: string | null; + entry_type: "service" | null; + disabled_by: "user" | "integration" | "config_entry" | null; + configuration_url: string | null; + primary_config_entry: string | null; +} + +export type DeviceEntityDisplayLookup = Record< + string, + EntityRegistryDisplayEntry[] +>; + +export type DeviceEntityLookup< + T extends EntityRegistryEntry | EntityRegistryDisplayEntry = + | EntityRegistryEntry + | EntityRegistryDisplayEntry, +> = Record; + +export interface DeviceRegistryEntryMutableParams { + area_id?: string | null; + name_by_user?: string | null; + disabled_by?: string | null; + labels?: string[]; +} + +export const fallbackDeviceName = ( + hass: HomeAssistant, + entities: EntityRegistryEntry[] | EntityRegistryDisplayEntry[] | string[] +) => { + for (const entity of entities || []) { + const entityId = typeof entity === "string" ? entity : entity.entity_id; + const stateObj = hass.states[entityId]; + if (stateObj) { + return computeStateName(stateObj); + } + } + return undefined; +}; + +export const devicesInArea = (devices: DeviceRegistryEntry[], areaId: string) => + devices.filter((device) => device.area_id === areaId); + +export const updateDeviceRegistryEntry = ( + hass: HomeAssistant, + deviceId: string, + updates: Partial +) => + hass.callWS({ + type: "config/device_registry/update", + device_id: deviceId, + ...updates, + }); + +export const removeConfigEntryFromDevice = ( + hass: HomeAssistant, + deviceId: string, + configEntryId: string +) => + hass.callWS({ + type: "config/device_registry/remove_config_entry", + device_id: deviceId, + config_entry_id: configEntryId, + }); + +export const sortDeviceRegistryByName = ( + entries: DeviceRegistryEntry[], + language: string +) => + entries.sort((entry1, entry2) => + caseInsensitiveStringCompare(entry1.name || "", entry2.name || "", language) + ); + +export const getDeviceEntityLookup = ( + entities: (EntityRegistryEntry | EntityRegistryDisplayEntry)[] +): DeviceEntityLookup => { + const deviceEntityLookup: DeviceEntityLookup = {}; + for (const entity of entities) { + if (!entity.device_id) { + continue; + } + if (!(entity.device_id in deviceEntityLookup)) { + deviceEntityLookup[entity.device_id] = []; + } + deviceEntityLookup[entity.device_id].push(entity); + } + return deviceEntityLookup; +}; + +export const getDeviceEntityDisplayLookup = ( + entities: EntityRegistryDisplayEntry[] +): DeviceEntityDisplayLookup => { + const deviceEntityLookup: DeviceEntityDisplayLookup = {}; + for (const entity of entities) { + if (!entity.device_id) { + continue; + } + if (!(entity.device_id in deviceEntityLookup)) { + deviceEntityLookup[entity.device_id] = []; + } + deviceEntityLookup[entity.device_id].push(entity); + } + return deviceEntityLookup; +}; + +export const getDeviceIntegrationLookup = ( + entitySources: EntitySources, + entities: EntityRegistryDisplayEntry[] | EntityRegistryEntry[], + devices?: DeviceRegistryEntry[], + configEntries?: ConfigEntry[] +): Record> => { + const deviceIntegrations: Record> = {}; + + for (const entity of entities) { + const source = entitySources[entity.entity_id]; + if (!source?.domain || entity.device_id === null) { + continue; + } + + deviceIntegrations[entity.device_id!] = + deviceIntegrations[entity.device_id!] || new Set(); + deviceIntegrations[entity.device_id!].add(source.domain); + } + // Lookup devices that have no entities + if (devices && configEntries) { + for (const device of devices) { + for (const config_entry_id of device.config_entries) { + const entry = configEntries.find((e) => e.entry_id === config_entry_id); + if (entry?.domain) { + deviceIntegrations[device.id] = + deviceIntegrations[device.id] || new Set(); + deviceIntegrations[device.id].add(entry.domain); + } + } + } + } + return deviceIntegrations; +}; diff --git a/src/data/device_registry.ts b/src/data/device_registry.ts deleted file mode 100644 index ad7d3ad69a..0000000000 --- a/src/data/device_registry.ts +++ /dev/null @@ -1,345 +0,0 @@ -import { computeAreaName } from "../common/entity/compute_area_name"; -import { computeDeviceNameDisplay } from "../common/entity/compute_device_name"; -import { computeDomain } from "../common/entity/compute_domain"; -import { computeStateName } from "../common/entity/compute_state_name"; -import { getDeviceContext } from "../common/entity/context/get_device_context"; -import { caseInsensitiveStringCompare } from "../common/string/compare"; -import type { HaDevicePickerDeviceFilterFunc } from "../components/device/ha-device-picker"; -import type { PickerComboBoxItem } from "../components/ha-picker-combo-box"; -import type { FuseWeightedKey } from "../resources/fuseMultiTerm"; -import type { HomeAssistant } from "../types"; -import type { ConfigEntry } from "./config_entries"; -import type { HaEntityPickerEntityFilterFunc } from "./entity"; -import type { - EntityRegistryDisplayEntry, - EntityRegistryEntry, -} from "./entity_registry"; -import type { EntitySources } from "./entity_sources"; -import { domainToName } from "./integration"; -import type { RegistryEntry } from "./registry"; - -export { - fetchDeviceRegistry, - subscribeDeviceRegistry, -} from "./ws-device_registry"; - -export interface DeviceRegistryEntry extends RegistryEntry { - id: string; - config_entries: string[]; - config_entries_subentries: Record; - connections: [string, string][]; - identifiers: [string, string][]; - manufacturer: string | null; - model: string | null; - model_id: string | null; - name: string | null; - labels: string[]; - sw_version: string | null; - hw_version: string | null; - serial_number: string | null; - via_device_id: string | null; - area_id: string | null; - name_by_user: string | null; - entry_type: "service" | null; - disabled_by: "user" | "integration" | "config_entry" | null; - configuration_url: string | null; - primary_config_entry: string | null; -} - -export type DeviceEntityDisplayLookup = Record< - string, - EntityRegistryDisplayEntry[] ->; - -export type DeviceEntityLookup< - T extends EntityRegistryEntry | EntityRegistryDisplayEntry = - | EntityRegistryEntry - | EntityRegistryDisplayEntry, -> = Record; - -export interface DeviceRegistryEntryMutableParams { - area_id?: string | null; - name_by_user?: string | null; - disabled_by?: string | null; - labels?: string[]; -} - -export const fallbackDeviceName = ( - hass: HomeAssistant, - entities: EntityRegistryEntry[] | EntityRegistryDisplayEntry[] | string[] -) => { - for (const entity of entities || []) { - const entityId = typeof entity === "string" ? entity : entity.entity_id; - const stateObj = hass.states[entityId]; - if (stateObj) { - return computeStateName(stateObj); - } - } - return undefined; -}; - -export const devicesInArea = (devices: DeviceRegistryEntry[], areaId: string) => - devices.filter((device) => device.area_id === areaId); - -export const updateDeviceRegistryEntry = ( - hass: HomeAssistant, - deviceId: string, - updates: Partial -) => - hass.callWS({ - type: "config/device_registry/update", - device_id: deviceId, - ...updates, - }); - -export const removeConfigEntryFromDevice = ( - hass: HomeAssistant, - deviceId: string, - configEntryId: string -) => - hass.callWS({ - type: "config/device_registry/remove_config_entry", - device_id: deviceId, - config_entry_id: configEntryId, - }); - -export const sortDeviceRegistryByName = ( - entries: DeviceRegistryEntry[], - language: string -) => - entries.sort((entry1, entry2) => - caseInsensitiveStringCompare(entry1.name || "", entry2.name || "", language) - ); - -export const getDeviceEntityLookup = ( - entities: (EntityRegistryEntry | EntityRegistryDisplayEntry)[] -): DeviceEntityLookup => { - const deviceEntityLookup: DeviceEntityLookup = {}; - for (const entity of entities) { - if (!entity.device_id) { - continue; - } - if (!(entity.device_id in deviceEntityLookup)) { - deviceEntityLookup[entity.device_id] = []; - } - deviceEntityLookup[entity.device_id].push(entity); - } - return deviceEntityLookup; -}; - -export const getDeviceEntityDisplayLookup = ( - entities: EntityRegistryDisplayEntry[] -): DeviceEntityDisplayLookup => { - const deviceEntityLookup: DeviceEntityDisplayLookup = {}; - for (const entity of entities) { - if (!entity.device_id) { - continue; - } - if (!(entity.device_id in deviceEntityLookup)) { - deviceEntityLookup[entity.device_id] = []; - } - deviceEntityLookup[entity.device_id].push(entity); - } - return deviceEntityLookup; -}; - -export const getDeviceIntegrationLookup = ( - entitySources: EntitySources, - entities: EntityRegistryDisplayEntry[] | EntityRegistryEntry[], - devices?: DeviceRegistryEntry[], - configEntries?: ConfigEntry[] -): Record> => { - const deviceIntegrations: Record> = {}; - - for (const entity of entities) { - const source = entitySources[entity.entity_id]; - if (!source?.domain || entity.device_id === null) { - continue; - } - - deviceIntegrations[entity.device_id!] = - deviceIntegrations[entity.device_id!] || new Set(); - deviceIntegrations[entity.device_id!].add(source.domain); - } - // Lookup devices that have no entities - if (devices && configEntries) { - for (const device of devices) { - for (const config_entry_id of device.config_entries) { - const entry = configEntries.find((e) => e.entry_id === config_entry_id); - if (entry?.domain) { - deviceIntegrations[device.id] = - deviceIntegrations[device.id] || new Set(); - deviceIntegrations[device.id].add(entry.domain); - } - } - } - } - return deviceIntegrations; -}; - -export interface DevicePickerItem extends PickerComboBoxItem { - domain?: string; - domain_name?: string; -} - -export const deviceComboBoxKeys: FuseWeightedKey[] = [ - { - name: "search_labels.deviceName", - weight: 10, - }, - { - name: "search_labels.areaName", - weight: 8, - }, - { - name: "search_labels.domainName", - weight: 4, - }, - { - name: "search_labels.domain", - weight: 4, - }, -]; - -export const getDevices = ( - hass: HomeAssistant, - configEntryLookup: Record, - includeDomains?: string[], - excludeDomains?: string[], - includeDeviceClasses?: string[], - deviceFilter?: HaDevicePickerDeviceFilterFunc, - entityFilter?: HaEntityPickerEntityFilterFunc, - excludeDevices?: string[], - value?: string, - idPrefix = "" -): DevicePickerItem[] => { - const devices = Object.values(hass.devices); - const entities = Object.values(hass.entities); - - let deviceEntityLookup: DeviceEntityDisplayLookup = {}; - - if ( - includeDomains || - excludeDomains || - includeDeviceClasses || - entityFilter - ) { - deviceEntityLookup = getDeviceEntityDisplayLookup(entities); - } - - let inputDevices = devices.filter( - (device) => device.id === value || !device.disabled_by - ); - - if (includeDomains) { - inputDevices = inputDevices.filter((device) => { - const devEntities = deviceEntityLookup[device.id]; - if (!devEntities || !devEntities.length) { - return false; - } - return deviceEntityLookup[device.id].some((entity) => - includeDomains.includes(computeDomain(entity.entity_id)) - ); - }); - } - - if (excludeDomains) { - inputDevices = inputDevices.filter((device) => { - const devEntities = deviceEntityLookup[device.id]; - if (!devEntities || !devEntities.length) { - return true; - } - return entities.every( - (entity) => !excludeDomains.includes(computeDomain(entity.entity_id)) - ); - }); - } - - if (excludeDevices) { - inputDevices = inputDevices.filter( - (device) => !excludeDevices!.includes(device.id) - ); - } - - if (includeDeviceClasses) { - inputDevices = inputDevices.filter((device) => { - const devEntities = deviceEntityLookup[device.id]; - if (!devEntities || !devEntities.length) { - return false; - } - return deviceEntityLookup[device.id].some((entity) => { - const stateObj = hass.states[entity.entity_id]; - if (!stateObj) { - return false; - } - return ( - stateObj.attributes.device_class && - includeDeviceClasses.includes(stateObj.attributes.device_class) - ); - }); - }); - } - - if (entityFilter) { - inputDevices = inputDevices.filter((device) => { - const devEntities = deviceEntityLookup[device.id]; - if (!devEntities || !devEntities.length) { - return false; - } - return devEntities.some((entity) => { - const stateObj = hass.states[entity.entity_id]; - if (!stateObj) { - return false; - } - return entityFilter(stateObj); - }); - }); - } - - if (deviceFilter) { - inputDevices = inputDevices.filter( - (device) => - // We always want to include the device of the current value - device.id === value || deviceFilter!(device) - ); - } - - const outputDevices = inputDevices.map((device) => { - const deviceName = computeDeviceNameDisplay( - device, - hass, - deviceEntityLookup[device.id] - ); - - const { area } = getDeviceContext(device, hass); - - const areaName = area ? computeAreaName(area) : undefined; - - const configEntry = device.primary_config_entry - ? configEntryLookup?.[device.primary_config_entry] - : undefined; - - const domain = configEntry?.domain; - const domainName = domain ? domainToName(hass.localize, domain) : undefined; - - return { - id: `${idPrefix}${device.id}`, - label: "", - primary: - deviceName || - hass.localize("ui.components.device-picker.unnamed_device"), - secondary: areaName, - domain: configEntry?.domain, - domain_name: domainName, - search_labels: { - deviceName, - areaName: areaName || null, - domain: domain || null, - domainName: domainName || null, - }, - sorting_label: deviceName || "zzz", - }; - }); - - return outputDevices; -}; diff --git a/src/data/entity.ts b/src/data/entity/entity.ts similarity index 87% rename from src/data/entity.ts rename to src/data/entity/entity.ts index 9d54d7054a..54f916367b 100644 --- a/src/data/entity.ts +++ b/src/data/entity/entity.ts @@ -1,5 +1,5 @@ import type { HassEntity } from "home-assistant-js-websocket"; -import { arrayLiteralIncludes } from "../common/array/literal-includes"; +import { arrayLiteralIncludes } from "../../common/array/literal-includes"; export const UNAVAILABLE = "unavailable"; export const UNKNOWN = "unknown"; diff --git a/src/data/entity_attributes.ts b/src/data/entity/entity_attributes.ts similarity index 96% rename from src/data/entity_attributes.ts rename to src/data/entity/entity_attributes.ts index f32bf7e01f..8abe576a6b 100644 --- a/src/data/entity_attributes.ts +++ b/src/data/entity/entity_attributes.ts @@ -1,5 +1,5 @@ -import { formatDurationDigital } from "../common/datetime/format_duration"; -import type { FrontendLocaleData } from "./translation"; +import { formatDurationDigital } from "../../common/datetime/format_duration"; +import type { FrontendLocaleData } from "../translation"; // These attributes are hidden from the more-info window for all entities. export const STATE_ATTRIBUTES = [ diff --git a/src/data/entity/entity_picker.ts b/src/data/entity/entity_picker.ts new file mode 100644 index 0000000000..970bf5d143 --- /dev/null +++ b/src/data/entity/entity_picker.ts @@ -0,0 +1,155 @@ +import type { HassEntity } from "home-assistant-js-websocket"; +import { computeDomain } from "../../common/entity/compute_domain"; +import { computeEntityNameList } from "../../common/entity/compute_entity_name_display"; +import { computeStateName } from "../../common/entity/compute_state_name"; +import { computeRTL } from "../../common/util/compute_rtl"; +import type { PickerComboBoxItem } from "../../components/ha-picker-combo-box"; +import type { FuseWeightedKey } from "../../resources/fuseMultiTerm"; +import type { HomeAssistant } from "../../types"; +import { domainToName } from "../integration"; +import type { HaEntityPickerEntityFilterFunc } from "./entity"; + +export interface EntityComboBoxItem extends PickerComboBoxItem { + domain_name?: string; + stateObj?: HassEntity; +} + +export const entityComboBoxKeys: FuseWeightedKey[] = [ + { + name: "search_labels.entityName", + weight: 10, + }, + { + name: "search_labels.friendlyName", + weight: 8, + }, + { + name: "search_labels.deviceName", + weight: 7, + }, + { + name: "search_labels.areaName", + weight: 6, + }, + { + name: "search_labels.domainName", + weight: 6, + }, + { + name: "search_labels.entityId", + weight: 3, + }, +]; + +export const getEntities = ( + hass: HomeAssistant, + includeDomains?: string[], + excludeDomains?: string[], + entityFilter?: HaEntityPickerEntityFilterFunc, + includeDeviceClasses?: string[], + includeUnitOfMeasurement?: string[], + includeEntities?: string[], + excludeEntities?: string[], + value?: string, + idPrefix = "" +): EntityComboBoxItem[] => { + let items: EntityComboBoxItem[] = []; + + let entityIds = Object.keys(hass.states); + + if (includeEntities) { + entityIds = entityIds.filter((entityId) => + includeEntities.includes(entityId) + ); + } + + if (excludeEntities) { + entityIds = entityIds.filter( + (entityId) => !excludeEntities.includes(entityId) + ); + } + + if (includeDomains) { + entityIds = entityIds.filter((eid) => + includeDomains.includes(computeDomain(eid)) + ); + } + + if (excludeDomains) { + entityIds = entityIds.filter( + (eid) => !excludeDomains.includes(computeDomain(eid)) + ); + } + + items = entityIds.map((entityId) => { + const stateObj = hass.states[entityId]; + + const friendlyName = computeStateName(stateObj); // Keep this for search + const [entityName, deviceName, areaName] = computeEntityNameList( + stateObj, + [{ type: "entity" }, { type: "device" }, { type: "area" }], + hass.entities, + hass.devices, + hass.areas, + hass.floors + ); + + const domainName = domainToName(hass.localize, computeDomain(entityId)); + + const isRTL = computeRTL(hass); + + const primary = entityName || deviceName || entityId; + const secondary = [areaName, entityName ? deviceName : undefined] + .filter(Boolean) + .join(isRTL ? " ◂ " : " ▸ "); + + return { + id: `${idPrefix}${entityId}`, + primary: primary, + secondary: secondary, + domain_name: domainName, + sorting_label: [primary, secondary].filter(Boolean).join("_"), + search_labels: { + entityName: entityName || null, + deviceName: deviceName || null, + areaName: areaName || null, + domainName: domainName || null, + friendlyName: friendlyName || null, + entityId: entityId, + }, + stateObj: stateObj, + }; + }); + + if (includeDeviceClasses) { + items = items.filter( + (item) => + // We always want to include the entity of the current value + item.id === value || + (item.stateObj?.attributes.device_class && + includeDeviceClasses.includes(item.stateObj.attributes.device_class)) + ); + } + + if (includeUnitOfMeasurement) { + items = items.filter( + (item) => + // We always want to include the entity of the current value + item.id === value || + (item.stateObj?.attributes.unit_of_measurement && + includeUnitOfMeasurement.includes( + item.stateObj.attributes.unit_of_measurement + )) + ); + } + + if (entityFilter) { + items = items.filter( + (item) => + // We always want to include the entity of the current value + item.id === value || (item.stateObj && entityFilter!(item.stateObj)) + ); + } + + return items; +}; diff --git a/src/data/entity_registry.ts b/src/data/entity/entity_registry.ts similarity index 64% rename from src/data/entity_registry.ts rename to src/data/entity/entity_registry.ts index e7352aa90c..4c9774e3aa 100644 --- a/src/data/entity_registry.ts +++ b/src/data/entity/entity_registry.ts @@ -1,20 +1,14 @@ -import type { Connection, HassEntity } from "home-assistant-js-websocket"; +import type { Connection } from "home-assistant-js-websocket"; import { createCollection } from "home-assistant-js-websocket"; import type { Store } from "home-assistant-js-websocket/dist/store"; import memoizeOne from "memoize-one"; -import { computeDomain } from "../common/entity/compute_domain"; -import { computeEntityNameList } from "../common/entity/compute_entity_name_display"; -import { computeStateName } from "../common/entity/compute_state_name"; -import { caseInsensitiveStringCompare } from "../common/string/compare"; -import { computeRTL } from "../common/util/compute_rtl"; -import { debounce } from "../common/util/debounce"; -import type { PickerComboBoxItem } from "../components/ha-picker-combo-box"; -import type { FuseWeightedKey } from "../resources/fuseMultiTerm"; -import type { HomeAssistant } from "../types"; -import type { HaEntityPickerEntityFilterFunc } from "./entity"; -import { domainToName } from "./integration"; -import type { LightColor } from "./light"; -import type { RegistryEntry } from "./registry"; +import { computeDomain } from "../../common/entity/compute_domain"; +import { computeStateName } from "../../common/entity/compute_state_name"; +import { caseInsensitiveStringCompare } from "../../common/string/compare"; +import { debounce } from "../../common/util/debounce"; +import type { HomeAssistant } from "../../types"; +import type { LightColor } from "../light"; +import type { RegistryEntry } from "../registry"; type EntityCategory = "config" | "diagnostic"; @@ -330,148 +324,3 @@ export const getAutomaticEntityIds = ( type: "config/entity_registry/get_automatic_entity_ids", entity_ids, }); - -export interface EntityComboBoxItem extends PickerComboBoxItem { - domain_name?: string; - stateObj?: HassEntity; -} - -export const entityComboBoxKeys: FuseWeightedKey[] = [ - { - name: "search_labels.entityName", - weight: 10, - }, - { - name: "search_labels.friendlyName", - weight: 8, - }, - { - name: "search_labels.deviceName", - weight: 7, - }, - { - name: "search_labels.areaName", - weight: 6, - }, - { - name: "search_labels.domainName", - weight: 6, - }, - { - name: "search_labels.entityId", - weight: 3, - }, -]; - -export const getEntities = ( - hass: HomeAssistant, - includeDomains?: string[], - excludeDomains?: string[], - entityFilter?: HaEntityPickerEntityFilterFunc, - includeDeviceClasses?: string[], - includeUnitOfMeasurement?: string[], - includeEntities?: string[], - excludeEntities?: string[], - value?: string, - idPrefix = "" -): EntityComboBoxItem[] => { - let items: EntityComboBoxItem[] = []; - - let entityIds = Object.keys(hass.states); - - if (includeEntities) { - entityIds = entityIds.filter((entityId) => - includeEntities.includes(entityId) - ); - } - - if (excludeEntities) { - entityIds = entityIds.filter( - (entityId) => !excludeEntities.includes(entityId) - ); - } - - if (includeDomains) { - entityIds = entityIds.filter((eid) => - includeDomains.includes(computeDomain(eid)) - ); - } - - if (excludeDomains) { - entityIds = entityIds.filter( - (eid) => !excludeDomains.includes(computeDomain(eid)) - ); - } - - items = entityIds.map((entityId) => { - const stateObj = hass.states[entityId]; - - const friendlyName = computeStateName(stateObj); // Keep this for search - const [entityName, deviceName, areaName] = computeEntityNameList( - stateObj, - [{ type: "entity" }, { type: "device" }, { type: "area" }], - hass.entities, - hass.devices, - hass.areas, - hass.floors - ); - - const domainName = domainToName(hass.localize, computeDomain(entityId)); - - const isRTL = computeRTL(hass); - - const primary = entityName || deviceName || entityId; - const secondary = [areaName, entityName ? deviceName : undefined] - .filter(Boolean) - .join(isRTL ? " ◂ " : " ▸ "); - - return { - id: `${idPrefix}${entityId}`, - primary: primary, - secondary: secondary, - domain_name: domainName, - sorting_label: [deviceName, entityName].filter(Boolean).join("_"), - search_labels: { - entityName: entityName || null, - deviceName: deviceName || null, - areaName: areaName || null, - domainName: domainName || null, - friendlyName: friendlyName || null, - entityId: entityId, - }, - stateObj: stateObj, - }; - }); - - if (includeDeviceClasses) { - items = items.filter( - (item) => - // We always want to include the entity of the current value - item.id === value || - (item.stateObj?.attributes.device_class && - includeDeviceClasses.includes(item.stateObj.attributes.device_class)) - ); - } - - if (includeUnitOfMeasurement) { - items = items.filter( - (item) => - // We always want to include the entity of the current value - item.id === value || - (item.stateObj?.attributes.unit_of_measurement && - includeUnitOfMeasurement.includes( - item.stateObj.attributes.unit_of_measurement - )) - ); - } - - if (entityFilter) { - items = items.filter( - (item) => - // We always want to include the entity of the current value - item.id === value || (item.stateObj && entityFilter!(item.stateObj)) - ); - } - - return items; -}; diff --git a/src/data/entity_sources.ts b/src/data/entity/entity_sources.ts similarity index 81% rename from src/data/entity_sources.ts rename to src/data/entity/entity_sources.ts index 220201d5bf..dfd9715e45 100644 --- a/src/data/entity_sources.ts +++ b/src/data/entity/entity_sources.ts @@ -1,5 +1,5 @@ -import { timeCachePromiseFunc } from "../common/util/time-cache-function-promise"; -import type { HomeAssistant } from "../types"; +import { timeCachePromiseFunc } from "../../common/util/time-cache-function-promise"; +import type { HomeAssistant } from "../../types"; interface EntitySource { domain: string; diff --git a/src/data/icons.ts b/src/data/icons.ts index eb16fbbb8c..a7ea77bd7c 100644 --- a/src/data/icons.ts +++ b/src/data/icons.ts @@ -56,11 +56,11 @@ import type { HomeAssistant } from "../types"; import type { EntityRegistryDisplayEntry, EntityRegistryEntry, -} from "./entity_registry"; +} from "./entity/entity_registry"; import { mdiHomeAssistant } from "../resources/home-assistant-logo-svg"; -import { getTriggerDomain, getTriggerObjectId } from "./trigger"; import { getConditionDomain, getConditionObjectId } from "./condition"; +import { getTriggerDomain, getTriggerObjectId } from "./trigger"; /** Icon to use when no icon specified for service. */ export const DEFAULT_SERVICE_ICON = mdiRoomService; diff --git a/src/data/label_registry.ts b/src/data/label/label_picker.ts similarity index 67% rename from src/data/label_registry.ts rename to src/data/label/label_picker.ts index 8702c42ce5..9a53ade0e8 100644 --- a/src/data/label_registry.ts +++ b/src/data/label/label_picker.ts @@ -1,105 +1,17 @@ import { mdiLabel } from "@mdi/js"; -import type { Connection } from "home-assistant-js-websocket"; -import { createCollection } from "home-assistant-js-websocket"; -import type { Store } from "home-assistant-js-websocket/dist/store"; -import { computeDomain } from "../common/entity/compute_domain"; -import { stringCompare } from "../common/string/compare"; -import { debounce } from "../common/util/debounce"; -import type { HaDevicePickerDeviceFilterFunc } from "../components/device/ha-device-picker"; -import type { PickerComboBoxItem } from "../components/ha-picker-combo-box"; -import type { FuseWeightedKey } from "../resources/fuseMultiTerm"; -import type { HomeAssistant } from "../types"; +import { computeDomain } from "../../common/entity/compute_domain"; +import type { HaDevicePickerDeviceFilterFunc } from "../../components/device/ha-device-picker"; +import type { PickerComboBoxItem } from "../../components/ha-picker-combo-box"; +import type { FuseWeightedKey } from "../../resources/fuseMultiTerm"; +import type { HomeAssistant } from "../../types"; import { getDeviceEntityDisplayLookup, type DeviceEntityDisplayLookup, type DeviceRegistryEntry, -} from "./device_registry"; -import type { HaEntityPickerEntityFilterFunc } from "./entity"; -import type { EntityRegistryDisplayEntry } from "./entity_registry"; -import type { RegistryEntry } from "./registry"; - -export interface LabelRegistryEntry extends RegistryEntry { - label_id: string; - name: string; - icon: string | null; - color: string | null; - description: string | null; -} - -export interface LabelRegistryEntryMutableParams { - name: string; - icon?: string | null; - color?: string | null; - description?: string | null; -} - -export const fetchLabelRegistry = (conn: Connection) => - conn - .sendMessagePromise({ - type: "config/label_registry/list", - }) - .then((labels) => - (labels as LabelRegistryEntry[]).sort((ent1, ent2) => - stringCompare(ent1.name, ent2.name) - ) - ); - -export const subscribeLabelRegistryUpdates = ( - conn: Connection, - store: Store -) => - conn.subscribeEvents( - debounce( - () => - fetchLabelRegistry(conn).then((labels: LabelRegistryEntry[]) => - store.setState(labels, true) - ), - 500, - true - ), - "label_registry_updated" - ); - -export const subscribeLabelRegistry = ( - conn: Connection, - onChange: (labels: LabelRegistryEntry[]) => void -) => - createCollection( - "_labelRegistry", - fetchLabelRegistry, - subscribeLabelRegistryUpdates, - conn, - onChange - ); - -export const createLabelRegistryEntry = ( - hass: HomeAssistant, - values: LabelRegistryEntryMutableParams -) => - hass.callWS({ - type: "config/label_registry/create", - ...values, - }); - -export const updateLabelRegistryEntry = ( - hass: HomeAssistant, - labelId: string, - updates: Partial -) => - hass.callWS({ - type: "config/label_registry/update", - label_id: labelId, - ...updates, - }); - -export const deleteLabelRegistryEntry = ( - hass: HomeAssistant, - labelId: string -) => - hass.callWS({ - type: "config/label_registry/delete", - label_id: labelId, - }); +} from "../device/device_registry"; +import type { HaEntityPickerEntityFilterFunc } from "../entity/entity"; +import type { EntityRegistryDisplayEntry } from "../entity/entity_registry"; +import type { LabelRegistryEntry } from "./label_registry"; export const labelComboBoxKeys: FuseWeightedKey[] = [ { diff --git a/src/data/label/label_registry.ts b/src/data/label/label_registry.ts new file mode 100644 index 0000000000..4315b9fcb6 --- /dev/null +++ b/src/data/label/label_registry.ts @@ -0,0 +1,90 @@ +import type { Connection } from "home-assistant-js-websocket"; +import { createCollection } from "home-assistant-js-websocket"; +import type { Store } from "home-assistant-js-websocket/dist/store"; +import { stringCompare } from "../../common/string/compare"; +import { debounce } from "../../common/util/debounce"; +import type { HomeAssistant } from "../../types"; +import type { RegistryEntry } from "../registry"; + +export interface LabelRegistryEntry extends RegistryEntry { + label_id: string; + name: string; + icon: string | null; + color: string | null; + description: string | null; +} + +export interface LabelRegistryEntryMutableParams { + name: string; + icon?: string | null; + color?: string | null; + description?: string | null; +} + +export const fetchLabelRegistry = (conn: Connection) => + conn + .sendMessagePromise({ + type: "config/label_registry/list", + }) + .then((labels) => + (labels as LabelRegistryEntry[]).sort((ent1, ent2) => + stringCompare(ent1.name, ent2.name) + ) + ); + +export const subscribeLabelRegistryUpdates = ( + conn: Connection, + store: Store +) => + conn.subscribeEvents( + debounce( + () => + fetchLabelRegistry(conn).then((labels: LabelRegistryEntry[]) => + store.setState(labels, true) + ), + 500, + true + ), + "label_registry_updated" + ); + +export const subscribeLabelRegistry = ( + conn: Connection, + onChange: (labels: LabelRegistryEntry[]) => void +) => + createCollection( + "_labelRegistry", + fetchLabelRegistry, + subscribeLabelRegistryUpdates, + conn, + onChange + ); + +export const createLabelRegistryEntry = ( + hass: HomeAssistant, + values: LabelRegistryEntryMutableParams +) => + hass.callWS({ + type: "config/label_registry/create", + ...values, + }); + +export const updateLabelRegistryEntry = ( + hass: HomeAssistant, + labelId: string, + updates: Partial +) => + hass.callWS({ + type: "config/label_registry/update", + label_id: labelId, + ...updates, + }); + +export const deleteLabelRegistryEntry = ( + hass: HomeAssistant, + labelId: string +) => + hass.callWS({ + type: "config/label_registry/delete", + label_id: labelId, + }); diff --git a/src/data/lawn_mower.ts b/src/data/lawn_mower.ts index 75fd939015..0e28d3f8d1 100644 --- a/src/data/lawn_mower.ts +++ b/src/data/lawn_mower.ts @@ -2,7 +2,7 @@ import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; -import { UNAVAILABLE } from "./entity"; +import { UNAVAILABLE } from "./entity/entity"; export type LawnMowerEntityState = | "paused" diff --git a/src/data/lock.ts b/src/data/lock.ts index ddf4f89122..b27f95be11 100644 --- a/src/data/lock.ts +++ b/src/data/lock.ts @@ -2,10 +2,10 @@ import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; -import { getExtendedEntityRegistryEntry } from "./entity_registry"; import { showEnterCodeDialog } from "../dialogs/enter-code/show-enter-code-dialog"; import type { HomeAssistant } from "../types"; -import { UNAVAILABLE } from "./entity"; +import { UNAVAILABLE } from "./entity/entity"; +import { getExtendedEntityRegistryEntry } from "./entity/entity_registry"; export const enum LockEntityFeature { OPEN = 1, diff --git a/src/data/logbook.ts b/src/data/logbook.ts index bcfd6c9e8a..aa2d483629 100644 --- a/src/data/logbook.ts +++ b/src/data/logbook.ts @@ -9,7 +9,7 @@ import { computeStateDomain } from "../common/entity/compute_state_domain"; import { autoCaseNoun } from "../common/translations/auto_case_noun"; import type { LocalizeFunc } from "../common/translations/localize"; import type { HomeAssistant } from "../types"; -import { UNAVAILABLE, UNKNOWN } from "./entity"; +import { UNAVAILABLE, UNKNOWN } from "./entity/entity"; import { isNumericEntity } from "./history"; const LOGBOOK_LOCALIZE_PATH = "ui.components.logbook.messages"; diff --git a/src/data/matter.ts b/src/data/matter.ts index e67b2e5172..02fc7695e0 100644 --- a/src/data/matter.ts +++ b/src/data/matter.ts @@ -1,8 +1,8 @@ import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { isComponentLoaded } from "../common/config/is_component_loaded"; import { navigate } from "../common/navigate"; import type { HomeAssistant } from "../types"; -import { subscribeDeviceRegistry } from "./device_registry"; -import { isComponentLoaded } from "../common/config/is_component_loaded"; +import { subscribeDeviceRegistry } from "./device/device_registry"; import { getThreadDataSetTLV, listThreadDataSets } from "./thread"; export enum NetworkType { diff --git a/src/data/media-player.ts b/src/data/media-player.ts index 968c4b48a5..50d414d8b5 100644 --- a/src/data/media-player.ts +++ b/src/data/media-player.ts @@ -32,11 +32,11 @@ import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; -import { supportsFeature } from "../common/entity/supports-feature"; import { stateActive } from "../common/entity/state_active"; +import { supportsFeature } from "../common/entity/supports-feature"; import type { MediaPlayerItemId } from "../components/media-player/ha-media-player-browse"; import type { HomeAssistant, TranslationDict } from "../types"; -import { isUnavailableState } from "./entity"; +import { isUnavailableState } from "./entity/entity"; import { isTTSMediaSource } from "./tts"; interface MediaPlayerEntityAttributes extends HassEntityAttributeBase { diff --git a/src/data/regenerate_entity_ids.ts b/src/data/regenerate_entity_ids.ts index 4488ffb342..030e4851ae 100644 --- a/src/data/regenerate_entity_ids.ts +++ b/src/data/regenerate_entity_ids.ts @@ -1,4 +1,5 @@ import { html, nothing } from "lit"; +import "../components/ha-expansion-panel"; import { showAlertDialog, showConfirmationDialog, @@ -7,8 +8,7 @@ import type { HomeAssistant } from "../types"; import { getAutomaticEntityIds, updateEntityRegistryEntry, -} from "./entity_registry"; -import "../components/ha-expansion-panel"; +} from "./entity/entity_registry"; export const regenerateEntityIds = async ( element: HTMLElement, diff --git a/src/data/script_i18n.ts b/src/data/script_i18n.ts index 9b2e41b9ea..ecc1959ab9 100644 --- a/src/data/script_i18n.ts +++ b/src/data/script_i18n.ts @@ -8,15 +8,15 @@ import { isTemplate } from "../common/string/has-template"; import type { HomeAssistant } from "../types"; import type { Condition } from "./automation"; import { describeCondition } from "./automation_i18n"; -import { localizeDeviceAutomationAction } from "./device_automation"; -import type { EntityRegistryEntry } from "./entity_registry"; +import { localizeDeviceAutomationAction } from "./device/device_automation"; +import type { EntityRegistryEntry } from "./entity/entity_registry"; import { computeEntityRegistryName, entityRegistryById, -} from "./entity_registry"; +} from "./entity/entity_registry"; import type { FloorRegistryEntry } from "./floor_registry"; import { domainToName } from "./integration"; -import type { LabelRegistryEntry } from "./label_registry"; +import type { LabelRegistryEntry } from "./label/label_registry"; import type { ActionType, ActionTypes, diff --git a/src/data/selector.ts b/src/data/selector.ts index 71748ae924..cf1398b1fd 100644 --- a/src/data/selector.ts +++ b/src/data/selector.ts @@ -3,6 +3,7 @@ import type { HassServiceTarget, } from "home-assistant-js-websocket"; import { ensureArray } from "../common/array/ensure-array"; +import type { EntityNameItem } from "../common/entity/compute_entity_name_display"; import { computeStateDomain } from "../common/entity/compute_state_domain"; import { supportsFeature } from "../common/entity/supports-feature"; import { isHelperDomain } from "../panels/config/helpers/const"; @@ -11,13 +12,12 @@ import type { HomeAssistant } from "../types"; import { type DeviceRegistryEntry, getDeviceIntegrationLookup, -} from "./device_registry"; +} from "./device/device_registry"; import type { EntityRegistryDisplayEntry, EntityRegistryEntry, -} from "./entity_registry"; -import type { EntitySources } from "./entity_sources"; -import type { EntityNameItem } from "../common/entity/compute_entity_name_display"; +} from "./entity/entity_registry"; +import type { EntitySources } from "./entity/entity_sources"; export type Selector = | ActionSelector diff --git a/src/data/target.ts b/src/data/target.ts index 4543718ba0..25d3f741b1 100644 --- a/src/data/target.ts +++ b/src/data/target.ts @@ -3,14 +3,13 @@ import { computeDomain } from "../common/entity/compute_domain"; import type { HaDevicePickerDeviceFilterFunc } from "../components/device/ha-device-picker"; import type { PickerComboBoxItem } from "../components/ha-picker-combo-box"; import type { HomeAssistant } from "../types"; -import type { FloorComboBoxItem } from "./area_floor"; +import type { FloorComboBoxItem } from "./area_floor_picker"; import type { AreaRegistryEntry } from "./area_registry"; -import type { DevicePickerItem, DeviceRegistryEntry } from "./device_registry"; -import type { HaEntityPickerEntityFilterFunc } from "./entity"; -import type { - EntityComboBoxItem, - EntityRegistryDisplayEntry, -} from "./entity_registry"; +import type { DevicePickerItem } from "./device/device_picker"; +import type { DeviceRegistryEntry } from "./device/device_registry"; +import type { HaEntityPickerEntityFilterFunc } from "./entity/entity"; +import type { EntityComboBoxItem } from "./entity/entity_picker"; +import type { EntityRegistryDisplayEntry } from "./entity/entity_registry"; export const TARGET_SEPARATOR = "________"; diff --git a/src/data/todo.ts b/src/data/todo.ts index 2a6d9b3f09..8c1f320f59 100644 --- a/src/data/todo.ts +++ b/src/data/todo.ts @@ -1,8 +1,8 @@ -import type { HomeAssistant, ServiceCallResponse } from "../types"; import { computeDomain } from "../common/entity/compute_domain"; import { computeStateName } from "../common/entity/compute_state_name"; -import { isUnavailableState } from "./entity"; import { stringCompare } from "../common/string/compare"; +import type { HomeAssistant, ServiceCallResponse } from "../types"; +import { isUnavailableState } from "./entity/entity"; export interface TodoList { entity_id: string; diff --git a/src/data/update.ts b/src/data/update.ts index 454e5a5fa6..af7e6626d9 100644 --- a/src/data/update.ts +++ b/src/data/update.ts @@ -4,7 +4,7 @@ import type { HassEntityBase, HassEvent, } from "home-assistant-js-websocket"; -import { BINARY_STATE_ON, BINARY_STATE_OFF } from "../common/const"; +import { BINARY_STATE_OFF, BINARY_STATE_ON } from "../common/const"; import { computeDomain } from "../common/entity/compute_domain"; import { computeStateDomain } from "../common/entity/compute_state_domain"; import { supportsFeature } from "../common/entity/supports-feature"; @@ -13,7 +13,7 @@ import { caseInsensitiveStringCompare } from "../common/string/compare"; import { showAlertDialog } from "../dialogs/generic/show-dialog-box"; import type { HomeAssistant } from "../types"; import { showToast } from "../util/toast"; -import type { EntitySources } from "./entity_sources"; +import type { EntitySources } from "./entity/entity_sources"; export enum UpdateEntityFeature { INSTALL = 1, diff --git a/src/data/vacuum.ts b/src/data/vacuum.ts index 75d447379b..5fdcd82369 100644 --- a/src/data/vacuum.ts +++ b/src/data/vacuum.ts @@ -2,7 +2,7 @@ import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; -import { UNAVAILABLE } from "./entity"; +import { UNAVAILABLE } from "./entity/entity"; export type VacuumEntityState = | "on" diff --git a/src/data/valve.ts b/src/data/valve.ts index b7504f8e3d..d1b8bdac02 100644 --- a/src/data/valve.ts +++ b/src/data/valve.ts @@ -2,9 +2,9 @@ import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; -import { UNAVAILABLE } from "./entity"; import { stateActive } from "../common/entity/state_active"; import type { HomeAssistant } from "../types"; +import { UNAVAILABLE } from "./entity/entity"; export const enum ValveEntityFeature { OPEN = 1, diff --git a/src/data/ws-device_registry.ts b/src/data/ws-device_registry.ts index eeef3a357b..20f17c0a91 100644 --- a/src/data/ws-device_registry.ts +++ b/src/data/ws-device_registry.ts @@ -1,8 +1,8 @@ import type { Connection } from "home-assistant-js-websocket"; import { createCollection } from "home-assistant-js-websocket"; import type { Store } from "home-assistant-js-websocket/dist/store"; -import type { DeviceRegistryEntry } from "./device_registry"; import { debounce } from "../common/util/debounce"; +import type { DeviceRegistryEntry } from "./device/device_registry"; export const fetchDeviceRegistry = (conn: Connection) => conn.sendMessagePromise({ diff --git a/src/data/ws-entity_registry_display.ts b/src/data/ws-entity_registry_display.ts index 984451a991..392b56d02b 100644 --- a/src/data/ws-entity_registry_display.ts +++ b/src/data/ws-entity_registry_display.ts @@ -1,9 +1,9 @@ import type { Connection } from "home-assistant-js-websocket"; import { createCollection } from "home-assistant-js-websocket"; import type { Store } from "home-assistant-js-websocket/dist/store"; -import type { EntityRegistryDisplayEntryResponse } from "./entity_registry"; -import { fetchEntityRegistryDisplay } from "./entity_registry"; import { debounce } from "../common/util/debounce"; +import type { EntityRegistryDisplayEntryResponse } from "./entity/entity_registry"; +import { fetchEntityRegistryDisplay } from "./entity/entity_registry"; const subscribeEntityRegistryDisplayUpdates = ( conn: Connection, diff --git a/src/dialogs/config-flow/dialog-data-entry-flow.ts b/src/dialogs/config-flow/dialog-data-entry-flow.ts index 420c96ba68..d03e2aa4a9 100644 --- a/src/dialogs/config-flow/dialog-data-entry-flow.ts +++ b/src/dialogs/config-flow/dialog-data-entry-flow.ts @@ -14,15 +14,18 @@ import { subscribeDataEntryFlowProgress, subscribeDataEntryFlowProgressed, } from "../../data/data_entry_flow"; -import type { DeviceRegistryEntry } from "../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../data/device/device_registry"; import { haStyleDialog } from "../../resources/styles"; import type { HomeAssistant } from "../../types"; import { documentationUrl } from "../../util/documentation-url"; import { showAlertDialog } from "../generic/show-dialog-box"; +import { showConfigFlowDialog } from "./show-dialog-config-flow"; import type { DataEntryFlowDialogParams, LoadingReason, } from "./show-dialog-data-entry-flow"; +import { showOptionsFlowDialog } from "./show-dialog-options-flow"; +import { showSubConfigFlowDialog } from "./show-dialog-sub-config-flow"; import "./step-flow-abort"; import "./step-flow-create-entry"; import "./step-flow-external"; @@ -30,9 +33,6 @@ import "./step-flow-form"; import "./step-flow-loading"; import "./step-flow-menu"; import "./step-flow-progress"; -import { showOptionsFlowDialog } from "./show-dialog-options-flow"; -import { showSubConfigFlowDialog } from "./show-dialog-sub-config-flow"; -import { showConfigFlowDialog } from "./show-dialog-config-flow"; let instance = 0; diff --git a/src/dialogs/config-flow/previews/entity-preview-row.ts b/src/dialogs/config-flow/previews/entity-preview-row.ts index ead79ccfb1..7449c9325e 100644 --- a/src/dialogs/config-flow/previews/entity-preview-row.ts +++ b/src/dialogs/config-flow/previews/entity-preview-row.ts @@ -18,7 +18,7 @@ import "../../../components/ha-select"; import "../../../components/ha-slider"; import "../../../components/ha-time-input"; import { isTiltOnly } from "../../../data/cover"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { ImageEntity } from "../../../data/image"; import { computeImageUrl } from "../../../data/image"; import { SENSOR_DEVICE_CLASS_TIMESTAMP } from "../../../data/sensor"; diff --git a/src/dialogs/config-flow/step-flow-create-entry.ts b/src/dialogs/config-flow/step-flow-create-entry.ts index 84dedf4e16..79a8e73725 100644 --- a/src/dialogs/config-flow/step-flow-create-entry.ts +++ b/src/dialogs/config-flow/step-flow-create-entry.ts @@ -12,14 +12,15 @@ import { navigate } from "../../common/navigate"; import "../../components/ha-area-picker"; import "../../components/ha-button"; import { assistSatelliteSupportsSetupFlow } from "../../data/assist_satellite"; +import { getConfigEntries } from "../../data/config_entries"; import type { DataEntryFlowStepCreateEntry } from "../../data/data_entry_flow"; -import type { DeviceRegistryEntry } from "../../data/device_registry"; -import { updateDeviceRegistryEntry } from "../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../data/device/device_registry"; +import { updateDeviceRegistryEntry } from "../../data/device/device_registry"; import { getAutomaticEntityIds, updateEntityRegistryEntry, type EntityRegistryDisplayEntry, -} from "../../data/entity_registry"; +} from "../../data/entity/entity_registry"; import { domainToName } from "../../data/integration"; import type { HomeAssistant } from "../../types"; import { brandsUrl } from "../../util/brands-url"; @@ -27,7 +28,6 @@ import { showAlertDialog } from "../generic/show-dialog-box"; import { showVoiceAssistantSetupDialog } from "../voice-assistant-setup/show-voice-assistant-setup-dialog"; import type { FlowConfig } from "./show-dialog-data-entry-flow"; import { configFlowContentStyles } from "./styles"; -import { getConfigEntries } from "../../data/config_entries"; @customElement("step-flow-create-entry") class StepFlowCreateEntry extends LitElement { diff --git a/src/dialogs/more-info/components/ha-more-info-state-header.ts b/src/dialogs/more-info/components/ha-more-info-state-header.ts index 652b2591fc..6347297660 100644 --- a/src/dialogs/more-info/components/ha-more-info-state-header.ts +++ b/src/dialogs/more-info/components/ha-more-info-state-header.ts @@ -3,7 +3,7 @@ import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-absolute-time"; import "../../../components/ha-relative-time"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { LightEntity } from "../../../data/light"; import { SENSOR_DEVICE_CLASS_TIMESTAMP } from "../../../data/sensor"; import "../../../panels/lovelace/components/hui-timestamp-display"; diff --git a/src/dialogs/more-info/components/lights/dialog-light-color-favorite.ts b/src/dialogs/more-info/components/lights/dialog-light-color-favorite.ts index 77bfcbee8f..421a13e39b 100644 --- a/src/dialogs/more-info/components/lights/dialog-light-color-favorite.ts +++ b/src/dialogs/more-info/components/lights/dialog-light-color-favorite.ts @@ -1,18 +1,18 @@ import { mdiClose } from "@mdi/js"; import type { CSSResultGroup } from "lit"; import { css, html, LitElement, nothing } from "lit"; -import { customElement, property, state, query } from "lit/decorators"; +import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-button"; -import { - getMobileOpenFromBottomAnimation, - getMobileCloseToBottomAnimation, -} from "../../../../components/ha-md-dialog"; -import type { HaMdDialog } from "../../../../components/ha-md-dialog"; import "../../../../components/ha-dialog-header"; import "../../../../components/ha-icon-button-toggle"; -import type { EntityRegistryEntry } from "../../../../data/entity_registry"; +import type { HaMdDialog } from "../../../../components/ha-md-dialog"; +import { + getMobileCloseToBottomAnimation, + getMobileOpenFromBottomAnimation, +} from "../../../../components/ha-md-dialog"; +import type { EntityRegistryEntry } from "../../../../data/entity/entity_registry"; import type { LightColor, LightEntity } from "../../../../data/light"; import { LightColorMode, diff --git a/src/dialogs/more-info/components/lights/ha-more-info-light-favorite-colors.ts b/src/dialogs/more-info/components/lights/ha-more-info-light-favorite-colors.ts index 1c844c01b0..2bfe4eeac6 100644 --- a/src/dialogs/more-info/components/lights/ha-more-info-light-favorite-colors.ts +++ b/src/dialogs/more-info/components/lights/ha-more-info-light-favorite-colors.ts @@ -6,9 +6,9 @@ import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-control-slider"; import "../../../../components/ha-sortable"; -import { UNAVAILABLE } from "../../../../data/entity"; -import type { ExtEntityRegistryEntry } from "../../../../data/entity_registry"; -import { updateEntityRegistryEntry } from "../../../../data/entity_registry"; +import { UNAVAILABLE } from "../../../../data/entity/entity"; +import type { ExtEntityRegistryEntry } from "../../../../data/entity/entity_registry"; +import { updateEntityRegistryEntry } from "../../../../data/entity/entity_registry"; import type { LightColor, LightEntity } from "../../../../data/light"; import { computeDefaultFavoriteColors } from "../../../../data/light"; import { actionHandler } from "../../../../panels/lovelace/common/directives/action-handler-directive"; diff --git a/src/dialogs/more-info/components/lights/light-color-temp-picker.ts b/src/dialogs/more-info/components/lights/light-color-temp-picker.ts index f35536d722..a792fbb3be 100644 --- a/src/dialogs/more-info/components/lights/light-color-temp-picker.ts +++ b/src/dialogs/more-info/components/lights/light-color-temp-picker.ts @@ -13,8 +13,8 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import { stateColorCss } from "../../../../common/entity/state_color"; import { throttle } from "../../../../common/util/throttle"; import "../../../../components/ha-control-slider"; -import { UNAVAILABLE } from "../../../../data/entity"; -import { DOMAIN_ATTRIBUTES_UNITS } from "../../../../data/entity_attributes"; +import { UNAVAILABLE } from "../../../../data/entity/entity"; +import { DOMAIN_ATTRIBUTES_UNITS } from "../../../../data/entity/entity_attributes"; import type { LightColor, LightEntity } from "../../../../data/light"; import { LightColorMode } from "../../../../data/light"; import type { HomeAssistant } from "../../../../types"; diff --git a/src/dialogs/more-info/components/lights/show-dialog-light-color-favorite.ts b/src/dialogs/more-info/components/lights/show-dialog-light-color-favorite.ts index 5377b085ea..5369584d06 100644 --- a/src/dialogs/more-info/components/lights/show-dialog-light-color-favorite.ts +++ b/src/dialogs/more-info/components/lights/show-dialog-light-color-favorite.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import type { ExtEntityRegistryEntry } from "../../../../data/entity_registry"; +import type { ExtEntityRegistryEntry } from "../../../../data/entity/entity_registry"; import type { LightColor } from "../../../../data/light"; export interface LightColorFavoriteDialogParams { diff --git a/src/dialogs/more-info/components/voice/ha-more-info-view-voice-assistants.ts b/src/dialogs/more-info/components/voice/ha-more-info-view-voice-assistants.ts index 6e289f6af5..df78d28d47 100644 --- a/src/dialogs/more-info/components/voice/ha-more-info-view-voice-assistants.ts +++ b/src/dialogs/more-info/components/voice/ha-more-info-view-voice-assistants.ts @@ -2,7 +2,7 @@ import type { CSSResultGroup } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; -import type { ExtEntityRegistryEntry } from "../../../../data/entity_registry"; +import type { ExtEntityRegistryEntry } from "../../../../data/entity/entity_registry"; import type { ExposeEntitySettings } from "../../../../data/expose"; import { voiceAssistants } from "../../../../data/expose"; import "../../../../panels/config/voice-assistants/entity-voice-settings"; diff --git a/src/dialogs/more-info/controls/more-info-automation.ts b/src/dialogs/more-info/controls/more-info-automation.ts index 586bda9c97..b83787bbed 100644 --- a/src/dialogs/more-info/controls/more-info-automation.ts +++ b/src/dialogs/more-info/controls/more-info-automation.ts @@ -1,11 +1,11 @@ import type { HassEntity } from "home-assistant-js-websocket"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; +import "../../../components/ha-button"; import "../../../components/ha-relative-time"; import { triggerAutomationActions } from "../../../data/automation"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; -import "../../../components/ha-button"; @customElement("more-info-automation") class MoreInfoAutomation extends LitElement { diff --git a/src/dialogs/more-info/controls/more-info-camera.ts b/src/dialogs/more-info/controls/more-info-camera.ts index 9789d741ab..f36895b695 100644 --- a/src/dialogs/more-info/controls/more-info-camera.ts +++ b/src/dialogs/more-info/controls/more-info-camera.ts @@ -4,7 +4,7 @@ import { slugify } from "../../../common/string/slugify"; import "../../../components/buttons/ha-progress-button"; import "../../../components/ha-camera-stream"; import type { CameraEntity } from "../../../data/camera"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import { fileDownload } from "../../../util/file_download"; import { showToast } from "../../../util/toast"; diff --git a/src/dialogs/more-info/controls/more-info-climate.ts b/src/dialogs/more-info/controls/more-info-climate.ts index a1727cecca..0b0e3a4a6b 100644 --- a/src/dialogs/more-info/controls/more-info-climate.ts +++ b/src/dialogs/more-info/controls/more-info-climate.ts @@ -23,7 +23,7 @@ import { climateHvacModeIcon, compareClimateHvacModes, } from "../../../data/climate"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import "../../../state-control/climate/ha-state-control-climate-humidity"; import "../../../state-control/climate/ha-state-control-climate-temperature"; import type { HomeAssistant } from "../../../types"; diff --git a/src/dialogs/more-info/controls/more-info-counter.ts b/src/dialogs/more-info/controls/more-info-counter.ts index a52c43c277..3fa00fb070 100644 --- a/src/dialogs/more-info/controls/more-info-counter.ts +++ b/src/dialogs/more-info/controls/more-info-counter.ts @@ -1,9 +1,9 @@ import type { HassEntity } from "home-assistant-js-websocket"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; -import { isUnavailableState } from "../../../data/entity"; -import type { HomeAssistant } from "../../../types"; import "../../../components/ha-button"; +import { isUnavailableState } from "../../../data/entity/entity"; +import type { HomeAssistant } from "../../../types"; @customElement("more-info-counter") class MoreInfoCounter extends LitElement { diff --git a/src/dialogs/more-info/controls/more-info-date.ts b/src/dialogs/more-info/controls/more-info-date.ts index 590abce941..d88bd342f1 100644 --- a/src/dialogs/more-info/controls/more-info-date.ts +++ b/src/dialogs/more-info/controls/more-info-date.ts @@ -4,7 +4,7 @@ import { customElement, property } from "lit/decorators"; import "../../../components/ha-date-input"; import "../../../components/ha-time-input"; import { setDateValue } from "../../../data/date"; -import { isUnavailableState, UNAVAILABLE } from "../../../data/entity"; +import { isUnavailableState, UNAVAILABLE } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; @customElement("more-info-date") diff --git a/src/dialogs/more-info/controls/more-info-datetime.ts b/src/dialogs/more-info/controls/more-info-datetime.ts index 4be1a2f756..3e3e47336f 100644 --- a/src/dialogs/more-info/controls/more-info-datetime.ts +++ b/src/dialogs/more-info/controls/more-info-datetime.ts @@ -5,7 +5,7 @@ import { customElement, property } from "lit/decorators"; import "../../../components/ha-date-input"; import "../../../components/ha-time-input"; import { setDateTimeValue } from "../../../data/datetime"; -import { isUnavailableState, UNAVAILABLE } from "../../../data/entity"; +import { isUnavailableState, UNAVAILABLE } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; @customElement("more-info-datetime") diff --git a/src/dialogs/more-info/controls/more-info-fan.ts b/src/dialogs/more-info/controls/more-info-fan.ts index 10ba9a7499..c18ae29cae 100644 --- a/src/dialogs/more-info/controls/more-info-fan.ts +++ b/src/dialogs/more-info/controls/more-info-fan.ts @@ -16,7 +16,7 @@ import "../../../components/ha-attribute-icon"; import "../../../components/ha-control-select-menu"; import "../../../components/ha-list-item"; import "../../../components/ha-outlined-icon-button"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { FanEntity } from "../../../data/fan"; import { FAN_SPEED_COUNT_MAX_FOR_BUTTONS, diff --git a/src/dialogs/more-info/controls/more-info-humidifier.ts b/src/dialogs/more-info/controls/more-info-humidifier.ts index c5dd951ba3..1432ff7d79 100644 --- a/src/dialogs/more-info/controls/more-info-humidifier.ts +++ b/src/dialogs/more-info/controls/more-info-humidifier.ts @@ -4,10 +4,10 @@ import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { supportsFeature } from "../../../common/entity/supports-feature"; +import "../../../components/ha-attribute-icon"; import "../../../components/ha-control-select-menu"; import "../../../components/ha-list-item"; -import "../../../components/ha-attribute-icon"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { HumidifierEntity } from "../../../data/humidifier"; import { HumidifierEntityFeature } from "../../../data/humidifier"; import "../../../state-control/humidifier/ha-state-control-humidifier-humidity"; diff --git a/src/dialogs/more-info/controls/more-info-input_datetime.ts b/src/dialogs/more-info/controls/more-info-input_datetime.ts index 403763c653..e357f679d7 100644 --- a/src/dialogs/more-info/controls/more-info-input_datetime.ts +++ b/src/dialogs/more-info/controls/more-info-input_datetime.ts @@ -3,7 +3,7 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-date-input"; import "../../../components/ha-time-input"; -import { isUnavailableState, UNKNOWN } from "../../../data/entity"; +import { isUnavailableState, UNKNOWN } from "../../../data/entity/entity"; import { setInputDateTimeValue, stateToIsoDateString, diff --git a/src/dialogs/more-info/controls/more-info-lawn_mower.ts b/src/dialogs/more-info/controls/more-info-lawn_mower.ts index 117e4c942f..eeab7cce3d 100644 --- a/src/dialogs/more-info/controls/more-info-lawn_mower.ts +++ b/src/dialogs/more-info/controls/more-info-lawn_mower.ts @@ -7,12 +7,12 @@ import { supportsFeature } from "../../../common/entity/supports-feature"; import { blankBeforePercent } from "../../../common/translations/blank_before_percent"; import "../../../components/entity/ha-battery-icon"; import "../../../components/ha-icon-button"; -import { UNAVAILABLE } from "../../../data/entity"; -import type { EntityRegistryDisplayEntry } from "../../../data/entity_registry"; +import { UNAVAILABLE } from "../../../data/entity/entity"; +import type { EntityRegistryDisplayEntry } from "../../../data/entity/entity_registry"; import { findBatteryChargingEntity, findBatteryEntity, -} from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; import type { LawnMowerEntity } from "../../../data/lawn_mower"; import { LawnMowerEntityFeature } from "../../../data/lawn_mower"; import type { HomeAssistant } from "../../../types"; diff --git a/src/dialogs/more-info/controls/more-info-light.ts b/src/dialogs/more-info/controls/more-info-light.ts index 91d6bbe737..46d365d4d9 100644 --- a/src/dialogs/more-info/controls/more-info-light.ts +++ b/src/dialogs/more-info/controls/more-info-light.ts @@ -17,8 +17,8 @@ import "../../../components/ha-control-select-menu"; import "../../../components/ha-icon-button-group"; import "../../../components/ha-icon-button-toggle"; import "../../../components/ha-list-item"; -import { UNAVAILABLE } from "../../../data/entity"; -import type { ExtEntityRegistryEntry } from "../../../data/entity_registry"; +import { UNAVAILABLE } from "../../../data/entity/entity"; +import type { ExtEntityRegistryEntry } from "../../../data/entity/entity_registry"; import { forwardHaptic } from "../../../data/haptics"; import type { LightEntity } from "../../../data/light"; import { diff --git a/src/dialogs/more-info/controls/more-info-media_player.ts b/src/dialogs/more-info/controls/more-info-media_player.ts index da388eb32b..a6479132ea 100644 --- a/src/dialogs/more-info/controls/more-info-media_player.ts +++ b/src/dialogs/more-info/controls/more-info-media_player.ts @@ -12,38 +12,38 @@ import { import type { PropertyValues } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query } from "lit/decorators"; -import { ifDefined } from "lit/directives/if-defined"; import { classMap } from "lit/directives/class-map"; +import { ifDefined } from "lit/directives/if-defined"; +import { formatDurationDigital } from "../../../common/datetime/format_duration"; import { stateActive } from "../../../common/entity/state_active"; import { supportsFeature } from "../../../common/entity/supports-feature"; -import { formatDurationDigital } from "../../../common/datetime/format_duration"; +import "../../../components/chips/ha-assist-chip"; +import "../../../components/ha-button"; import "../../../components/ha-icon-button"; import "../../../components/ha-list-item"; +import "../../../components/ha-marquee-text"; +import "../../../components/ha-md-button-menu"; +import "../../../components/ha-md-menu-item"; import "../../../components/ha-select"; import type { HaSlider } from "../../../components/ha-slider"; -import "../../../components/ha-button"; import "../../../components/ha-svg-icon"; -import { showMediaBrowserDialog } from "../../../components/media-player/show-media-browser-dialog"; import { showJoinMediaPlayersDialog } from "../../../components/media-player/show-join-media-players-dialog"; -import { isUnavailableState } from "../../../data/entity"; +import { showMediaBrowserDialog } from "../../../components/media-player/show-media-browser-dialog"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { MediaPickedEvent, MediaPlayerEntity, } from "../../../data/media-player"; import { cleanupMediaTitle, - computeMediaDescription, computeMediaControls, + computeMediaDescription, handleMediaControlClick, MediaPlayerEntityFeature, mediaPlayerPlayMedia, } from "../../../data/media-player"; import type { HomeAssistant } from "../../../types"; import HassMediaPlayerEntity from "../../../util/hass-media-player-model"; -import "../../../components/ha-md-button-menu"; -import "../../../components/chips/ha-assist-chip"; -import "../../../components/ha-md-menu-item"; -import "../../../components/ha-marquee-text"; @customElement("more-info-media_player") class MoreInfoMediaPlayer extends LitElement { diff --git a/src/dialogs/more-info/controls/more-info-script.ts b/src/dialogs/more-info/controls/more-info-script.ts index 705401ec3d..a00fa0e00a 100644 --- a/src/dialogs/more-info/controls/more-info-script.ts +++ b/src/dialogs/more-info/controls/more-info-script.ts @@ -11,8 +11,8 @@ import "../../../components/ha-control-button-group"; import "../../../components/ha-markdown"; import "../../../components/ha-relative-time"; import "../../../components/ha-service-control"; -import { isUnavailableState } from "../../../data/entity"; -import type { ExtEntityRegistryEntry } from "../../../data/entity_registry"; +import { isUnavailableState } from "../../../data/entity/entity"; +import type { ExtEntityRegistryEntry } from "../../../data/entity/entity_registry"; import type { ScriptEntity } from "../../../data/script"; import { canRun, diff --git a/src/dialogs/more-info/controls/more-info-time.ts b/src/dialogs/more-info/controls/more-info-time.ts index f41ef15197..f60512f32f 100644 --- a/src/dialogs/more-info/controls/more-info-time.ts +++ b/src/dialogs/more-info/controls/more-info-time.ts @@ -3,7 +3,7 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-date-input"; import "../../../components/ha-time-input"; -import { isUnavailableState, UNAVAILABLE } from "../../../data/entity"; +import { isUnavailableState, UNAVAILABLE } from "../../../data/entity/entity"; import { setTimeValue } from "../../../data/time"; import type { HomeAssistant } from "../../../types"; diff --git a/src/dialogs/more-info/controls/more-info-update.ts b/src/dialogs/more-info/controls/more-info-update.ts index edf6398b29..eed05c917b 100644 --- a/src/dialogs/more-info/controls/more-info-update.ts +++ b/src/dialogs/more-info/controls/more-info-update.ts @@ -5,9 +5,9 @@ import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { BINARY_STATE_OFF } from "../../../common/const"; import { relativeTime } from "../../../common/datetime/relative_time"; import { supportsFeature } from "../../../common/entity/supports-feature"; +import "../../../components/buttons/ha-progress-button"; import "../../../components/ha-alert"; import "../../../components/ha-button"; -import "../../../components/buttons/ha-progress-button"; import "../../../components/ha-checkbox"; import "../../../components/ha-faded"; import "../../../components/ha-markdown"; @@ -17,18 +17,18 @@ import "../../../components/ha-spinner"; import "../../../components/ha-switch"; import type { BackupConfig } from "../../../data/backup"; import { fetchBackupConfig } from "../../../data/backup"; -import { isUnavailableState } from "../../../data/entity"; -import type { EntitySources } from "../../../data/entity_sources"; -import { fetchEntitySourcesWithCache } from "../../../data/entity_sources"; +import { isUnavailableState } from "../../../data/entity/entity"; +import type { EntitySources } from "../../../data/entity/entity_sources"; +import { fetchEntitySourcesWithCache } from "../../../data/entity/entity_sources"; import { getSupervisorUpdateConfig } from "../../../data/supervisor/update"; import type { UpdateEntity, UpdateType } from "../../../data/update"; import { getUpdateType, + latestVersionIsSkipped, + updateButtonIsDisabled, UpdateEntityFeature, updateIsInstalling, updateReleaseNotes, - latestVersionIsSkipped, - updateButtonIsDisabled, } from "../../../data/update"; import type { HomeAssistant } from "../../../types"; import { showAlertDialog } from "../../generic/show-dialog-box"; diff --git a/src/dialogs/more-info/controls/more-info-vacuum.ts b/src/dialogs/more-info/controls/more-info-vacuum.ts index 5cfc75eb73..aec1c6f5b0 100644 --- a/src/dialogs/more-info/controls/more-info-vacuum.ts +++ b/src/dialogs/more-info/controls/more-info-vacuum.ts @@ -20,12 +20,12 @@ import "../../../components/ha-icon"; import "../../../components/ha-icon-button"; import "../../../components/ha-list-item"; import "../../../components/ha-select"; -import { UNAVAILABLE } from "../../../data/entity"; -import type { EntityRegistryDisplayEntry } from "../../../data/entity_registry"; +import { UNAVAILABLE } from "../../../data/entity/entity"; +import type { EntityRegistryDisplayEntry } from "../../../data/entity/entity_registry"; import { findBatteryChargingEntity, findBatteryEntity, -} from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; import type { VacuumEntity } from "../../../data/vacuum"; import { VacuumEntityFeature } from "../../../data/vacuum"; import type { HomeAssistant } from "../../../types"; diff --git a/src/dialogs/more-info/controls/more-info-water_heater.ts b/src/dialogs/more-info/controls/more-info-water_heater.ts index 7d7d59e8ef..afb831aee7 100644 --- a/src/dialogs/more-info/controls/more-info-water_heater.ts +++ b/src/dialogs/more-info/controls/more-info-water_heater.ts @@ -6,7 +6,7 @@ import { stopPropagation } from "../../../common/dom/stop_propagation"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-select-menu"; import "../../../components/ha-list-item"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { WaterHeaterEntity } from "../../../data/water_heater"; import { WaterHeaterEntityFeature, diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts index edb81a1600..eb6c051200 100644 --- a/src/dialogs/more-info/ha-more-info-dialog.ts +++ b/src/dialogs/more-info/ha-more-info-dialog.ts @@ -45,8 +45,8 @@ import "../../components/ha-related-items"; import type { EntityRegistryEntry, ExtEntityRegistryEntry, -} from "../../data/entity_registry"; -import { getExtendedEntityRegistryEntry } from "../../data/entity_registry"; +} from "../../data/entity/entity_registry"; +import { getExtendedEntityRegistryEntry } from "../../data/entity/entity_registry"; import { lightSupportsFavoriteColors } from "../../data/light"; import type { ItemType } from "../../data/search"; import { SearchableDomains } from "../../data/search"; diff --git a/src/dialogs/more-info/ha-more-info-info.ts b/src/dialogs/more-info/ha-more-info-info.ts index 1889417cf8..7f551b88bb 100644 --- a/src/dialogs/more-info/ha-more-info-info.ts +++ b/src/dialogs/more-info/ha-more-info-info.ts @@ -2,7 +2,8 @@ import type { HassEntity } from "home-assistant-js-websocket"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../common/entity/compute_domain"; -import type { ExtEntityRegistryEntry } from "../../data/entity_registry"; +import type { ExtEntityRegistryEntry } from "../../data/entity/entity_registry"; +import { getSensorNumericDeviceClasses } from "../../data/sensor"; import type { HomeAssistant } from "../../types"; import { computeShowHistoryComponent, @@ -15,7 +16,6 @@ import { import "./ha-more-info-history"; import "./ha-more-info-logbook"; import "./more-info-content"; -import { getSensorNumericDeviceClasses } from "../../data/sensor"; @customElement("ha-more-info-info") export class MoreInfoInfo extends LitElement { diff --git a/src/dialogs/more-info/ha-more-info-settings.ts b/src/dialogs/more-info/ha-more-info-settings.ts index d48dda54a7..4cedadb0c2 100644 --- a/src/dialogs/more-info/ha-more-info-settings.ts +++ b/src/dialogs/more-info/ha-more-info-settings.ts @@ -6,7 +6,7 @@ import "../../components/ha-alert"; import type { EntityRegistryEntry, ExtEntityRegistryEntry, -} from "../../data/entity_registry"; +} from "../../data/entity/entity_registry"; import { PLATFORMS_WITH_SETTINGS_TAB } from "../../panels/config/entities/const"; import "../../panels/config/entities/entity-registry-settings"; import type { HomeAssistant } from "../../types"; diff --git a/src/dialogs/more-info/more-info-content.ts b/src/dialogs/more-info/more-info-content.ts index 122f7d56b1..ed285383d2 100644 --- a/src/dialogs/more-info/more-info-content.ts +++ b/src/dialogs/more-info/more-info-content.ts @@ -5,7 +5,7 @@ import memoizeOne from "memoize-one"; import { dynamicElement } from "../../common/dom/dynamic-element-directive"; import { computeStateDomain } from "../../common/entity/compute_state_domain"; import "../../components/ha-badge"; -import type { ExtEntityRegistryEntry } from "../../data/entity_registry"; +import type { ExtEntityRegistryEntry } from "../../data/entity/entity_registry"; import { supportsCoverPositionCardFeature } from "../../panels/lovelace/card-features/hui-cover-position-card-feature"; import { supportsLightBrightnessCardFeature } from "../../panels/lovelace/card-features/hui-light-brightness-card-feature"; import type { LovelaceCardFeatureConfig } from "../../panels/lovelace/card-features/types"; diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-dialog.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-dialog.ts index 9d3f47ae43..1cc04ab578 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-dialog.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-dialog.ts @@ -13,8 +13,8 @@ import "../../components/ha-md-button-menu"; import type { AssistSatelliteConfiguration } from "../../data/assist_satellite"; import { fetchAssistSatelliteConfiguration } from "../../data/assist_satellite"; import { getLanguageScores } from "../../data/conversation"; -import { UNAVAILABLE } from "../../data/entity"; -import type { EntityRegistryDisplayEntry } from "../../data/entity_registry"; +import { UNAVAILABLE } from "../../data/entity/entity"; +import type { EntityRegistryDisplayEntry } from "../../data/entity/entity_registry"; import { haStyleDialog } from "../../resources/styles"; import type { HomeAssistant } from "../../types"; import type { VoiceAssistantSetupDialogParams } from "./show-voice-assistant-setup-dialog"; diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-area.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-area.ts index 82c0ca533f..65350e1b11 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-area.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-area.ts @@ -2,7 +2,7 @@ import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import "../../components/ha-area-picker"; -import { updateDeviceRegistryEntry } from "../../data/device_registry"; +import { updateDeviceRegistryEntry } from "../../data/device/device_registry"; import type { HomeAssistant } from "../../types"; import { showAlertDialog } from "../generic/show-dialog-box"; import { AssistantSetupStyles } from "./styles"; diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-local.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-local.ts index 07b8a6f9bb..4490d98657 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-local.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-local.ts @@ -16,10 +16,11 @@ import { fetchConfigFlowInProgress, handleConfigFlowStep, } from "../../data/config_flow"; +import { listAgents } from "../../data/conversation"; import { type ExtEntityRegistryEntry, getExtendedEntityRegistryEntries, -} from "../../data/entity_registry"; +} from "../../data/entity/entity_registry"; import { fetchHassioAddonsInfo, installHassioAddon, @@ -32,7 +33,6 @@ import type { HomeAssistant } from "../../types"; import { documentationUrl } from "../../util/documentation-url"; import { AssistantSetupStyles } from "./styles"; import { STEP } from "./voice-assistant-setup-dialog"; -import { listAgents } from "../../data/conversation"; @customElement("ha-voice-assistant-setup-step-local") export class HaVoiceAssistantSetupStepLocal extends LitElement { diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts index d3a4d7cf0d..c636ff916f 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts @@ -22,7 +22,7 @@ import { setWakeWords, } from "../../data/assist_satellite"; import { fetchCloudStatus } from "../../data/cloud"; -import { updateDeviceRegistryEntry } from "../../data/device_registry"; +import { updateDeviceRegistryEntry } from "../../data/device/device_registry"; import type { InputSelectEntity } from "../../data/input_select"; import { setSelectOption } from "../../data/select"; import { showVoiceAssistantPipelineDetailDialog } from "../../panels/config/voice-assistants/show-dialog-voice-assistant-pipeline-detail"; diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts index fc25a08ca3..9ae949c9fe 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts @@ -4,7 +4,7 @@ import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import "../../components/ha-progress-ring"; import "../../components/ha-spinner"; -import { ON, UNAVAILABLE } from "../../data/entity"; +import { ON, UNAVAILABLE } from "../../data/entity/entity"; import { updateCanInstall, type UpdateEntity, diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-wake-word.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-wake-word.ts index fe534c44d9..755750c364 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-wake-word.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-wake-word.ts @@ -4,16 +4,16 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; +import { computeDomain } from "../../common/entity/compute_domain"; import "../../components/ha-button"; -import "../../components/ha-spinner"; import "../../components/ha-dialog-header"; +import "../../components/ha-spinner"; import type { AssistSatelliteConfiguration } from "../../data/assist_satellite"; import { interceptWakeWord } from "../../data/assist_satellite"; +import type { EntityRegistryDisplayEntry } from "../../data/entity/entity_registry"; import type { HomeAssistant } from "../../types"; import { AssistantSetupStyles } from "./styles"; import { STEP } from "./voice-assistant-setup-dialog"; -import type { EntityRegistryDisplayEntry } from "../../data/entity_registry"; -import { computeDomain } from "../../common/entity/compute_domain"; @customElement("ha-voice-assistant-setup-step-wake-word") export class HaVoiceAssistantSetupStepWakeWord extends LitElement { diff --git a/src/fake_data/provide_hass.ts b/src/fake_data/provide_hass.ts index ffc763f6f0..82c1221a22 100644 --- a/src/fake_data/provide_hass.ts +++ b/src/fake_data/provide_hass.ts @@ -6,6 +6,7 @@ import { import { fireEvent } from "../common/dom/fire_event"; import { computeFormatFunctions } from "../common/translations/entity-state"; import { computeLocalize } from "../common/translations/localize"; +import type { EntityRegistryDisplayEntry } from "../data/entity/entity_registry"; import { DEFAULT_PANEL } from "../data/panel"; import { DateFormat, @@ -22,7 +23,6 @@ import { demoPanels } from "./demo_panels"; import { demoServices } from "./demo_services"; import type { Entity } from "./entity"; import { getEntity } from "./entity"; -import type { EntityRegistryDisplayEntry } from "../data/entity_registry"; const ensureArray = (val: T | T[]): T[] => Array.isArray(val) ? val : [val]; diff --git a/src/panels/config/areas/ha-config-area-page.ts b/src/panels/config/areas/ha-config-area-page.ts index b05f899f83..6264010e15 100644 --- a/src/panels/config/areas/ha-config-area-page.ts +++ b/src/panels/config/areas/ha-config-area-page.ts @@ -30,13 +30,13 @@ import { } from "../../../data/area_registry"; import type { AutomationEntity } from "../../../data/automation"; import { fullEntitiesContext } from "../../../data/context"; -import type { DeviceRegistryEntry } from "../../../data/device_registry"; -import { sortDeviceRegistryByName } from "../../../data/device_registry"; -import type { EntityRegistryEntry } from "../../../data/entity_registry"; +import type { DeviceRegistryEntry } from "../../../data/device/device_registry"; +import { sortDeviceRegistryByName } from "../../../data/device/device_registry"; +import type { EntityRegistryEntry } from "../../../data/entity/entity_registry"; import { computeEntityRegistryName, sortEntityRegistryByName, -} from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; import type { SceneEntity } from "../../../data/scene"; import type { ScriptEntity } from "../../../data/script"; import type { RelatedResult } from "../../../data/search"; diff --git a/src/panels/config/automation/action/ha-automation-action-row.ts b/src/panels/config/automation/action/ha-automation-action-row.ts index 3fa3930eee..16d9b5ac3a 100644 --- a/src/panels/config/automation/action/ha-automation-action-row.ts +++ b/src/panels/config/automation/action/ha-automation-action-row.ts @@ -58,9 +58,9 @@ import { fullEntitiesContext, labelsContext, } from "../../../../data/context"; -import type { EntityRegistryEntry } from "../../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../../data/entity/entity_registry"; import type { FloorRegistryEntry } from "../../../../data/floor_registry"; -import type { LabelRegistryEntry } from "../../../../data/label_registry"; +import type { LabelRegistryEntry } from "../../../../data/label/label_registry"; import type { Action, NonConditionAction, diff --git a/src/panels/config/automation/action/types/ha-automation-action-device_id.ts b/src/panels/config/automation/action/types/ha-automation-action-device_id.ts index a1637cccfe..a28ecc8d70 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-device_id.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-device_id.ts @@ -11,14 +11,14 @@ import { fullEntitiesContext } from "../../../../../data/context"; import type { DeviceAction, DeviceCapabilities, -} from "../../../../../data/device_automation"; +} from "../../../../../data/device/device_automation"; import { deviceAutomationsEqual, fetchDeviceActionCapabilities, - localizeExtraFieldsComputeLabelCallback, localizeExtraFieldsComputeHelperCallback, -} from "../../../../../data/device_automation"; -import type { EntityRegistryEntry } from "../../../../../data/entity_registry"; + localizeExtraFieldsComputeLabelCallback, +} from "../../../../../data/device/device_automation"; +import type { EntityRegistryEntry } from "../../../../../data/entity/entity_registry"; import type { HomeAssistant } from "../../../../../types"; @customElement("ha-automation-action-device_id") diff --git a/src/panels/config/automation/add-automation-element-dialog.ts b/src/panels/config/automation/add-automation-element-dialog.ts index 3a69e260b0..963a31ddd5 100644 --- a/src/panels/config/automation/add-automation-element-dialog.ts +++ b/src/panels/config/automation/add-automation-element-dialog.ts @@ -58,7 +58,7 @@ import { ACTION_COLLECTIONS, ACTION_ICONS, } from "../../../data/action"; -import type { FloorComboBoxItem } from "../../../data/area_floor"; +import type { FloorComboBoxItem } from "../../../data/area_floor_picker"; import { getAreaDeviceLookup, getAreaEntityLookup, @@ -83,8 +83,8 @@ import { type ConfigEntry, } from "../../../data/config_entries"; import { labelsContext } from "../../../data/context"; -import { getDeviceEntityLookup } from "../../../data/device_registry"; -import type { EntityComboBoxItem } from "../../../data/entity_registry"; +import { getDeviceEntityLookup } from "../../../data/device/device_registry"; +import type { EntityComboBoxItem } from "../../../data/entity/entity_picker"; import { getFloorAreaLookup } from "../../../data/floor_registry"; import { getConditionIcons, @@ -96,7 +96,7 @@ import { domainToName, fetchIntegrationManifests, } from "../../../data/integration"; -import type { LabelRegistryEntry } from "../../../data/label_registry"; +import type { LabelRegistryEntry } from "../../../data/label/label_registry"; import { subscribeLabFeature } from "../../../data/labs"; import { TARGET_SEPARATOR, diff --git a/src/panels/config/automation/add-automation-element/ha-automation-add-from-target.ts b/src/panels/config/automation/add-automation-element/ha-automation-add-from-target.ts index f7fb75a3b6..2af8752f17 100644 --- a/src/panels/config/automation/add-automation-element/ha-automation-add-from-target.ts +++ b/src/panels/config/automation/add-automation-element/ha-automation-add-from-target.ts @@ -34,7 +34,7 @@ import { type FloorComboBoxItem, type FloorNestedComboBoxItem, type UnassignedAreasFloorComboBoxItem, -} from "../../../../data/area_floor"; +} from "../../../../data/area_floor_picker"; import { getAreaDeviceLookup, getAreaEntityLookup, @@ -52,15 +52,13 @@ import { localizeContext, statesContext, } from "../../../../data/context"; -import { getDeviceEntityLookup } from "../../../../data/device_registry"; +import { getDeviceEntityLookup } from "../../../../data/device/device_registry"; import { domainToName, type DomainManifestLookup, } from "../../../../data/integration"; -import { - getLabels, - type LabelRegistryEntry, -} from "../../../../data/label_registry"; +import { getLabels } from "../../../../data/label/label_picker"; +import type { LabelRegistryEntry } from "../../../../data/label/label_registry"; import { TARGET_SEPARATOR, type SingleHassServiceTarget, diff --git a/src/panels/config/automation/add-automation-element/ha-automation-add-search.ts b/src/panels/config/automation/add-automation-element/ha-automation-add-search.ts index e6aaa441bd..057e419d33 100644 --- a/src/panels/config/automation/add-automation-element/ha-automation-add-search.ts +++ b/src/panels/config/automation/add-automation-element/ha-automation-add-search.ts @@ -37,7 +37,7 @@ import { getAreasAndFloors, type AreaFloorValue, type FloorComboBoxItem, -} from "../../../../data/area_floor"; +} from "../../../../data/area_floor_picker"; import { CONDITION_BUILDING_BLOCKS_GROUP } from "../../../../data/condition"; import type { ConfigEntry } from "../../../../data/config_entries"; import { labelsContext } from "../../../../data/context"; @@ -45,18 +45,18 @@ import { deviceComboBoxKeys, getDevices, type DevicePickerItem, -} from "../../../../data/device_registry"; +} from "../../../../data/device/device_picker"; import { entityComboBoxKeys, getEntities, type EntityComboBoxItem, -} from "../../../../data/entity_registry"; +} from "../../../../data/entity/entity_picker"; import type { DomainManifestLookup } from "../../../../data/integration"; import { getLabels, labelComboBoxKeys, - type LabelRegistryEntry, -} from "../../../../data/label_registry"; +} from "../../../../data/label/label_picker"; +import type { LabelRegistryEntry } from "../../../../data/label/label_registry"; import { getTargetComboBoxItemType, TARGET_SEPARATOR, diff --git a/src/panels/config/automation/automation-save-dialog/dialog-automation-save.ts b/src/panels/config/automation/automation-save-dialog/dialog-automation-save.ts index 13d6d6ed7a..16851ecbf2 100644 --- a/src/panels/config/automation/automation-save-dialog/dialog-automation-save.ts +++ b/src/panels/config/automation/automation-save-dialog/dialog-automation-save.ts @@ -24,8 +24,8 @@ import { supportsMarkdownHelper } from "../../../../common/translations/markdown import { subscribeOne } from "../../../../common/util/subscribe-one"; import type { GenDataTaskResult } from "../../../../data/ai_task"; import { fetchCategoryRegistry } from "../../../../data/category_registry"; -import { subscribeEntityRegistry } from "../../../../data/entity_registry"; -import { subscribeLabelRegistry } from "../../../../data/label_registry"; +import { subscribeEntityRegistry } from "../../../../data/entity/entity_registry"; +import { subscribeLabelRegistry } from "../../../../data/label/label_registry"; import type { HassDialog } from "../../../../dialogs/make-dialog-manager"; import { haStyle, haStyleDialog } from "../../../../resources/styles"; import type { HomeAssistant } from "../../../../types"; diff --git a/src/panels/config/automation/automation-save-dialog/show-dialog-automation-save.ts b/src/panels/config/automation/automation-save-dialog/show-dialog-automation-save.ts index cd816443d1..b4ac385665 100644 --- a/src/panels/config/automation/automation-save-dialog/show-dialog-automation-save.ts +++ b/src/panels/config/automation/automation-save-dialog/show-dialog-automation-save.ts @@ -1,7 +1,7 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import type { AutomationConfig } from "../../../../data/automation"; +import type { EntityRegistryEntry } from "../../../../data/entity/entity_registry"; import type { ScriptConfig } from "../../../../data/script"; -import type { EntityRegistryEntry } from "../../../../data/entity_registry"; export const loadAutomationSaveDialog = () => import("./dialog-automation-save"); diff --git a/src/panels/config/automation/condition/ha-automation-condition-row.ts b/src/panels/config/automation/condition/ha-automation-condition-row.ts index 513c921dee..ee41c0074a 100644 --- a/src/panels/config/automation/condition/ha-automation-condition-row.ts +++ b/src/panels/config/automation/condition/ha-automation-condition-row.ts @@ -50,7 +50,7 @@ import type { ConditionDescriptions } from "../../../../data/condition"; import { CONDITION_BUILDING_BLOCKS } from "../../../../data/condition"; import { validateConfig } from "../../../../data/config"; import { fullEntitiesContext } from "../../../../data/context"; -import type { EntityRegistryEntry } from "../../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../../data/entity/entity_registry"; import { showAlertDialog, showPromptDialog, diff --git a/src/panels/config/automation/condition/types/ha-automation-condition-device.ts b/src/panels/config/automation/condition/types/ha-automation-condition-device.ts index c6cea685f3..721c16996b 100644 --- a/src/panels/config/automation/condition/types/ha-automation-condition-device.ts +++ b/src/panels/config/automation/condition/types/ha-automation-condition-device.ts @@ -11,14 +11,14 @@ import { fullEntitiesContext } from "../../../../../data/context"; import type { DeviceCapabilities, DeviceCondition, -} from "../../../../../data/device_automation"; +} from "../../../../../data/device/device_automation"; import { deviceAutomationsEqual, fetchDeviceConditionCapabilities, - localizeExtraFieldsComputeLabelCallback, localizeExtraFieldsComputeHelperCallback, -} from "../../../../../data/device_automation"; -import type { EntityRegistryEntry } from "../../../../../data/entity_registry"; + localizeExtraFieldsComputeLabelCallback, +} from "../../../../../data/device/device_automation"; +import type { EntityRegistryEntry } from "../../../../../data/entity/entity_registry"; import type { HomeAssistant } from "../../../../../types"; @customElement("ha-automation-condition-device") diff --git a/src/panels/config/automation/condition/types/ha-automation-condition-numeric_state.ts b/src/panels/config/automation/condition/types/ha-automation-condition-numeric_state.ts index 335e92799d..0d1a21460a 100644 --- a/src/panels/config/automation/condition/types/ha-automation-condition-numeric_state.ts +++ b/src/panels/config/automation/condition/types/ha-automation-condition-numeric_state.ts @@ -1,6 +1,7 @@ import type { PropertyValues } from "lit"; import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; +import memoizeOne from "memoize-one"; import { assert, boolean, @@ -11,14 +12,13 @@ import { string, union, } from "superstruct"; -import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../../common/dom/fire_event"; import type { LocalizeFunc } from "../../../../../common/translations/localize"; import "../../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../../components/ha-form/types"; import type { NumericStateCondition } from "../../../../../data/automation"; +import { NON_NUMERIC_ATTRIBUTES } from "../../../../../data/entity/entity_attributes"; import type { HomeAssistant } from "../../../../../types"; -import { NON_NUMERIC_ATTRIBUTES } from "../../../../../data/entity_attributes"; const numericStateConditionStruct = object({ alias: optional(string()), diff --git a/src/panels/config/automation/ha-automation-editor.ts b/src/panels/config/automation/ha-automation-editor.ts index 08bab76253..8f7d92a465 100644 --- a/src/panels/config/automation/ha-automation-editor.ts +++ b/src/panels/config/automation/ha-automation-editor.ts @@ -63,11 +63,11 @@ import { import { substituteBlueprint } from "../../../data/blueprint"; import { validateConfig } from "../../../data/config"; import { fullEntitiesContext } from "../../../data/context"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import { type EntityRegistryEntry, updateEntityRegistryEntry, -} from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; import type { Action } from "../../../data/script"; import { showAlertDialog, diff --git a/src/panels/config/automation/ha-automation-picker.ts b/src/panels/config/automation/ha-automation-picker.ts index 6e39c9d20c..b30985002a 100644 --- a/src/panels/config/automation/ha-automation-picker.ts +++ b/src/panels/config/automation/ha-automation-picker.ts @@ -36,7 +36,6 @@ import { fireEvent } from "../../../common/dom/fire_event"; import { computeStateName } from "../../../common/entity/compute_state_name"; import { navigate } from "../../../common/navigate"; import { slugify } from "../../../common/string/slugify"; -import "../../../components/ha-tooltip"; import type { LocalizeFunc } from "../../../common/translations/localize"; import { hasRejectedItems, @@ -66,6 +65,7 @@ import "../../../components/ha-md-menu-item"; import type { HaMdMenuItem } from "../../../components/ha-md-menu-item"; import "../../../components/ha-sub-menu"; import "../../../components/ha-svg-icon"; +import "../../../components/ha-tooltip"; import { createAreaRegistryEntry } from "../../../data/area_registry"; import type { AutomationEntity } from "../../../data/automation"; import { @@ -87,17 +87,17 @@ import { deserializeFilters, serializeFilters, } from "../../../data/data_table_filters"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { EntityRegistryEntry, UpdateEntityRegistryEntryResult, -} from "../../../data/entity_registry"; -import { updateEntityRegistryEntry } from "../../../data/entity_registry"; -import type { LabelRegistryEntry } from "../../../data/label_registry"; +} from "../../../data/entity/entity_registry"; +import { updateEntityRegistryEntry } from "../../../data/entity/entity_registry"; +import type { LabelRegistryEntry } from "../../../data/label/label_registry"; import { createLabelRegistryEntry, subscribeLabelRegistry, -} from "../../../data/label_registry"; +} from "../../../data/label/label_registry"; import { findRelated } from "../../../data/search"; import { showAlertDialog, diff --git a/src/panels/config/automation/option/ha-automation-option-row.ts b/src/panels/config/automation/option/ha-automation-option-row.ts index f548ba9bfb..ed2c5fe28d 100644 --- a/src/panels/config/automation/option/ha-automation-option-row.ts +++ b/src/panels/config/automation/option/ha-automation-option-row.ts @@ -32,7 +32,7 @@ import type { } from "../../../../data/automation"; import { describeCondition } from "../../../../data/automation_i18n"; import { fullEntitiesContext } from "../../../../data/context"; -import type { EntityRegistryEntry } from "../../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../../data/entity/entity_registry"; import type { Action, Option } from "../../../../data/script"; import { showPromptDialog } from "../../../../dialogs/generic/show-dialog-box"; import type { HomeAssistant } from "../../../../types"; diff --git a/src/panels/config/automation/trigger/ha-automation-trigger-row.ts b/src/panels/config/automation/trigger/ha-automation-trigger-row.ts index e341d01053..1930b55fc4 100644 --- a/src/panels/config/automation/trigger/ha-automation-trigger-row.ts +++ b/src/panels/config/automation/trigger/ha-automation-trigger-row.ts @@ -52,7 +52,7 @@ import { isTrigger, subscribeTrigger } from "../../../../data/automation"; import { describeTrigger } from "../../../../data/automation_i18n"; import { validateConfig } from "../../../../data/config"; import { fullEntitiesContext } from "../../../../data/context"; -import type { EntityRegistryEntry } from "../../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../../data/entity/entity_registry"; import type { TriggerDescriptions } from "../../../../data/trigger"; import { isTriggerList } from "../../../../data/trigger"; import { diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts index 238454a8a2..d480ccb9af 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts @@ -7,20 +7,20 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; import { deepEqual } from "../../../../../common/util/deep-equal"; import "../../../../../components/device/ha-device-picker"; import "../../../../../components/device/ha-device-trigger-picker"; -import "../../../../../components/ha-form/ha-form"; import { computeInitialHaFormData } from "../../../../../components/ha-form/compute-initial-ha-form-data"; +import "../../../../../components/ha-form/ha-form"; import { fullEntitiesContext } from "../../../../../data/context"; import type { DeviceCapabilities, DeviceTrigger, -} from "../../../../../data/device_automation"; +} from "../../../../../data/device/device_automation"; import { deviceAutomationsEqual, fetchDeviceTriggerCapabilities, - localizeExtraFieldsComputeLabelCallback, localizeExtraFieldsComputeHelperCallback, -} from "../../../../../data/device_automation"; -import type { EntityRegistryEntry } from "../../../../../data/entity_registry"; + localizeExtraFieldsComputeLabelCallback, +} from "../../../../../data/device/device_automation"; +import type { EntityRegistryEntry } from "../../../../../data/entity/entity_registry"; import type { HomeAssistant } from "../../../../../types"; @customElement("ha-automation-trigger-device") diff --git a/src/panels/config/category/dialog-assign-category.ts b/src/panels/config/category/dialog-assign-category.ts index 4fab1582db..1243b967ee 100644 --- a/src/panels/config/category/dialog-assign-category.ts +++ b/src/panels/config/category/dialog-assign-category.ts @@ -3,12 +3,12 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-alert"; +import "../../../components/ha-button"; import { createCloseHeading } from "../../../components/ha-dialog"; import "../../../components/ha-icon-picker"; import "../../../components/ha-settings-row"; import "../../../components/ha-textfield"; -import "../../../components/ha-button"; -import { updateEntityRegistryEntry } from "../../../data/entity_registry"; +import { updateEntityRegistryEntry } from "../../../data/entity/entity_registry"; import { haStyleDialog } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; import "./ha-category-picker"; diff --git a/src/panels/config/category/show-dialog-assign-category.ts b/src/panels/config/category/show-dialog-assign-category.ts index edbf91ee83..d7ca4946eb 100644 --- a/src/panels/config/category/show-dialog-assign-category.ts +++ b/src/panels/config/category/show-dialog-assign-category.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import type { EntityRegistryEntry } from "../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../data/entity/entity_registry"; export interface AssignCategoryDialogParams { entityReg: EntityRegistryEntry; diff --git a/src/panels/config/dashboard/ha-config-updates.ts b/src/panels/config/dashboard/ha-config-updates.ts index 552f5bcf14..76ee39f017 100644 --- a/src/panels/config/dashboard/ha-config-updates.ts +++ b/src/panels/config/dashboard/ha-config-updates.ts @@ -12,15 +12,15 @@ import "../../../components/ha-alert"; import "../../../components/ha-icon-next"; import "../../../components/ha-md-list"; import "../../../components/ha-md-list-item"; +import "../../../components/ha-progress-ring"; import "../../../components/ha-spinner"; -import type { DeviceRegistryEntry } from "../../../data/device_registry"; -import { subscribeDeviceRegistry } from "../../../data/device_registry"; -import type { EntityRegistryEntry } from "../../../data/entity_registry"; -import { subscribeEntityRegistry } from "../../../data/entity_registry"; +import type { DeviceRegistryEntry } from "../../../data/device/device_registry"; +import { subscribeDeviceRegistry } from "../../../data/device/device_registry"; +import type { EntityRegistryEntry } from "../../../data/entity/entity_registry"; +import { subscribeEntityRegistry } from "../../../data/entity/entity_registry"; import type { UpdateEntity } from "../../../data/update"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import type { HomeAssistant } from "../../../types"; -import "../../../components/ha-progress-ring"; @customElement("ha-config-updates") class HaConfigUpdates extends SubscribeMixin(LitElement) { diff --git a/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts b/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts index e31f9fdbf2..72dc04ddd8 100644 --- a/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts +++ b/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts @@ -11,21 +11,21 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import { shouldHandleRequestSelectedEvent } from "../../../../common/mwc/handle-request-selected-event"; import { createCloseHeading } from "../../../../components/ha-dialog"; import "../../../../components/ha-icon-next"; -import "../../../../components/ha-list-item"; import "../../../../components/ha-list"; +import "../../../../components/ha-list-item"; import type { AutomationConfig } from "../../../../data/automation"; import { showAutomationEditor } from "../../../../data/automation"; import type { DeviceAction, DeviceCondition, DeviceTrigger, -} from "../../../../data/device_automation"; +} from "../../../../data/device/device_automation"; import { fetchDeviceActions, fetchDeviceConditions, fetchDeviceTriggers, sortDeviceAutomations, -} from "../../../../data/device_automation"; +} from "../../../../data/device/device_automation"; import type { ScriptConfig } from "../../../../data/script"; import { showScriptEditor } from "../../../../data/script"; import { haStyle, haStyleDialog } from "../../../../resources/styles"; diff --git a/src/panels/config/devices/device-detail/ha-device-entities-card.ts b/src/panels/config/devices/device-detail/ha-device-entities-card.ts index a20f29828d..0fdd15f905 100644 --- a/src/panels/config/devices/device-detail/ha-device-entities-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-entities-card.ts @@ -10,8 +10,8 @@ import "../../../../components/ha-card"; import "../../../../components/ha-icon"; import "../../../../components/ha-list"; import "../../../../components/ha-list-item"; -import type { ExtEntityRegistryEntry } from "../../../../data/entity_registry"; -import { getExtendedEntityRegistryEntry } from "../../../../data/entity_registry"; +import type { ExtEntityRegistryEntry } from "../../../../data/entity/entity_registry"; +import { getExtendedEntityRegistryEntry } from "../../../../data/entity/entity_registry"; import { entryIcon } from "../../../../data/icons"; import { showMoreInfoDialog } from "../../../../dialogs/more-info/show-ha-more-info-dialog"; import type { HomeAssistant } from "../../../../types"; diff --git a/src/panels/config/devices/device-detail/ha-device-info-card.ts b/src/panels/config/devices/device-detail/ha-device-info-card.ts index b3c0362dd8..c6fd886891 100644 --- a/src/panels/config/devices/device-detail/ha-device-info-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-info-card.ts @@ -2,21 +2,21 @@ import type { CSSResultGroup, TemplateResult } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; +import { computeCssColor } from "../../../../common/color/compute-color"; +import { isComponentLoaded } from "../../../../common/config/is_component_loaded"; import { computeDeviceNameDisplay } from "../../../../common/entity/compute_device_name"; import { stringCompare } from "../../../../common/string/compare"; import { titleCase } from "../../../../common/string/title-case"; -import "../../../../components/ha-card"; -import type { DeviceRegistryEntry } from "../../../../data/device_registry"; -import { haStyle } from "../../../../resources/styles"; -import type { HomeAssistant } from "../../../../types"; import { createSearchParam } from "../../../../common/url/search-params"; -import { isComponentLoaded } from "../../../../common/config/is_component_loaded"; +import "../../../../components/ha-card"; import "../../../../components/ha-icon"; import "../../../../components/ha-label"; -import type { LabelRegistryEntry } from "../../../../data/label_registry"; -import { subscribeLabelRegistry } from "../../../../data/label_registry"; -import { computeCssColor } from "../../../../common/color/compute-color"; +import type { DeviceRegistryEntry } from "../../../../data/device/device_registry"; +import type { LabelRegistryEntry } from "../../../../data/label/label_registry"; +import { subscribeLabelRegistry } from "../../../../data/label/label_registry"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; +import { haStyle } from "../../../../resources/styles"; +import type { HomeAssistant } from "../../../../types"; @customElement("ha-device-info-card") export class HaDeviceCard extends SubscribeMixin(LitElement) { diff --git a/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts b/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts index 0d9aeda807..6758909123 100644 --- a/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts @@ -6,7 +6,7 @@ import { caseInsensitiveStringCompare } from "../../../../common/string/compare" import "../../../../components/ha-card"; import "../../../../components/ha-icon-next"; import "../../../../components/ha-list-item"; -import type { DeviceRegistryEntry } from "../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../data/device/device_registry"; import type { HomeAssistant } from "../../../../types"; const MAX_VISIBLE_VIA_DEVICES = 10; diff --git a/src/panels/config/devices/device-detail/integration-elements/esphome/device-actions.ts b/src/panels/config/devices/device-detail/integration-elements/esphome/device-actions.ts index 474d4d49f0..5d7a259ce5 100644 --- a/src/panels/config/devices/device-detail/integration-elements/esphome/device-actions.ts +++ b/src/panels/config/devices/device-detail/integration-elements/esphome/device-actions.ts @@ -1,6 +1,6 @@ import { mdiKey } from "@mdi/js"; import { getConfigEntries } from "../../../../../../data/config_entries"; -import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../../data/device/device_registry"; import { fetchESPHomeEncryptionKey } from "../../../../../../data/esphome"; import type { HomeAssistant } from "../../../../../../types"; import { showESPHomeEncryptionKeyDialog } from "../../../../integrations/integration-panels/esphome/show-dialog-esphome-encryption-key"; diff --git a/src/panels/config/devices/device-detail/integration-elements/matter/device-actions.ts b/src/panels/config/devices/device-detail/integration-elements/matter/device-actions.ts index f90c78b9fc..73efbfa4a0 100644 --- a/src/panels/config/devices/device-detail/integration-elements/matter/device-actions.ts +++ b/src/panels/config/devices/device-detail/integration-elements/matter/device-actions.ts @@ -4,18 +4,18 @@ import { mdiChatQuestion, mdiExportVariant, } from "@mdi/js"; -import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import { navigate } from "../../../../../../common/navigate"; +import type { DeviceRegistryEntry } from "../../../../../../data/device/device_registry"; import { NetworkType, getMatterNodeDiagnostics, } from "../../../../../../data/matter"; import type { HomeAssistant } from "../../../../../../types"; -import { showMatterReinterviewNodeDialog } from "../../../../integrations/integration-panels/matter/show-dialog-matter-reinterview-node"; -import { showMatterPingNodeDialog } from "../../../../integrations/integration-panels/matter/show-dialog-matter-ping-node"; -import { showMatterOpenCommissioningWindowDialog } from "../../../../integrations/integration-panels/matter/show-dialog-matter-open-commissioning-window"; -import type { DeviceAction } from "../../../ha-config-device-page"; import { showMatterManageFabricsDialog } from "../../../../integrations/integration-panels/matter/show-dialog-matter-manage-fabrics"; -import { navigate } from "../../../../../../common/navigate"; +import { showMatterOpenCommissioningWindowDialog } from "../../../../integrations/integration-panels/matter/show-dialog-matter-open-commissioning-window"; +import { showMatterPingNodeDialog } from "../../../../integrations/integration-panels/matter/show-dialog-matter-ping-node"; +import { showMatterReinterviewNodeDialog } from "../../../../integrations/integration-panels/matter/show-dialog-matter-reinterview-node"; +import type { DeviceAction } from "../../../ha-config-device-page"; export const getMatterDeviceDefaultActions = ( el: HTMLElement, diff --git a/src/panels/config/devices/device-detail/integration-elements/matter/ha-device-info-matter.ts b/src/panels/config/devices/device-detail/integration-elements/matter/ha-device-info-matter.ts index 61eebe4611..f56f9c0f63 100644 --- a/src/panels/config/devices/device-detail/integration-elements/matter/ha-device-info-matter.ts +++ b/src/panels/config/devices/device-detail/integration-elements/matter/ha-device-info-matter.ts @@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../../components/ha-expansion-panel"; -import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../../data/device/device_registry"; import type { MatterNodeDiagnostics } from "../../../../../../data/matter"; import { getMatterNodeDiagnostics } from "../../../../../../data/matter"; import { SubscribeMixin } from "../../../../../../mixins/subscribe-mixin"; diff --git a/src/panels/config/devices/device-detail/integration-elements/mqtt/device-actions.ts b/src/panels/config/devices/device-detail/integration-elements/mqtt/device-actions.ts index faa99cf83d..be1bc7f3bf 100644 --- a/src/panels/config/devices/device-detail/integration-elements/mqtt/device-actions.ts +++ b/src/panels/config/devices/device-detail/integration-elements/mqtt/device-actions.ts @@ -1,5 +1,5 @@ import { mdiInformation } from "@mdi/js"; -import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../../data/device/device_registry"; import type { DeviceAction } from "../../../ha-config-device-page"; import { showMQTTDeviceDebugInfoDialog } from "./show-dialog-mqtt-device-debug-info"; diff --git a/src/panels/config/devices/device-detail/integration-elements/mqtt/show-dialog-mqtt-device-debug-info.ts b/src/panels/config/devices/device-detail/integration-elements/mqtt/show-dialog-mqtt-device-debug-info.ts index 25751ba7c5..8b352a81af 100644 --- a/src/panels/config/devices/device-detail/integration-elements/mqtt/show-dialog-mqtt-device-debug-info.ts +++ b/src/panels/config/devices/device-detail/integration-elements/mqtt/show-dialog-mqtt-device-debug-info.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../../../common/dom/fire_event"; -import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../../data/device/device_registry"; export interface MQTTDeviceDebugInfoDialogParams { device: DeviceRegistryEntry; diff --git a/src/panels/config/devices/device-detail/integration-elements/zha/device-actions.ts b/src/panels/config/devices/device-detail/integration-elements/zha/device-actions.ts index 7b636f5f53..3d2568b16a 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zha/device-actions.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zha/device-actions.ts @@ -6,7 +6,7 @@ import { mdiPlus, } from "@mdi/js"; import { goBack, navigate } from "../../../../../../common/navigate"; -import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../../data/device/device_registry"; import { fetchZHADevice } from "../../../../../../data/zha"; import { showConfirmationDialog } from "../../../../../../dialogs/generic/show-dialog-box"; import type { HomeAssistant } from "../../../../../../types"; diff --git a/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts b/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts index 5e211390d1..cb93504247 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts @@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../../components/ha-expansion-panel"; -import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../../data/device/device_registry"; import type { ZHADevice } from "../../../../../../data/zha"; import { fetchZHADevice } from "../../../../../../data/zha"; import { haStyle } from "../../../../../../resources/styles"; diff --git a/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-actions.ts b/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-actions.ts index 96c36c045d..2c9b09a7ab 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-actions.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-actions.ts @@ -10,7 +10,7 @@ import { mdiWrench, } from "@mdi/js"; import { getConfigEntries } from "../../../../../../data/config_entries"; -import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../../data/device/device_registry"; import { fetchZwaveIntegrationSettings, fetchZwaveIsAnyOTAFirmwareUpdateInProgress, @@ -22,14 +22,14 @@ import { } from "../../../../../../data/zwave_js"; import { showConfirmationDialog } from "../../../../../../dialogs/generic/show-dialog-box"; import type { HomeAssistant } from "../../../../../../types"; -import { showZWaveJSRebuildNodeRoutesDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-rebuild-node-routes"; +import { showZWaveJSAddNodeDialog } from "../../../../integrations/integration-panels/zwave_js/add-node/show-dialog-zwave_js-add-node"; +import { showZWaveJSHardResetControllerDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-hard-reset-controller"; import { showZWaveJSNodeStatisticsDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-node-statistics"; +import { showZWaveJSRebuildNodeRoutesDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-rebuild-node-routes"; import { showZWaveJSReinterviewNodeDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-reinterview-node"; +import { showZWaveJSRemoveNodeDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-remove-node"; import { showZWaveJSUpdateFirmwareNodeDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-update-firmware-node"; import type { DeviceAction } from "../../../ha-config-device-page"; -import { showZWaveJSHardResetControllerDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-hard-reset-controller"; -import { showZWaveJSAddNodeDialog } from "../../../../integrations/integration-panels/zwave_js/add-node/show-dialog-zwave_js-add-node"; -import { showZWaveJSRemoveNodeDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-remove-node"; export const getZwaveDeviceActions = async ( el: HTMLElement, diff --git a/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-alerts.ts b/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-alerts.ts index f69ef5e6bd..b07d4266df 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-alerts.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-alerts.ts @@ -1,4 +1,4 @@ -import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../../data/device/device_registry"; import { fetchZwaveNodeAlerts } from "../../../../../../data/zwave_js"; import type { HomeAssistant } from "../../../../../../types"; import type { DeviceAlert } from "../../../ha-config-device-page"; diff --git a/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts b/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts index bed2ec4872..69526251e5 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts @@ -4,7 +4,7 @@ import { customElement, property, state } from "lit/decorators"; import "../../../../../../components/ha-expansion-panel"; import type { ConfigEntry } from "../../../../../../data/config_entries"; import { getConfigEntries } from "../../../../../../data/config_entries"; -import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../../data/device/device_registry"; import type { ZWaveJSNodeStatus } from "../../../../../../data/zwave_js"; import { fetchZwaveNodeStatus, diff --git a/src/panels/config/devices/device-detail/show-dialog-device-automation.ts b/src/panels/config/devices/device-detail/show-dialog-device-automation.ts index 7f7a906c39..11bea030db 100644 --- a/src/panels/config/devices/device-detail/show-dialog-device-automation.ts +++ b/src/panels/config/devices/device-detail/show-dialog-device-automation.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import type { DeviceRegistryEntry } from "../../../../data/device_registry"; -import type { EntityRegistryEntry } from "../../../../data/entity_registry"; +import type { DeviceRegistryEntry } from "../../../../data/device/device_registry"; +import type { EntityRegistryEntry } from "../../../../data/entity/entity_registry"; export interface DeviceAutomationDialogParams { device: DeviceRegistryEntry; diff --git a/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts b/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts index 673f9cf9f3..4c350f46c0 100644 --- a/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts +++ b/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts @@ -5,12 +5,12 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import { computeDeviceNameDisplay } from "../../../../common/entity/compute_device_name"; import "../../../../components/ha-alert"; import "../../../../components/ha-area-picker"; -import "../../../../components/ha-dialog"; import "../../../../components/ha-button"; +import "../../../../components/ha-dialog"; import "../../../../components/ha-labels-picker"; import type { HaSwitch } from "../../../../components/ha-switch"; import "../../../../components/ha-textfield"; -import type { DeviceRegistryEntry } from "../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../data/device/device_registry"; import { haStyle, haStyleDialog } from "../../../../resources/styles"; import type { HomeAssistant } from "../../../../types"; import type { DeviceRegistryDetailDialogParams } from "./show-dialog-device-registry-detail"; diff --git a/src/panels/config/devices/device-registry-detail/show-dialog-device-registry-detail.ts b/src/panels/config/devices/device-registry-detail/show-dialog-device-registry-detail.ts index 2a2514f9b3..f1cffc2047 100644 --- a/src/panels/config/devices/device-registry-detail/show-dialog-device-registry-detail.ts +++ b/src/panels/config/devices/device-registry-detail/show-dialog-device-registry-detail.ts @@ -2,7 +2,7 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import type { DeviceRegistryEntry, DeviceRegistryEntryMutableParams, -} from "../../../../data/device_registry"; +} from "../../../../data/device/device_registry"; export interface DeviceRegistryDetailDialogParams { device: DeviceRegistryEntry; diff --git a/src/panels/config/devices/ha-config-device-page.ts b/src/panels/config/devices/ha-config-device-page.ts index 2b250d035d..818cd5414d 100644 --- a/src/panels/config/devices/ha-config-device-page.ts +++ b/src/panels/config/devices/ha-config-device-page.ts @@ -46,23 +46,23 @@ import { sortConfigEntries, } from "../../../data/config_entries"; import { fullEntitiesContext } from "../../../data/context"; -import type { DeviceRegistryEntry } from "../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../data/device/device_registry"; import { removeConfigEntryFromDevice, updateDeviceRegistryEntry, -} from "../../../data/device_registry"; +} from "../../../data/device/device_registry"; import type { DiagnosticInfo } from "../../../data/diagnostics"; import { fetchDiagnosticHandler, getConfigEntryDiagnosticsDownloadUrl, getDeviceDiagnosticsDownloadUrl, } from "../../../data/diagnostics"; -import type { EntityRegistryEntry } from "../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../data/entity/entity_registry"; import { findBatteryChargingEntity, findBatteryEntity, updateEntityRegistryEntry, -} from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; import type { IntegrationManifest } from "../../../data/integration"; import { domainToName } from "../../../data/integration"; import { regenerateEntityIds } from "../../../data/regenerate_entity_ids"; diff --git a/src/panels/config/devices/ha-config-devices-dashboard.ts b/src/panels/config/devices/ha-config-devices-dashboard.ts index cf913876ac..13a4b70d48 100644 --- a/src/panels/config/devices/ha-config-devices-dashboard.ts +++ b/src/panels/config/devices/ha-config-devices-dashboard.ts @@ -66,22 +66,22 @@ import { import type { DeviceEntityLookup, DeviceRegistryEntry, -} from "../../../data/device_registry"; +} from "../../../data/device/device_registry"; import { removeConfigEntryFromDevice, updateDeviceRegistryEntry, -} from "../../../data/device_registry"; -import type { EntityRegistryEntry } from "../../../data/entity_registry"; +} from "../../../data/device/device_registry"; +import type { EntityRegistryEntry } from "../../../data/entity/entity_registry"; import { findBatteryChargingEntity, findBatteryEntity, -} from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; import type { IntegrationManifest } from "../../../data/integration"; -import type { LabelRegistryEntry } from "../../../data/label_registry"; +import type { LabelRegistryEntry } from "../../../data/label/label_registry"; import { createLabelRegistryEntry, subscribeLabelRegistry, -} from "../../../data/label_registry"; +} from "../../../data/label/label_registry"; import { showAlertDialog, showConfirmationDialog, diff --git a/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts b/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts index e2b0009362..0cc795009d 100644 --- a/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts +++ b/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts @@ -5,8 +5,8 @@ import { isComponentLoaded } from "../../../../../common/config/is_component_loa import { dynamicElement } from "../../../../../common/dom/dynamic-element-directive"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-button"; -import type { ExtEntityRegistryEntry } from "../../../../../data/entity_registry"; -import { removeEntityRegistryEntry } from "../../../../../data/entity_registry"; +import type { ExtEntityRegistryEntry } from "../../../../../data/entity/entity_registry"; +import { removeEntityRegistryEntry } from "../../../../../data/entity/entity_registry"; import { HELPERS_CRUD } from "../../../../../data/helpers_crud"; import { showConfirmationDialog } from "../../../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../../../resources/styles"; diff --git a/src/panels/config/entities/entity-registry-settings-editor.ts b/src/panels/config/entities/entity-registry-settings-editor.ts index 5b92198ba7..05da9233a6 100644 --- a/src/panels/config/entities/entity-registry-settings-editor.ts +++ b/src/panels/config/entities/entity-registry-settings-editor.ts @@ -49,8 +49,8 @@ import { handleConfigFlowStep, } from "../../../data/config_flow"; import type { DataEntryFlowStepCreateEntry } from "../../../data/data_entry_flow"; -import type { DeviceRegistryEntry } from "../../../data/device_registry"; -import { updateDeviceRegistryEntry } from "../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../data/device/device_registry"; +import { updateDeviceRegistryEntry } from "../../../data/device/device_registry"; import type { AlarmControlPanelEntityOptions, EntityRegistryEntry, @@ -58,12 +58,12 @@ import type { ExtEntityRegistryEntry, LockEntityOptions, SensorEntityOptions, -} from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; import { getAutomaticEntityIds, subscribeEntityRegistry, updateEntityRegistryEntry, -} from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; import { entityIcon, entryIcon } from "../../../data/icons"; import { domainToName, diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts index 48e472863c..6eb3a69c03 100644 --- a/src/panels/config/entities/entity-registry-settings.ts +++ b/src/panels/config/entities/entity-registry-settings.ts @@ -10,12 +10,12 @@ import { deleteConfigEntry, getConfigEntry, } from "../../../data/config_entries"; -import { updateDeviceRegistryEntry } from "../../../data/device_registry"; -import type { ExtEntityRegistryEntry } from "../../../data/entity_registry"; +import { updateDeviceRegistryEntry } from "../../../data/device/device_registry"; +import type { ExtEntityRegistryEntry } from "../../../data/entity/entity_registry"; import { removeEntityRegistryEntry, updateEntityRegistryEntry, -} from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; import { fetchIntegrationManifest } from "../../../data/integration"; import { showAlertDialog, diff --git a/src/panels/config/entities/ha-config-entities.ts b/src/panels/config/entities/ha-config-entities.ts index d092717dcb..720f6b592a 100644 --- a/src/panels/config/entities/ha-config-entities.ts +++ b/src/panels/config/entities/ha-config-entities.ts @@ -42,6 +42,7 @@ import { PROTOCOL_INTEGRATIONS, protocolIntegrationPicked, } from "../../../common/integrations/protocolIntegrationPicked"; +import { slugify } from "../../../common/string/slugify"; import type { LocalizeFunc } from "../../../common/translations/localize"; import { hasRejectedItems, @@ -77,25 +78,25 @@ import type { DataTableFiltersItems, DataTableFiltersValues, } from "../../../data/data_table_filters"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { EntityRegistryEntry, UpdateEntityRegistryEntryResult, -} from "../../../data/entity_registry"; -import { updateEntityRegistryEntry } from "../../../data/entity_registry"; -import type { EntitySources } from "../../../data/entity_sources"; -import { fetchEntitySourcesWithCache } from "../../../data/entity_sources"; +} from "../../../data/entity/entity_registry"; +import { updateEntityRegistryEntry } from "../../../data/entity/entity_registry"; +import type { EntitySources } from "../../../data/entity/entity_sources"; +import { fetchEntitySourcesWithCache } from "../../../data/entity/entity_sources"; import { HELPERS_CRUD } from "../../../data/helpers_crud"; import type { IntegrationManifest } from "../../../data/integration"; import { domainToName, fetchIntegrationManifests, } from "../../../data/integration"; -import type { LabelRegistryEntry } from "../../../data/label_registry"; +import type { LabelRegistryEntry } from "../../../data/label/label_registry"; import { createLabelRegistryEntry, subscribeLabelRegistry, -} from "../../../data/label_registry"; +} from "../../../data/label/label_registry"; import { regenerateEntityIds } from "../../../data/regenerate_entity_ids"; import { showAlertDialog, @@ -114,7 +115,6 @@ import { isHelperDomain } from "../helpers/const"; import "../integrations/ha-integration-overflow-menu"; import { showAddIntegrationDialog } from "../integrations/show-add-integration-dialog"; import { showLabelDetailDialog } from "../labels/show-dialog-label-detail"; -import { slugify } from "../../../common/string/slugify"; export interface StateEntity extends Omit< EntityRegistryEntry, diff --git a/src/panels/config/ha-panel-config.ts b/src/panels/config/ha-panel-config.ts index fcdaa49fd7..33d78c10a6 100644 --- a/src/panels/config/ha-panel-config.ts +++ b/src/panels/config/ha-panel-config.ts @@ -42,8 +42,8 @@ import { entityRegistryByEntityId, entityRegistryById, subscribeEntityRegistry, -} from "../../data/entity_registry"; -import { subscribeLabelRegistry } from "../../data/label_registry"; +} from "../../data/entity/entity_registry"; +import { subscribeLabelRegistry } from "../../data/label/label_registry"; import type { RouterOptions } from "../../layouts/hass-router-page"; import { HassRouterPage } from "../../layouts/hass-router-page"; import type { PageNavigation } from "../../layouts/hass-tabs-subpage"; diff --git a/src/panels/config/helpers/ha-config-helpers.ts b/src/panels/config/helpers/ha-config-helpers.ts index cdfadef756..843dad735c 100644 --- a/src/panels/config/helpers/ha-config-helpers.ts +++ b/src/panels/config/helpers/ha-config-helpers.ts @@ -1,5 +1,5 @@ -import { consume } from "@lit/context"; import { ResizeController } from "@lit-labs/observers/resize-controller"; +import { consume } from "@lit/context"; import { mdiAlertCircle, mdiCancel, @@ -7,31 +7,33 @@ import { mdiCog, mdiDelete, mdiDotsVertical, + mdiDownload, mdiMenuDown, mdiPencilOff, - mdiProgressHelper, mdiPlus, + mdiProgressHelper, mdiTag, mdiTrashCan, - mdiDownload, } from "@mdi/js"; import type { HassEntity } from "home-assistant-js-websocket"; import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { debounce } from "../../../common/util/debounce"; import { computeCssColor } from "../../../common/color/compute-color"; +import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { storage } from "../../../common/decorators/storage"; import type { HASSDomEvent } from "../../../common/dom/fire_event"; -import { computeStateDomain } from "../../../common/entity/compute_state_domain"; import { computeAreaName } from "../../../common/entity/compute_area_name"; +import { computeStateDomain } from "../../../common/entity/compute_state_domain"; import { navigate } from "../../../common/navigate"; +import { slugify } from "../../../common/string/slugify"; import type { LocalizeFunc, LocalizeKeys, } from "../../../common/translations/localize"; import { extractSearchParam } from "../../../common/url/search-params"; +import { debounce } from "../../../common/util/debounce"; import { hasRejectedItems, rejectedItems, @@ -55,6 +57,7 @@ import "../../../components/ha-md-divider"; import "../../../components/ha-state-icon"; import "../../../components/ha-svg-icon"; import "../../../components/ha-tooltip"; +import { getSignedPath } from "../../../data/auth"; import type { CategoryRegistryEntry } from "../../../data/category_registry"; import { createCategoryRegistryEntry, @@ -72,27 +75,32 @@ import type { DataTableFiltersItems, DataTableFiltersValues, } from "../../../data/data_table_filters"; +import { + fetchDiagnosticHandlers, + getConfigEntryDiagnosticsDownloadUrl, +} from "../../../data/diagnostics"; import type { EntityRegistryEntry, UpdateEntityRegistryEntryResult, -} from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; import { entityRegistryByEntityId, subscribeEntityRegistry, updateEntityRegistryEntry, -} from "../../../data/entity_registry"; -import { fetchEntitySourcesWithCache } from "../../../data/entity_sources"; +} from "../../../data/entity/entity_registry"; +import { fetchEntitySourcesWithCache } from "../../../data/entity/entity_sources"; +import { HELPERS_CRUD } from "../../../data/helpers_crud"; import type { IntegrationManifest } from "../../../data/integration"; import { domainToName, fetchIntegrationManifest, fetchIntegrationManifests, } from "../../../data/integration"; -import type { LabelRegistryEntry } from "../../../data/label_registry"; +import type { LabelRegistryEntry } from "../../../data/label/label_registry"; import { createLabelRegistryEntry, subscribeLabelRegistry, -} from "../../../data/label_registry"; +} from "../../../data/label/label_registry"; import { showConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-config-flow"; import { showOptionsFlowDialog } from "../../../dialogs/config-flow/show-dialog-options-flow"; import { @@ -105,23 +113,15 @@ import "../../../layouts/hass-tabs-subpage-data-table"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { haStyle } from "../../../resources/styles"; import type { HomeAssistant, Route } from "../../../types"; +import { fileDownload } from "../../../util/file_download"; import { showAssignCategoryDialog } from "../category/show-dialog-assign-category"; import { showCategoryRegistryDetailDialog } from "../category/show-dialog-category-registry-detail"; import { configSections } from "../ha-panel-config"; -import "../integrations/ha-integration-overflow-menu"; import { renderConfigEntryError } from "../integrations/ha-config-integration-page"; +import "../integrations/ha-integration-overflow-menu"; import { showLabelDetailDialog } from "../labels/show-dialog-label-detail"; import { isHelperDomain, type HelperDomain } from "./const"; import { showHelperDetailDialog } from "./show-dialog-helper-detail"; -import { slugify } from "../../../common/string/slugify"; -import { isComponentLoaded } from "../../../common/config/is_component_loaded"; -import { HELPERS_CRUD } from "../../../data/helpers_crud"; -import { - fetchDiagnosticHandlers, - getConfigEntryDiagnosticsDownloadUrl, -} from "../../../data/diagnostics"; -import { getSignedPath } from "../../../data/auth"; -import { fileDownload } from "../../../util/file_download"; interface HelperItem { id: string; diff --git a/src/panels/config/integrations/ha-config-entry-device-row.ts b/src/panels/config/integrations/ha-config-entry-device-row.ts index 23be707e2e..eb9d2bc327 100644 --- a/src/panels/config/integrations/ha-config-entry-device-row.ts +++ b/src/panels/config/integrations/ha-config-entry-device-row.ts @@ -23,8 +23,8 @@ import { removeConfigEntryFromDevice, updateDeviceRegistryEntry, type DeviceRegistryEntry, -} from "../../../data/device_registry"; -import type { EntityRegistryEntry } from "../../../data/entity_registry"; +} from "../../../data/device/device_registry"; +import type { EntityRegistryEntry } from "../../../data/entity/entity_registry"; import { haStyle } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; import { diff --git a/src/panels/config/integrations/ha-config-entry-row.ts b/src/panels/config/integrations/ha-config-entry-row.ts index 345b22fe8c..b61e39e6b6 100644 --- a/src/panels/config/integrations/ha-config-entry-row.ts +++ b/src/panels/config/integrations/ha-config-entry-row.ts @@ -26,6 +26,7 @@ import memoizeOne from "memoize-one"; import { isDevVersion } from "../../../common/config/version"; import { computeDeviceNameDisplay } from "../../../common/entity/compute_device_name"; import { caseInsensitiveStringCompare } from "../../../common/string/compare"; +import { copyToClipboard } from "../../../common/util/copy-clipboard"; import { deleteApplicationCredential, fetchApplicationCredentialsConfigEntry, @@ -46,10 +47,10 @@ import { reloadConfigEntry, updateConfigEntry, } from "../../../data/config_entries"; -import type { DeviceRegistryEntry } from "../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../data/device/device_registry"; import type { DiagnosticInfo } from "../../../data/diagnostics"; import { getConfigEntryDiagnosticsDownloadUrl } from "../../../data/diagnostics"; -import type { EntityRegistryEntry } from "../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../data/entity/entity_registry"; import type { IntegrationManifest } from "../../../data/integration"; import { domainToName, @@ -64,6 +65,7 @@ import { haStyle } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; import { fileDownload } from "../../../util/file_download"; +import { showToast } from "../../../util/toast"; import { showAlertDialog, showConfirmationDialog, @@ -72,8 +74,6 @@ import { import "./ha-config-entry-device-row"; import { renderConfigEntryError } from "./ha-config-integration-page"; import "./ha-config-sub-entry-row"; -import { copyToClipboard } from "../../../common/util/copy-clipboard"; -import { showToast } from "../../../util/toast"; @customElement("ha-config-entry-row") class HaConfigEntryRow extends LitElement { diff --git a/src/panels/config/integrations/ha-config-integration-page.ts b/src/panels/config/integrations/ha-config-integration-page.ts index 2a72b73da6..db7e1d4bb1 100644 --- a/src/panels/config/integrations/ha-config-integration-page.ts +++ b/src/panels/config/integrations/ha-config-integration-page.ts @@ -33,12 +33,12 @@ import { getSignedPath } from "../../../data/auth"; import type { ConfigEntry } from "../../../data/config_entries"; import { ERROR_STATES, getConfigEntries } from "../../../data/config_entries"; import { ATTENTION_SOURCES } from "../../../data/config_flow"; -import type { DeviceRegistryEntry } from "../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../data/device/device_registry"; import type { DiagnosticInfo } from "../../../data/diagnostics"; import { fetchDiagnosticHandler } from "../../../data/diagnostics"; -import type { EntityRegistryEntry } from "../../../data/entity_registry"; -import { subscribeEntityRegistry } from "../../../data/entity_registry"; -import { fetchEntitySourcesWithCache } from "../../../data/entity_sources"; +import type { EntityRegistryEntry } from "../../../data/entity/entity_registry"; +import { subscribeEntityRegistry } from "../../../data/entity/entity_registry"; +import { fetchEntitySourcesWithCache } from "../../../data/entity/entity_sources"; import { getErrorLogDownloadUrl } from "../../../data/error_log"; import type { IntegrationLogInfo, diff --git a/src/panels/config/integrations/ha-config-integrations-dashboard.ts b/src/panels/config/integrations/ha-config-integrations-dashboard.ts index b4036dc9b9..86fbd405fd 100644 --- a/src/panels/config/integrations/ha-config-integrations-dashboard.ts +++ b/src/panels/config/integrations/ha-config-integrations-dashboard.ts @@ -29,9 +29,9 @@ import "../../../components/search-input-outlined"; import type { ConfigEntry } from "../../../data/config_entries"; import { getConfigEntries } from "../../../data/config_entries"; import { fetchDiagnosticHandlers } from "../../../data/diagnostics"; -import type { EntityRegistryEntry } from "../../../data/entity_registry"; -import { subscribeEntityRegistry } from "../../../data/entity_registry"; -import { fetchEntitySourcesWithCache } from "../../../data/entity_sources"; +import type { EntityRegistryEntry } from "../../../data/entity/entity_registry"; +import { subscribeEntityRegistry } from "../../../data/entity/entity_registry"; +import { fetchEntitySourcesWithCache } from "../../../data/entity/entity_sources"; import type { IntegrationLogInfo, IntegrationManifest, diff --git a/src/panels/config/integrations/ha-config-sub-entry-row.ts b/src/panels/config/integrations/ha-config-sub-entry-row.ts index 999bfdb9d6..a2c7c32de0 100644 --- a/src/panels/config/integrations/ha-config-sub-entry-row.ts +++ b/src/panels/config/integrations/ha-config-sub-entry-row.ts @@ -13,9 +13,9 @@ import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import type { ConfigEntry, SubEntry } from "../../../data/config_entries"; import { deleteSubEntry, updateSubEntry } from "../../../data/config_entries"; -import type { DeviceRegistryEntry } from "../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../data/device/device_registry"; import type { DiagnosticInfo } from "../../../data/diagnostics"; -import type { EntityRegistryEntry } from "../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../data/entity/entity_registry"; import type { IntegrationManifest } from "../../../data/integration"; import { showSubConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-sub-config-flow"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/config/integrations/ha-integration-card.ts b/src/panels/config/integrations/ha-integration-card.ts index 90e63b045a..b7c0ca3f45 100644 --- a/src/panels/config/integrations/ha-integration-card.ts +++ b/src/panels/config/integrations/ha-integration-card.ts @@ -13,8 +13,8 @@ import "../../../components/ha-svg-icon"; import "../../../components/ha-tooltip"; import type { ConfigEntry } from "../../../data/config_entries"; import { ERROR_STATES } from "../../../data/config_entries"; -import type { DeviceRegistryEntry } from "../../../data/device_registry"; -import type { EntityRegistryEntry } from "../../../data/entity_registry"; +import type { DeviceRegistryEntry } from "../../../data/device/device_registry"; +import type { EntityRegistryEntry } from "../../../data/entity/entity_registry"; import type { IntegrationLogInfo, IntegrationManifest, diff --git a/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-advertisement-monitor.ts b/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-advertisement-monitor.ts index c2672ac6d9..28bc0b8ed8 100644 --- a/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-advertisement-monitor.ts +++ b/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-advertisement-monitor.ts @@ -1,16 +1,16 @@ import type { UnsubscribeFunc } from "home-assistant-js-websocket"; -import type { CSSResultGroup, TemplateResult, PropertyValues } from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { storage } from "../../../../../common/decorators/storage"; import type { HASSDomEvent } from "../../../../../common/dom/fire_event"; import type { LocalizeFunc } from "../../../../../common/translations/localize"; +import { extractSearchParamsObject } from "../../../../../common/url/search-params"; import type { DataTableColumnContainer, RowClickedEvent, } from "../../../../../components/data-table/ha-data-table"; -import { extractSearchParamsObject } from "../../../../../common/url/search-params"; import "../../../../../components/ha-fab"; import "../../../../../components/ha-icon-button"; import "../../../../../components/ha-relative-time"; @@ -22,12 +22,12 @@ import { subscribeBluetoothAdvertisements, subscribeBluetoothScannersDetails, } from "../../../../../data/bluetooth"; -import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry"; +import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage"; import "../../../../../layouts/hass-tabs-subpage-data-table"; import { haStyle } from "../../../../../resources/styles"; import type { HomeAssistant, Route } from "../../../../../types"; import { showBluetoothDeviceInfoDialog } from "./show-dialog-bluetooth-device-info"; -import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage"; export const bluetoothAdvertisementMonitorTabs: PageNavigation[] = [ { diff --git a/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-connection-monitor.ts b/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-connection-monitor.ts index 1f9ed2f0e8..cd0f64a1cd 100644 --- a/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-connection-monitor.ts +++ b/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-connection-monitor.ts @@ -8,22 +8,22 @@ import type { LocalizeFunc } from "../../../../../common/translations/localize"; import type { DataTableColumnContainer } from "../../../../../components/data-table/ha-data-table"; import "../../../../../components/ha-fab"; import "../../../../../components/ha-icon-button"; +import "../../../../../components/ha-metric"; import "../../../../../components/ha-relative-time"; import type { - BluetoothScannersDetails, - BluetoothConnectionData, BluetoothAllocationsData, + BluetoothConnectionData, + BluetoothScannersDetails, } from "../../../../../data/bluetooth"; import { - subscribeBluetoothScannersDetails, - subscribeBluetoothConnectionAllocations, subscribeBluetoothAdvertisements, + subscribeBluetoothConnectionAllocations, + subscribeBluetoothScannersDetails, } from "../../../../../data/bluetooth"; -import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry"; import "../../../../../layouts/hass-tabs-subpage-data-table"; import { haStyle } from "../../../../../resources/styles"; import type { HomeAssistant, Route } from "../../../../../types"; -import "../../../../../components/ha-metric"; @customElement("bluetooth-connection-monitor") export class BluetoothConnectionMonitorPanel extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-network-visualization.ts b/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-network-visualization.ts index 6e2e8b3fc4..7e629c4f13 100644 --- a/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-network-visualization.ts +++ b/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-network-visualization.ts @@ -25,7 +25,7 @@ import { subscribeBluetoothAdvertisements, subscribeBluetoothScannersDetails, } from "../../../../../data/bluetooth"; -import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry"; import "../../../../../layouts/hass-subpage"; import type { HomeAssistant, Route } from "../../../../../types"; import { bluetoothAdvertisementMonitorTabs } from "./bluetooth-advertisement-monitor"; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts index 26068ca5bc..ed1ea3aad3 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts @@ -10,13 +10,13 @@ import "../../../../../components/entity/state-badge"; import "../../../../../components/ha-area-picker"; import "../../../../../components/ha-card"; import "../../../../../components/ha-textfield"; -import { updateDeviceRegistryEntry } from "../../../../../data/device_registry"; -import type { EntityRegistryEntry } from "../../../../../data/entity_registry"; +import { updateDeviceRegistryEntry } from "../../../../../data/device/device_registry"; +import type { EntityRegistryEntry } from "../../../../../data/entity/entity_registry"; import { getAutomaticEntityIds, subscribeEntityRegistry, updateEntityRegistryEntry, -} from "../../../../../data/entity_registry"; +} from "../../../../../data/entity/entity_registry"; import type { ZHADevice } from "../../../../../data/zha"; import { showAlertDialog } from "../../../../../dialogs/generic/show-dialog-box"; import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin"; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts b/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts index b8c1acd0ad..3c87cdd8b7 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts @@ -6,6 +6,7 @@ import type { import type { CSSResultGroup, PropertyValues } from "lit"; import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; +import { getDeviceContext } from "../../../../../common/entity/context/get_device_context"; import { navigate } from "../../../../../common/navigate"; import "../../../../../components/chart/ha-network-graph"; import type { @@ -13,14 +14,13 @@ import type { NetworkLink, NetworkNode, } from "../../../../../components/chart/ha-network-graph"; +import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry"; import type { ZHADevice } from "../../../../../data/zha"; import { fetchDevices, refreshTopology } from "../../../../../data/zha"; import "../../../../../layouts/hass-tabs-subpage"; import type { HomeAssistant, Route } from "../../../../../types"; import { formatAsPaddedHex } from "./functions"; import { zhaTabs } from "./zha-config-dashboard"; -import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; -import { getDeviceContext } from "../../../../../common/entity/context/get_device_context"; @customElement("zha-network-visualization-page") export class ZHANetworkVisualizationPage extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/zwave_js/add-node/dialog-zwave_js-add-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/add-node/dialog-zwave_js-add-node.ts index 8a35e0be6c..3b288a0ab2 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/add-node/dialog-zwave_js-add-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/add-node/dialog-zwave_js-add-node.ts @@ -6,7 +6,7 @@ import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../../../common/dom/fire_event"; import type { HaDialog } from "../../../../../../components/ha-dialog"; -import { updateDeviceRegistryEntry } from "../../../../../../data/device_registry"; +import { updateDeviceRegistryEntry } from "../../../../../../data/device/device_registry"; import type { QRProvisioningInformation, RequestedGrant, @@ -49,12 +49,12 @@ import "../../../../../../components/ha-icon-button"; import "../../../../../../components/ha-qr-scanner"; import { navigate } from "../../../../../../common/navigate"; -import type { EntityRegistryEntry } from "../../../../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../../../../data/entity/entity_registry"; import { getAutomaticEntityIds, subscribeEntityRegistry, updateEntityRegistryEntry, -} from "../../../../../../data/entity_registry"; +} from "../../../../../../data/entity/entity_registry"; import "./zwave-js-add-node-added-insecure"; import "./zwave-js-add-node-code-input"; import "./zwave-js-add-node-configure-device"; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-color-switch.ts b/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-color-switch.ts index b42fd76158..d62dcf60f6 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-color-switch.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-color-switch.ts @@ -1,11 +1,11 @@ import { LitElement, html } from "lit"; import { customElement, property, state } from "lit/decorators"; -import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; -import type { HomeAssistant } from "../../../../../../types"; -import { invokeZWaveCCApi } from "../../../../../../data/zwave_js"; import "../../../../../../components/ha-alert"; import "../../../../../../components/ha-spinner"; +import type { DeviceRegistryEntry } from "../../../../../../data/device/device_registry"; import { extractApiErrorMessage } from "../../../../../../data/hassio/common"; +import { invokeZWaveCCApi } from "../../../../../../data/zwave_js"; +import type { HomeAssistant } from "../../../../../../types"; import "./zwave_js-capability-control-multilevel-switch"; enum ColorComponent { diff --git a/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-door-lock.ts b/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-door-lock.ts index 0e72a915b9..530d7b17b8 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-door-lock.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-door-lock.ts @@ -1,20 +1,20 @@ import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; -import type { HomeAssistant } from "../../../../../../types"; -import { invokeZWaveCCApi } from "../../../../../../data/zwave_js"; -import "../../../../../../components/ha-button"; import "../../../../../../components/buttons/ha-progress-button"; -import "../../../../../../components/ha-textfield"; -import "../../../../../../components/ha-select"; -import "../../../../../../components/ha-list-item"; -import "../../../../../../components/ha-alert"; -import "../../../../../../components/ha-switch"; -import "../../../../../../components/ha-formfield"; -import "../../../../../../components/ha-spinner"; -import type { HaSwitch } from "../../../../../../components/ha-switch"; import type { HaProgressButton } from "../../../../../../components/buttons/ha-progress-button"; +import "../../../../../../components/ha-alert"; +import "../../../../../../components/ha-button"; +import "../../../../../../components/ha-formfield"; +import "../../../../../../components/ha-list-item"; +import "../../../../../../components/ha-select"; +import "../../../../../../components/ha-spinner"; +import "../../../../../../components/ha-switch"; +import type { HaSwitch } from "../../../../../../components/ha-switch"; +import "../../../../../../components/ha-textfield"; +import type { DeviceRegistryEntry } from "../../../../../../data/device/device_registry"; import { extractApiErrorMessage } from "../../../../../../data/hassio/common"; +import { invokeZWaveCCApi } from "../../../../../../data/zwave_js"; +import type { HomeAssistant } from "../../../../../../types"; type DoorHandleStatus = [boolean, boolean, boolean, boolean]; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-multilevel-switch.ts b/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-multilevel-switch.ts index 79b69b8765..60371c449f 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-multilevel-switch.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-multilevel-switch.ts @@ -1,20 +1,20 @@ import { LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../../components/buttons/ha-progress-button"; -import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; -import type { HomeAssistant } from "../../../../../../types"; -import { invokeZWaveCCApi } from "../../../../../../data/zwave_js"; -import "../../../../../../components/ha-textfield"; -import "../../../../../../components/ha-select"; -import "../../../../../../components/ha-list-item"; +import type { HaProgressButton } from "../../../../../../components/buttons/ha-progress-button"; import "../../../../../../components/ha-alert"; import "../../../../../../components/ha-formfield"; -import "../../../../../../components/ha-switch"; -import type { HaProgressButton } from "../../../../../../components/buttons/ha-progress-button"; +import "../../../../../../components/ha-list-item"; +import "../../../../../../components/ha-select"; import type { HaSelect } from "../../../../../../components/ha-select"; -import type { HaTextField } from "../../../../../../components/ha-textfield"; +import "../../../../../../components/ha-switch"; import type { HaSwitch } from "../../../../../../components/ha-switch"; +import "../../../../../../components/ha-textfield"; +import type { HaTextField } from "../../../../../../components/ha-textfield"; +import type { DeviceRegistryEntry } from "../../../../../../data/device/device_registry"; import { extractApiErrorMessage } from "../../../../../../data/hassio/common"; +import { invokeZWaveCCApi } from "../../../../../../data/zwave_js"; +import type { HomeAssistant } from "../../../../../../types"; @customElement("zwave_js-capability-control-multilevel_switch") class ZWaveJSCapabilityMultiLevelSwitch extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-thermostat-setback.ts b/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-thermostat-setback.ts index 6712a50500..53c7689ad2 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-thermostat-setback.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-thermostat-setback.ts @@ -1,18 +1,18 @@ import { LitElement, css, html } from "lit"; import { customElement, property, query, state } from "lit/decorators"; -import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; -import type { HomeAssistant } from "../../../../../../types"; -import { invokeZWaveCCApi } from "../../../../../../data/zwave_js"; -import "../../../../../../components/ha-button"; import "../../../../../../components/buttons/ha-progress-button"; -import "../../../../../../components/ha-textfield"; -import "../../../../../../components/ha-select"; -import "../../../../../../components/ha-list-item"; -import "../../../../../../components/ha-alert"; -import type { HaSelect } from "../../../../../../components/ha-select"; -import type { HaTextField } from "../../../../../../components/ha-textfield"; -import { extractApiErrorMessage } from "../../../../../../data/hassio/common"; import type { HaProgressButton } from "../../../../../../components/buttons/ha-progress-button"; +import "../../../../../../components/ha-alert"; +import "../../../../../../components/ha-button"; +import "../../../../../../components/ha-list-item"; +import "../../../../../../components/ha-select"; +import type { HaSelect } from "../../../../../../components/ha-select"; +import "../../../../../../components/ha-textfield"; +import type { HaTextField } from "../../../../../../components/ha-textfield"; +import type { DeviceRegistryEntry } from "../../../../../../data/device/device_registry"; +import { extractApiErrorMessage } from "../../../../../../data/hassio/common"; +import { invokeZWaveCCApi } from "../../../../../../data/zwave_js"; +import type { HomeAssistant } from "../../../../../../types"; // enum with special states enum SpecialState { diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts index b5be0824f3..3f55357613 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts @@ -11,8 +11,8 @@ import "../../../../../components/ha-help-tooltip"; import "../../../../../components/ha-list"; import "../../../../../components/ha-list-item"; import "../../../../../components/ha-svg-icon"; -import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; -import { subscribeDeviceRegistry } from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry"; +import { subscribeDeviceRegistry } from "../../../../../data/device/device_registry"; import type { ZWaveJSNodeStatisticsUpdatedMessage, ZWaveJSRouteStatistics, diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-rebuild-node-routes.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-rebuild-node-routes.ts index 1d75a827e0..6edfb807db 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-rebuild-node-routes.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-rebuild-node-routes.ts @@ -4,10 +4,10 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { computeDeviceNameDisplay } from "../../../../../common/entity/compute_device_name"; -import { createCloseHeading } from "../../../../../components/ha-dialog"; import "../../../../../components/ha-button"; +import { createCloseHeading } from "../../../../../components/ha-dialog"; import "../../../../../components/ha-spinner"; -import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry"; import type { ZWaveJSNetwork } from "../../../../../data/zwave_js"; import { fetchZwaveNetworkStatus, diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts index e983d1297e..aa8b630ca3 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts @@ -14,18 +14,18 @@ import "../../../../../components/ha-alert"; import "../../../../../components/ha-button"; import "../../../../../components/ha-dialog"; import "../../../../../components/ha-dialog-header"; +import "../../../../../components/ha-icon-next"; +import "../../../../../components/ha-list-item"; import "../../../../../components/ha-spinner"; -import { haStyleDialog } from "../../../../../resources/styles"; -import type { HomeAssistant } from "../../../../../types"; -import type { ZWaveJSRemoveNodeDialogParams } from "./show-dialog-zwave_js-remove-node"; +import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry"; import { fetchZwaveNodeStatus, NodeStatus, removeFailedZwaveNode, } from "../../../../../data/zwave_js"; -import "../../../../../components/ha-list-item"; -import "../../../../../components/ha-icon-next"; -import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import { haStyleDialog } from "../../../../../resources/styles"; +import type { HomeAssistant } from "../../../../../types"; +import type { ZWaveJSRemoveNodeDialogParams } from "./show-dialog-zwave_js-remove-node"; const EXCLUSION_TIMEOUT_SECONDS = 120; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts index ca3d8a5d85..1d63f51e2a 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts @@ -12,7 +12,7 @@ import "../../../../../components/ha-file-upload"; import "../../../../../components/ha-form/ha-form"; import type { HaFormSchema } from "../../../../../components/ha-form/types"; import "../../../../../components/ha-svg-icon"; -import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry"; import type { ZWaveJSControllerFirmwareUpdateFinishedMessage, ZWaveJSFirmwareUpdateProgressMessage, diff --git a/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-node-statistics.ts b/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-node-statistics.ts index 0b684d8f80..ff25789078 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-node-statistics.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-node-statistics.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; -import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry"; export interface ZWaveJSNodeStatisticsDialogParams { device: DeviceRegistryEntry; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-rebuild-node-routes.ts b/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-rebuild-node-routes.ts index 724510c1b3..d2be229100 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-rebuild-node-routes.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-rebuild-node-routes.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; -import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry"; export interface ZWaveJSRebuildNodeRoutesDialogParams { device: DeviceRegistryEntry; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-update-firmware-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-update-firmware-node.ts index f02385b21f..54faf111b7 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-update-firmware-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-update-firmware-node.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; -import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry"; export interface ZWaveJSUpdateFirmwareNodeDialogParams { device: DeviceRegistryEntry; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-network-visualization.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-network-visualization.ts index d831d30a39..296a1b432b 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-network-visualization.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-network-visualization.ts @@ -14,7 +14,7 @@ import type { NetworkLink, NetworkNode, } from "../../../../../components/chart/ha-network-graph"; -import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry"; import type { ZWaveJSNodeStatisticsUpdatedMessage, ZWaveJSNodeStatus, diff --git a/src/panels/config/labels/dialog-label-detail.ts b/src/panels/config/labels/dialog-label-detail.ts index 63d9cbd485..985b8f6569 100644 --- a/src/panels/config/labels/dialog-label-detail.ts +++ b/src/panels/config/labels/dialog-label-detail.ts @@ -10,7 +10,7 @@ import "../../../components/ha-icon-picker"; import "../../../components/ha-switch"; import "../../../components/ha-textarea"; import "../../../components/ha-textfield"; -import type { LabelRegistryEntryMutableParams } from "../../../data/label_registry"; +import type { LabelRegistryEntryMutableParams } from "../../../data/label/label_registry"; import type { HassDialog } from "../../../dialogs/make-dialog-manager"; import { haStyleDialog } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/config/labels/ha-config-labels.ts b/src/panels/config/labels/ha-config-labels.ts index 6c10089c3a..e4d8aaef28 100644 --- a/src/panels/config/labels/ha-config-labels.ts +++ b/src/panels/config/labels/ha-config-labels.ts @@ -31,13 +31,13 @@ import "../../../components/ha-svg-icon"; import type { LabelRegistryEntry, LabelRegistryEntryMutableParams, -} from "../../../data/label_registry"; +} from "../../../data/label/label_registry"; import { createLabelRegistryEntry, deleteLabelRegistryEntry, fetchLabelRegistry, updateLabelRegistryEntry, -} from "../../../data/label_registry"; +} from "../../../data/label/label_registry"; import { showAlertDialog, showConfirmationDialog, diff --git a/src/panels/config/labels/show-dialog-label-detail.ts b/src/panels/config/labels/show-dialog-label-detail.ts index ca0f66463e..7ea1705ef4 100644 --- a/src/panels/config/labels/show-dialog-label-detail.ts +++ b/src/panels/config/labels/show-dialog-label-detail.ts @@ -2,7 +2,7 @@ import { fireEvent } from "../../../common/dom/fire_event"; import type { LabelRegistryEntry, LabelRegistryEntryMutableParams, -} from "../../../data/label_registry"; +} from "../../../data/label/label_registry"; export interface LabelDetailDialogParams { entry?: LabelRegistryEntry; diff --git a/src/panels/config/scene/ha-scene-dashboard.ts b/src/panels/config/scene/ha-scene-dashboard.ts index 454caec630..1bfea03465 100644 --- a/src/panels/config/scene/ha-scene-dashboard.ts +++ b/src/panels/config/scene/ha-scene-dashboard.ts @@ -31,6 +31,7 @@ import type { HASSDomEvent } from "../../../common/dom/fire_event"; import { fireEvent } from "../../../common/dom/fire_event"; import { computeStateName } from "../../../common/entity/compute_state_name"; import { navigate } from "../../../common/navigate"; +import { slugify } from "../../../common/string/slugify"; import type { LocalizeFunc } from "../../../common/translations/localize"; import { hasRejectedItems, @@ -71,18 +72,18 @@ import { deserializeFilters, serializeFilters, } from "../../../data/data_table_filters"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { EntityRegistryEntry, UpdateEntityRegistryEntryResult, -} from "../../../data/entity_registry"; -import { updateEntityRegistryEntry } from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; +import { updateEntityRegistryEntry } from "../../../data/entity/entity_registry"; import { forwardHaptic } from "../../../data/haptics"; -import type { LabelRegistryEntry } from "../../../data/label_registry"; +import type { LabelRegistryEntry } from "../../../data/label/label_registry"; import { createLabelRegistryEntry, subscribeLabelRegistry, -} from "../../../data/label_registry"; +} from "../../../data/label/label_registry"; import type { SceneEntity } from "../../../data/scene"; import { activateScene, @@ -106,7 +107,6 @@ import { showAssignCategoryDialog } from "../category/show-dialog-assign-categor import { showCategoryRegistryDetailDialog } from "../category/show-dialog-category-registry-detail"; import { configSections } from "../ha-panel-config"; import { showLabelDetailDialog } from "../labels/show-dialog-label-detail"; -import { slugify } from "../../../common/string/slugify"; type SceneItem = SceneEntity & { name: string; diff --git a/src/panels/config/scene/ha-scene-editor.ts b/src/panels/config/scene/ha-scene-editor.ts index 827f3248e0..a6d41123d5 100644 --- a/src/panels/config/scene/ha-scene-editor.ts +++ b/src/panels/config/scene/ha-scene-editor.ts @@ -42,9 +42,9 @@ import "../../../components/ha-list-item"; import "../../../components/ha-svg-icon"; import "../../../components/ha-textfield"; import { fullEntitiesContext } from "../../../data/context"; -import type { DeviceRegistryEntry } from "../../../data/device_registry"; -import type { EntityRegistryEntry } from "../../../data/entity_registry"; -import { updateEntityRegistryEntry } from "../../../data/entity_registry"; +import type { DeviceRegistryEntry } from "../../../data/device/device_registry"; +import type { EntityRegistryEntry } from "../../../data/entity/entity_registry"; +import { updateEntityRegistryEntry } from "../../../data/entity/entity_registry"; import type { SceneConfig, SceneEntities, diff --git a/src/panels/config/script/ha-config-script.ts b/src/panels/config/script/ha-config-script.ts index 0e9b76de0e..d15816cade 100644 --- a/src/panels/config/script/ha-config-script.ts +++ b/src/panels/config/script/ha-config-script.ts @@ -6,7 +6,7 @@ import memoizeOne from "memoize-one"; import { computeStateDomain } from "../../../common/entity/compute_state_domain"; import { debounce } from "../../../common/util/debounce"; import { fullEntitiesContext } from "../../../data/context"; -import type { EntityRegistryEntry } from "../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../data/entity/entity_registry"; import type { ScriptEntity } from "../../../data/script"; import type { RouterOptions } from "../../../layouts/hass-router-page"; import { HassRouterPage } from "../../../layouts/hass-router-page"; diff --git a/src/panels/config/script/ha-script-editor.ts b/src/panels/config/script/ha-script-editor.ts index 4556bf1512..7ff1b45443 100644 --- a/src/panels/config/script/ha-script-editor.ts +++ b/src/panels/config/script/ha-script-editor.ts @@ -42,11 +42,11 @@ import "../../../components/ha-yaml-editor"; import { substituteBlueprint } from "../../../data/blueprint"; import { validateConfig } from "../../../data/config"; import { fullEntitiesContext } from "../../../data/context"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import { type EntityRegistryEntry, updateEntityRegistryEntry, -} from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; import type { BlueprintScriptConfig, ScriptConfig } from "../../../data/script"; import { deleteScript, diff --git a/src/panels/config/script/ha-script-picker.ts b/src/panels/config/script/ha-script-picker.ts index e371da6329..e9781147ed 100644 --- a/src/panels/config/script/ha-script-picker.ts +++ b/src/panels/config/script/ha-script-picker.ts @@ -34,7 +34,6 @@ import { fireEvent } from "../../../common/dom/fire_event"; import { computeStateName } from "../../../common/entity/compute_state_name"; import { navigate } from "../../../common/navigate"; import { slugify } from "../../../common/string/slugify"; -import "../../../components/ha-tooltip"; import type { LocalizeFunc } from "../../../common/translations/localize"; import { hasRejectedItems, @@ -61,6 +60,7 @@ import "../../../components/ha-md-menu"; import "../../../components/ha-md-menu-item"; import "../../../components/ha-sub-menu"; import "../../../components/ha-svg-icon"; +import "../../../components/ha-tooltip"; import { createAreaRegistryEntry } from "../../../data/area_registry"; import type { CategoryRegistryEntry } from "../../../data/category_registry"; import { @@ -73,17 +73,17 @@ import { deserializeFilters, serializeFilters, } from "../../../data/data_table_filters"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { EntityRegistryEntry, UpdateEntityRegistryEntryResult, -} from "../../../data/entity_registry"; -import { updateEntityRegistryEntry } from "../../../data/entity_registry"; -import type { LabelRegistryEntry } from "../../../data/label_registry"; +} from "../../../data/entity/entity_registry"; +import { updateEntityRegistryEntry } from "../../../data/entity/entity_registry"; +import type { LabelRegistryEntry } from "../../../data/label/label_registry"; import { createLabelRegistryEntry, subscribeLabelRegistry, -} from "../../../data/label_registry"; +} from "../../../data/label/label_registry"; import type { ScriptEntity } from "../../../data/script"; import { deleteScript, diff --git a/src/panels/config/script/ha-script-trace.ts b/src/panels/config/script/ha-script-trace.ts index 2e8f667ca6..eb60bf6f0b 100644 --- a/src/panels/config/script/ha-script-trace.ts +++ b/src/panels/config/script/ha-script-trace.ts @@ -33,7 +33,7 @@ import type { NodeInfo, } from "../../../components/trace/hat-script-graph"; import { traceTabStyles } from "../../../components/trace/trace-tab-styles"; -import type { EntityRegistryEntry } from "../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../data/entity/entity_registry"; import type { LogbookEntry } from "../../../data/logbook"; import { getLogbookDataForContext } from "../../../data/logbook"; import type { ScriptEntity } from "../../../data/script"; diff --git a/src/panels/config/voice-assistants/entity-voice-settings.ts b/src/panels/config/voice-assistants/entity-voice-settings.ts index 7b19480675..a2a6e790cd 100644 --- a/src/panels/config/voice-assistants/entity-voice-settings.ts +++ b/src/panels/config/voice-assistants/entity-voice-settings.ts @@ -25,11 +25,11 @@ import { fetchCloudStatus, updateCloudGoogleEntityConfig, } from "../../../data/cloud"; -import type { ExtEntityRegistryEntry } from "../../../data/entity_registry"; +import type { ExtEntityRegistryEntry } from "../../../data/entity/entity_registry"; import { getExtendedEntityRegistryEntry, updateEntityRegistryEntry, -} from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; import type { ExposeEntitySettings } from "../../../data/expose"; import { exposeEntities, voiceAssistants } from "../../../data/expose"; import type { GoogleEntity } from "../../../data/google_assistant"; diff --git a/src/panels/config/voice-assistants/ha-config-voice-assistants-expose.ts b/src/panels/config/voice-assistants/ha-config-voice-assistants-expose.ts index 5522fefae0..a62e814090 100644 --- a/src/panels/config/voice-assistants/ha-config-voice-assistants-expose.ts +++ b/src/panels/config/voice-assistants/ha-config-voice-assistants-expose.ts @@ -10,8 +10,10 @@ import { LitElement, css, html } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import memoize from "memoize-one"; +import { storage } from "../../../common/decorators/storage"; import type { HASSDomEvent } from "../../../common/dom/fire_event"; import { fireEvent } from "../../../common/dom/fire_event"; +import { computeDomain } from "../../../common/entity/compute_domain"; import { computeStateName } from "../../../common/entity/compute_state_name"; import type { EntityDomainFilter } from "../../../common/entity/entity_domain_filter"; import { @@ -19,6 +21,7 @@ import { isEmptyEntityDomainFilter, } from "../../../common/entity/entity_domain_filter"; import { navigate } from "../../../common/navigate"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import type { DataTableColumnContainer, DataTableRowData, @@ -26,33 +29,30 @@ import type { SelectionChangedEvent, SortingChangedEvent, } from "../../../components/data-table/ha-data-table"; -import "../../../components/ha-fab"; import "../../../components/ha-button"; +import "../../../components/ha-fab"; import "../../../components/ha-tooltip"; import type { AlexaEntity } from "../../../data/alexa"; import { fetchCloudAlexaEntities } from "../../../data/alexa"; import type { CloudStatus, CloudStatusLoggedIn } from "../../../data/cloud"; import { entitiesContext } from "../../../data/context"; -import type { ExtEntityRegistryEntry } from "../../../data/entity_registry"; -import { getExtendedEntityRegistryEntries } from "../../../data/entity_registry"; +import type { ExtEntityRegistryEntry } from "../../../data/entity/entity_registry"; +import { getExtendedEntityRegistryEntries } from "../../../data/entity/entity_registry"; import type { ExposeEntitySettings } from "../../../data/expose"; import { exposeEntities, voiceAssistants } from "../../../data/expose"; import type { GoogleEntity } from "../../../data/google_assistant"; import { fetchCloudGoogleEntities } from "../../../data/google_assistant"; +import { domainToName } from "../../../data/integration"; import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; import "../../../layouts/hass-loading-screen"; import "../../../layouts/hass-tabs-subpage-data-table"; import type { HaTabsSubpageDataTable } from "../../../layouts/hass-tabs-subpage-data-table"; import { haStyle } from "../../../resources/styles"; import type { HomeAssistant, Route } from "../../../types"; -import type { LocalizeFunc } from "../../../common/translations/localize"; import "./expose/expose-assistant-icon"; import { voiceAssistantTabs } from "./ha-config-voice-assistants"; import { showExposeEntityDialog } from "./show-dialog-expose-entity"; import { showVoiceSettingsDialog } from "./show-dialog-voice-settings"; -import { storage } from "../../../common/decorators/storage"; -import { domainToName } from "../../../data/integration"; -import { computeDomain } from "../../../common/entity/compute_domain"; @customElement("ha-config-voice-assistants-expose") export class VoiceAssistantsExpose extends LitElement { diff --git a/src/panels/config/voice-assistants/show-dialog-voice-settings.ts b/src/panels/config/voice-assistants/show-dialog-voice-settings.ts index 25794d7a17..3ba8a9efcf 100644 --- a/src/panels/config/voice-assistants/show-dialog-voice-settings.ts +++ b/src/panels/config/voice-assistants/show-dialog-voice-settings.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import type { ExtEntityRegistryEntry } from "../../../data/entity_registry"; +import type { ExtEntityRegistryEntry } from "../../../data/entity/entity_registry"; import type { ExposeEntitySettings } from "../../../data/expose"; export interface VoiceSettingsDialogParams { diff --git a/src/panels/config/zone/ha-config-zone.ts b/src/panels/config/zone/ha-config-zone.ts index 3c40c9b42a..fa66dc62ca 100644 --- a/src/panels/config/zone/ha-config-zone.ts +++ b/src/panels/config/zone/ha-config-zone.ts @@ -8,9 +8,10 @@ import { computeStateDomain } from "../../../common/entity/compute_state_domain" import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-request-selected-event"; import { navigate } from "../../../common/navigate"; import { stringCompare } from "../../../common/string/compare"; +import { slugify } from "../../../common/string/slugify"; +import "../../../components/ha-button"; import "../../../components/ha-card"; import "../../../components/ha-fab"; -import "../../../components/ha-button"; import "../../../components/ha-icon-button"; import "../../../components/ha-list"; import "../../../components/ha-list-item"; @@ -22,7 +23,7 @@ import type { MarkerLocation, } from "../../../components/map/ha-locations-editor"; import { saveCoreConfig } from "../../../data/core"; -import { subscribeEntityRegistry } from "../../../data/entity_registry"; +import { subscribeEntityRegistry } from "../../../data/entity/entity_registry"; import type { HomeZoneMutableParams, Zone, @@ -46,7 +47,6 @@ import "../ha-config-section"; import { configSections } from "../ha-panel-config"; import { showHomeZoneDetailDialog } from "./show-dialog-home-zone-detail"; import { showZoneDetailDialog } from "./show-dialog-zone-detail"; -import { slugify } from "../../../common/string/slugify"; @customElement("ha-config-zone") export class HaConfigZone extends SubscribeMixin(LitElement) { diff --git a/src/panels/logbook/ha-panel-logbook.ts b/src/panels/logbook/ha-panel-logbook.ts index 1f8d5eb2f4..d216c6a749 100644 --- a/src/panels/logbook/ha-panel-logbook.ts +++ b/src/panels/logbook/ha-panel-logbook.ts @@ -20,7 +20,7 @@ import "../../components/ha-icon-button-arrow-prev"; import "../../components/ha-menu-button"; import "../../components/ha-target-picker"; import "../../components/ha-top-app-bar-fixed"; -import type { HaEntityPickerEntityFilterFunc } from "../../data/entity"; +import type { HaEntityPickerEntityFilterFunc } from "../../data/entity/entity"; import { filterLogbookCompatibleEntities } from "../../data/logbook"; import { resolveEntityIDs } from "../../data/selector"; import { getSensorNumericDeviceClasses } from "../../data/sensor"; diff --git a/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts index 5788eb2fd3..f3b8594097 100644 --- a/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts @@ -20,7 +20,7 @@ import { setProtectedAlarmControlPanelMode, supportedAlarmModes, } from "../../../data/alarm_control_panel"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; diff --git a/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts index 9eba683aa2..f4d804dcb1 100644 --- a/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts @@ -13,7 +13,7 @@ import type { HaControlSelectMenu } from "../../../components/ha-control-select- import "../../../components/ha-list-item"; import type { ClimateEntity } from "../../../data/climate"; import { ClimateEntityFeature } from "../../../data/climate"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; diff --git a/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts index 455e40c6fc..1c8874fbaf 100644 --- a/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts @@ -16,7 +16,7 @@ import { climateHvacModeIcon, compareClimateHvacModes, } from "../../../data/climate"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; diff --git a/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts index 805742b90a..b4c8aa04da 100644 --- a/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts @@ -13,7 +13,7 @@ import type { HaControlSelectMenu } from "../../../components/ha-control-select- import "../../../components/ha-list-item"; import type { ClimateEntity } from "../../../data/climate"; import { ClimateEntityFeature } from "../../../data/climate"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; diff --git a/src/panels/lovelace/card-features/hui-climate-swing-horizontal-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-swing-horizontal-modes-card-feature.ts index 41b53d8cd8..6d99d380c8 100644 --- a/src/panels/lovelace/card-features/hui-climate-swing-horizontal-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-swing-horizontal-modes-card-feature.ts @@ -13,7 +13,7 @@ import type { HaControlSelectMenu } from "../../../components/ha-control-select- import "../../../components/ha-list-item"; import type { ClimateEntity } from "../../../data/climate"; import { ClimateEntityFeature } from "../../../data/climate"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; diff --git a/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts index d0d1154d97..f4c231b462 100644 --- a/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts @@ -13,7 +13,7 @@ import type { HaControlSelectMenu } from "../../../components/ha-control-select- import "../../../components/ha-list-item"; import type { ClimateEntity } from "../../../data/climate"; import { ClimateEntityFeature } from "../../../data/climate"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; diff --git a/src/panels/lovelace/card-features/hui-counter-actions-card-feature.ts b/src/panels/lovelace/card-features/hui-counter-actions-card-feature.ts index 25a358f785..ceecca23b8 100644 --- a/src/panels/lovelace/card-features/hui-counter-actions-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-counter-actions-card-feature.ts @@ -7,7 +7,7 @@ import { computeDomain } from "../../../common/entity/compute_domain"; import "../../../components/ha-control-button"; import "../../../components/ha-control-button-group"; import "../../../components/ha-control-select"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; diff --git a/src/panels/lovelace/card-features/hui-cover-position-card-feature.ts b/src/panels/lovelace/card-features/hui-cover-position-card-feature.ts index d23ea7a06a..d973fde4b2 100644 --- a/src/panels/lovelace/card-features/hui-cover-position-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-cover-position-card-feature.ts @@ -9,8 +9,8 @@ import { stateColorCss } from "../../../common/entity/state_color"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-slider"; import { CoverEntityFeature, type CoverEntity } from "../../../data/cover"; -import { UNAVAILABLE } from "../../../data/entity"; -import { DOMAIN_ATTRIBUTES_UNITS } from "../../../data/entity_attributes"; +import { UNAVAILABLE } from "../../../data/entity/entity"; +import { DOMAIN_ATTRIBUTES_UNITS } from "../../../data/entity/entity_attributes"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; diff --git a/src/panels/lovelace/card-features/hui-cover-tilt-position-card-feature.ts b/src/panels/lovelace/card-features/hui-cover-tilt-position-card-feature.ts index cd8300e077..6c8d1d1d50 100644 --- a/src/panels/lovelace/card-features/hui-cover-tilt-position-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-cover-tilt-position-card-feature.ts @@ -8,8 +8,8 @@ import { stateColorCss } from "../../../common/entity/state_color"; import { supportsFeature } from "../../../common/entity/supports-feature"; import type { CoverEntity } from "../../../data/cover"; import { CoverEntityFeature } from "../../../data/cover"; -import { UNAVAILABLE } from "../../../data/entity"; -import { DOMAIN_ATTRIBUTES_UNITS } from "../../../data/entity_attributes"; +import { UNAVAILABLE } from "../../../data/entity/entity"; +import { DOMAIN_ATTRIBUTES_UNITS } from "../../../data/entity/entity_attributes"; import { generateTiltSliderTrackBackgroundGradient } from "../../../state-control/cover/ha-state-control-cover-tilt-position"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature } from "../types"; diff --git a/src/panels/lovelace/card-features/hui-fan-direction-card-feature.ts b/src/panels/lovelace/card-features/hui-fan-direction-card-feature.ts index 35fc4230fa..6a714bbdd0 100644 --- a/src/panels/lovelace/card-features/hui-fan-direction-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-fan-direction-card-feature.ts @@ -6,8 +6,8 @@ import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-attribute-icon"; import "../../../components/ha-control-select"; import type { ControlSelectOption } from "../../../components/ha-control-select"; -import { UNAVAILABLE } from "../../../data/entity"; -import type { FanEntity, FanDirection } from "../../../data/fan"; +import { UNAVAILABLE } from "../../../data/entity/entity"; +import type { FanDirection, FanEntity } from "../../../data/fan"; import { FanEntityFeature } from "../../../data/fan"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature } from "../types"; diff --git a/src/panels/lovelace/card-features/hui-fan-oscillate-card-feature.ts b/src/panels/lovelace/card-features/hui-fan-oscillate-card-feature.ts index 7fb5b249c2..dfdfbac595 100644 --- a/src/panels/lovelace/card-features/hui-fan-oscillate-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-fan-oscillate-card-feature.ts @@ -5,9 +5,10 @@ import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { computeDomain } from "../../../common/entity/compute_domain"; import { stateColorCss } from "../../../common/entity/state_color"; +import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-select"; import type { ControlSelectOption } from "../../../components/ha-control-select"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { FanEntity } from "../../../data/fan"; import { FanEntityFeature } from "../../../data/fan"; import type { HomeAssistant } from "../../../types"; @@ -17,7 +18,6 @@ import type { FanOscillateCardFeatureConfig, LovelaceCardFeatureContext, } from "./types"; -import { supportsFeature } from "../../../common/entity/supports-feature"; export const supportsFanOscilatteCardFeature = ( hass: HomeAssistant, diff --git a/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts index 8f3b48da4e..73b877e3a7 100644 --- a/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts @@ -11,7 +11,7 @@ import type { ControlSelectOption } from "../../../components/ha-control-select" import "../../../components/ha-control-select-menu"; import type { HaControlSelectMenu } from "../../../components/ha-control-select-menu"; import "../../../components/ha-list-item"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { FanEntity } from "../../../data/fan"; import { FanEntityFeature } from "../../../data/fan"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/lovelace/card-features/hui-fan-speed-card-feature.ts b/src/panels/lovelace/card-features/hui-fan-speed-card-feature.ts index b4b4b18b11..15537c7673 100644 --- a/src/panels/lovelace/card-features/hui-fan-speed-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-fan-speed-card-feature.ts @@ -7,8 +7,8 @@ import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-select"; import type { ControlSelectOption } from "../../../components/ha-control-select"; import "../../../components/ha-control-slider"; -import { UNAVAILABLE } from "../../../data/entity"; -import { DOMAIN_ATTRIBUTES_UNITS } from "../../../data/entity_attributes"; +import { UNAVAILABLE } from "../../../data/entity/entity"; +import { DOMAIN_ATTRIBUTES_UNITS } from "../../../data/entity/entity_attributes"; import type { FanEntity, FanSpeed } from "../../../data/fan"; import { computeFanSpeedCount, diff --git a/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts index afa5a6025f..ee133d412b 100644 --- a/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts @@ -11,7 +11,7 @@ import type { ControlSelectOption } from "../../../components/ha-control-select" import "../../../components/ha-control-select-menu"; import type { HaControlSelectMenu } from "../../../components/ha-control-select-menu"; import "../../../components/ha-list-item"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { HumidifierEntity } from "../../../data/humidifier"; import { HumidifierEntityFeature } from "../../../data/humidifier"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts b/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts index 2888030400..0fd7c22bf3 100644 --- a/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts @@ -7,7 +7,7 @@ import { computeDomain } from "../../../common/entity/compute_domain"; import { stateColorCss } from "../../../common/entity/state_color"; import "../../../components/ha-control-select"; import type { ControlSelectOption } from "../../../components/ha-control-select"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { HumidifierEntity, HumidifierState, diff --git a/src/panels/lovelace/card-features/hui-lawn-mower-commands-card-feature.ts b/src/panels/lovelace/card-features/hui-lawn-mower-commands-card-feature.ts index 77f66802b0..eb3605edb7 100644 --- a/src/panels/lovelace/card-features/hui-lawn-mower-commands-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-lawn-mower-commands-card-feature.ts @@ -7,7 +7,7 @@ import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-button"; import "../../../components/ha-control-button-group"; import "../../../components/ha-svg-icon"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { LawnMowerEntity } from "../../../data/lawn_mower"; import { LawnMowerEntityFeature, canDock } from "../../../data/lawn_mower"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/lovelace/card-features/hui-light-brightness-card-feature.ts b/src/panels/lovelace/card-features/hui-light-brightness-card-feature.ts index a0c2ef042a..fb933b4e3b 100644 --- a/src/panels/lovelace/card-features/hui-light-brightness-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-light-brightness-card-feature.ts @@ -3,7 +3,7 @@ import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; import { stateActive } from "../../../common/entity/state_active"; import "../../../components/ha-control-slider"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import { lightSupportsBrightness, type LightEntity } from "../../../data/light"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature } from "../types"; diff --git a/src/panels/lovelace/card-features/hui-light-color-temp-card-feature.ts b/src/panels/lovelace/card-features/hui-light-color-temp-card-feature.ts index 93a91a9ec2..83f9c7a770 100644 --- a/src/panels/lovelace/card-features/hui-light-color-temp-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-light-color-temp-card-feature.ts @@ -9,8 +9,8 @@ import { import { computeDomain } from "../../../common/entity/compute_domain"; import { stateActive } from "../../../common/entity/state_active"; import "../../../components/ha-control-slider"; -import { UNAVAILABLE } from "../../../data/entity"; -import { DOMAIN_ATTRIBUTES_UNITS } from "../../../data/entity_attributes"; +import { UNAVAILABLE } from "../../../data/entity/entity"; +import { DOMAIN_ATTRIBUTES_UNITS } from "../../../data/entity/entity_attributes"; import { LightColorMode, lightSupportsColorMode, diff --git a/src/panels/lovelace/card-features/hui-media-player-playback-card-feature.ts b/src/panels/lovelace/card-features/hui-media-player-playback-card-feature.ts index 2af417317c..9a323ceca1 100644 --- a/src/panels/lovelace/card-features/hui-media-player-playback-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-media-player-playback-card-feature.ts @@ -1,6 +1,3 @@ -import type { PropertyValues } from "lit"; -import { html, LitElement, nothing } from "lit"; -import { customElement, property, state } from "lit/decorators"; import { mdiPause, mdiPlay, @@ -10,27 +7,30 @@ import { mdiSkipPrevious, mdiStop, } from "@mdi/js"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; +import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; +import { stateActive } from "../../../common/entity/state_active"; +import { supportsFeature } from "../../../common/entity/supports-feature"; +import "../../../components/ha-control-button"; +import "../../../components/ha-control-button-group"; +import "../../../components/ha-icon"; +import "../../../components/ha-icon-button"; +import { isUnavailableState } from "../../../data/entity/entity"; +import type { + ControlButton, + MediaPlayerEntity, +} from "../../../data/media-player"; +import { MediaPlayerEntityFeature } from "../../../data/media-player"; import type { HomeAssistant } from "../../../types"; +import { hasConfigChanged } from "../common/has-changed"; import type { LovelaceCardFeature } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; import type { LovelaceCardFeatureContext, MediaPlayerPlaybackCardFeatureConfig, } from "./types"; -import type { - ControlButton, - MediaPlayerEntity, -} from "../../../data/media-player"; -import { MediaPlayerEntityFeature } from "../../../data/media-player"; -import { supportsFeature } from "../../../common/entity/supports-feature"; -import { stateActive } from "../../../common/entity/state_active"; -import { isUnavailableState } from "../../../data/entity"; -import { hasConfigChanged } from "../common/has-changed"; -import "../../../components/ha-control-button-group"; -import "../../../components/ha-control-button"; -import "../../../components/ha-icon-button"; -import "../../../components/ha-icon"; export const supportsMediaPlayerPlaybackCardFeature = ( hass: HomeAssistant, diff --git a/src/panels/lovelace/card-features/hui-media-player-volume-buttons-card-feature.ts b/src/panels/lovelace/card-features/hui-media-player-volume-buttons-card-feature.ts index d6f6a707cf..6f5bcae0ec 100644 --- a/src/panels/lovelace/card-features/hui-media-player-volume-buttons-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-media-player-volume-buttons-card-feature.ts @@ -2,8 +2,9 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; import { supportsFeature } from "../../../common/entity/supports-feature"; +import { clamp } from "../../../common/number/clamp"; import "../../../components/ha-control-number-buttons"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import { MediaPlayerEntityFeature, type MediaPlayerEntity, @@ -15,7 +16,6 @@ import type { LovelaceCardFeatureContext, MediaPlayerVolumeButtonsCardFeatureConfig, } from "./types"; -import { clamp } from "../../../common/number/clamp"; export const supportsMediaPlayerVolumeButtonsCardFeature = ( hass: HomeAssistant, diff --git a/src/panels/lovelace/card-features/hui-media-player-volume-slider-card-feature.ts b/src/panels/lovelace/card-features/hui-media-player-volume-slider-card-feature.ts index c330b6e1cb..6e8c08ada4 100644 --- a/src/panels/lovelace/card-features/hui-media-player-volume-slider-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-media-player-volume-slider-card-feature.ts @@ -4,7 +4,7 @@ import { computeDomain } from "../../../common/entity/compute_domain"; import { stateActive } from "../../../common/entity/state_active"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-slider"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import { MediaPlayerEntityFeature, type MediaPlayerEntity, diff --git a/src/panels/lovelace/card-features/hui-numeric-input-card-feature.ts b/src/panels/lovelace/card-features/hui-numeric-input-card-feature.ts index 37ca27bc74..e7cddffa11 100644 --- a/src/panels/lovelace/card-features/hui-numeric-input-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-numeric-input-card-feature.ts @@ -8,7 +8,7 @@ import "../../../components/ha-control-button-group"; import "../../../components/ha-control-number-buttons"; import "../../../components/ha-control-slider"; import "../../../components/ha-icon"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; diff --git a/src/panels/lovelace/card-features/hui-select-options-card-feature.ts b/src/panels/lovelace/card-features/hui-select-options-card-feature.ts index 7e14ca1740..a554b5cf01 100644 --- a/src/panels/lovelace/card-features/hui-select-options-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-select-options-card-feature.ts @@ -7,7 +7,7 @@ import { computeDomain } from "../../../common/entity/compute_domain"; import "../../../components/ha-control-select-menu"; import type { HaControlSelectMenu } from "../../../components/ha-control-select-menu"; import "../../../components/ha-list-item"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { InputSelectEntity } from "../../../data/input_select"; import type { SelectEntity } from "../../../data/select"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/lovelace/card-features/hui-target-humidity-card-feature.ts b/src/panels/lovelace/card-features/hui-target-humidity-card-feature.ts index 1bef28543d..830b38c04a 100644 --- a/src/panels/lovelace/card-features/hui-target-humidity-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-target-humidity-card-feature.ts @@ -3,7 +3,7 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; import "../../../components/ha-control-slider"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { HumidifierEntity } from "../../../data/humidifier"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature } from "../types"; diff --git a/src/panels/lovelace/card-features/hui-target-temperature-card-feature.ts b/src/panels/lovelace/card-features/hui-target-temperature-card-feature.ts index 1c7d763f93..dcb46abc57 100644 --- a/src/panels/lovelace/card-features/hui-target-temperature-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-target-temperature-card-feature.ts @@ -12,7 +12,7 @@ import "../../../components/ha-control-button-group"; import "../../../components/ha-control-number-buttons"; import type { ClimateEntity } from "../../../data/climate"; import { ClimateEntityFeature } from "../../../data/climate"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { WaterHeaterEntity } from "../../../data/water_heater"; import { WaterHeaterEntityFeature } from "../../../data/water_heater"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/lovelace/card-features/hui-toggle-card-feature.ts b/src/panels/lovelace/card-features/hui-toggle-card-feature.ts index 539d376fa7..cf40545879 100644 --- a/src/panels/lovelace/card-features/hui-toggle-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-toggle-card-feature.ts @@ -18,7 +18,7 @@ import { stateColorCss } from "../../../common/entity/state_color"; import "../../../components/ha-control-button"; import "../../../components/ha-control-button-group"; import "../../../components/ha-control-switch"; -import { UNAVAILABLE, UNKNOWN } from "../../../data/entity"; +import { UNAVAILABLE, UNKNOWN } from "../../../data/entity/entity"; import { forwardHaptic } from "../../../data/haptics"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature } from "../types"; diff --git a/src/panels/lovelace/card-features/hui-update-actions-card-feature.ts b/src/panels/lovelace/card-features/hui-update-actions-card-feature.ts index 6c62ac1a90..e6f2111096 100644 --- a/src/panels/lovelace/card-features/hui-update-actions-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-update-actions-card-feature.ts @@ -6,7 +6,7 @@ import { stateActive } from "../../../common/entity/state_active"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-button"; import "../../../components/ha-control-button-group"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { UpdateEntity } from "../../../data/update"; import { UpdateEntityFeature, updateIsInstalling } from "../../../data/update"; import { showUpdateBackupDialogParams } from "../../../dialogs/update_backup/show-update-backup-dialog"; diff --git a/src/panels/lovelace/card-features/hui-vacuum-commands-card-feature.ts b/src/panels/lovelace/card-features/hui-vacuum-commands-card-feature.ts index 7812dcf44b..45e6ac5aba 100644 --- a/src/panels/lovelace/card-features/hui-vacuum-commands-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-vacuum-commands-card-feature.ts @@ -15,7 +15,7 @@ import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-button"; import "../../../components/ha-control-button-group"; import "../../../components/ha-svg-icon"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { VacuumEntity } from "../../../data/vacuum"; import { VacuumEntityFeature, diff --git a/src/panels/lovelace/card-features/hui-valve-open-close-card-feature.ts b/src/panels/lovelace/card-features/hui-valve-open-close-card-feature.ts index 0912dd54bb..9034a0eeee 100644 --- a/src/panels/lovelace/card-features/hui-valve-open-close-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-valve-open-close-card-feature.ts @@ -1,14 +1,16 @@ import { mdiStop, mdiValveClosed, mdiValveOpen } from "@mdi/js"; -import { html, LitElement, nothing, css } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; import { computeDomain } from "../../../common/entity/compute_domain"; -import { supportsFeature } from "../../../common/entity/supports-feature"; import { stateColorCss } from "../../../common/entity/state_color"; +import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-button"; import "../../../components/ha-control-button-group"; +import "../../../components/ha-control-switch"; import "../../../components/ha-svg-icon"; +import { UNAVAILABLE, UNKNOWN } from "../../../data/entity/entity"; import { canClose, canOpen, @@ -16,15 +18,13 @@ import { ValveEntityFeature, type ValveEntity, } from "../../../data/valve"; -import { UNAVAILABLE, UNKNOWN } from "../../../data/entity"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; import type { - ValveOpenCloseCardFeatureConfig, LovelaceCardFeatureContext, + ValveOpenCloseCardFeatureConfig, } from "./types"; -import "../../../components/ha-control-switch"; export const supportsValveOpenCloseCardFeature = ( hass: HomeAssistant, diff --git a/src/panels/lovelace/card-features/hui-valve-position-card-feature.ts b/src/panels/lovelace/card-features/hui-valve-position-card-feature.ts index 9c7e87e7fe..f2f8a74caa 100644 --- a/src/panels/lovelace/card-features/hui-valve-position-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-valve-position-card-feature.ts @@ -8,15 +8,15 @@ import { stateActive } from "../../../common/entity/state_active"; import { stateColorCss } from "../../../common/entity/state_color"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-slider"; +import { UNAVAILABLE } from "../../../data/entity/entity"; +import { DOMAIN_ATTRIBUTES_UNITS } from "../../../data/entity/entity_attributes"; import { ValveEntityFeature, type ValveEntity } from "../../../data/valve"; -import { UNAVAILABLE } from "../../../data/entity"; -import { DOMAIN_ATTRIBUTES_UNITS } from "../../../data/entity_attributes"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; import type { - ValvePositionCardFeatureConfig, LovelaceCardFeatureContext, + ValvePositionCardFeatureConfig, } from "./types"; export const supportsValvePositionCardFeature = ( diff --git a/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts index fccd674b2d..5d12fdaacc 100644 --- a/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts @@ -11,22 +11,22 @@ import type { ControlSelectOption } from "../../../components/ha-control-select" import "../../../components/ha-control-select-menu"; import type { HaControlSelectMenu } from "../../../components/ha-control-select-menu"; import "../../../components/ha-list-item"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { OperationMode, WaterHeaterEntity, } from "../../../data/water_heater"; import { - computeOperationModeIcon, compareWaterHeaterOperationMode, + computeOperationModeIcon, } from "../../../data/water_heater"; -import { UNAVAILABLE } from "../../../data/entity"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; import { filterModes } from "./common/filter-modes"; import type { - WaterHeaterOperationModesCardFeatureConfig, LovelaceCardFeatureContext, + WaterHeaterOperationModesCardFeatureConfig, } from "./types"; export const supportsWaterHeaterOperationModesCardFeature = ( diff --git a/src/panels/lovelace/cards/hui-alarm-panel-card.ts b/src/panels/lovelace/cards/hui-alarm-panel-card.ts index 1c1c123524..a386575507 100644 --- a/src/panels/lovelace/cards/hui-alarm-panel-card.ts +++ b/src/panels/lovelace/cards/hui-alarm-panel-card.ts @@ -21,12 +21,12 @@ import { FORMAT_NUMBER, callAlarmAction, } from "../../../data/alarm_control_panel"; -import { UNAVAILABLE } from "../../../data/entity"; -import type { ExtEntityRegistryEntry } from "../../../data/entity_registry"; +import { UNAVAILABLE } from "../../../data/entity/entity"; +import type { ExtEntityRegistryEntry } from "../../../data/entity/entity_registry"; import { getExtendedEntityRegistryEntry, subscribeEntityRegistry, -} from "../../../data/entity_registry"; +} from "../../../data/entity/entity_registry"; import type { HomeAssistant } from "../../../types"; import { computeLovelaceEntityName } from "../common/entity/compute-lovelace-entity-name"; import { findEntities } from "../common/find-entities"; diff --git a/src/panels/lovelace/cards/hui-area-card.ts b/src/panels/lovelace/cards/hui-area-card.ts index e6df70d9e7..77ef3216e2 100644 --- a/src/panels/lovelace/cards/hui-area-card.ts +++ b/src/panels/lovelace/cards/hui-area-card.ts @@ -35,7 +35,7 @@ import "../../../components/ha-svg-icon"; import "../../../components/tile/ha-tile-badge"; import "../../../components/tile/ha-tile-icon"; import "../../../components/tile/ha-tile-info"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import "../card-features/hui-card-features"; import type { LovelaceCardFeatureContext } from "../card-features/types"; diff --git a/src/panels/lovelace/cards/hui-button-card.ts b/src/panels/lovelace/cards/hui-button-card.ts index 90804ba3aa..d0dd3e41d0 100644 --- a/src/panels/lovelace/cards/hui-button-card.ts +++ b/src/panels/lovelace/cards/hui-button-card.ts @@ -35,7 +35,7 @@ import { statesContext, themesContext, } from "../../../data/context"; -import type { EntityRegistryDisplayEntry } from "../../../data/entity_registry"; +import type { EntityRegistryDisplayEntry } from "../../../data/entity/entity_registry"; import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import type { FrontendLocaleData } from "../../../data/translation"; import type { Themes } from "../../../data/ws-themes"; diff --git a/src/panels/lovelace/cards/hui-entity-card.ts b/src/panels/lovelace/cards/hui-entity-card.ts index c8ae149d1a..bd14259143 100644 --- a/src/panels/lovelace/cards/hui-entity-card.ts +++ b/src/panels/lovelace/cards/hui-entity-card.ts @@ -23,7 +23,7 @@ import "../../../components/ha-attribute-value"; import "../../../components/ha-card"; import "../../../components/ha-icon"; import { CLIMATE_HVAC_ACTION_TO_MODE } from "../../../data/climate"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import { computeCardSize } from "../common/compute-card-size"; import { computeLovelaceEntityName } from "../common/entity/compute-lovelace-entity-name"; diff --git a/src/panels/lovelace/cards/hui-gauge-card.ts b/src/panels/lovelace/cards/hui-gauge-card.ts index 9a1ceb2bdf..28b8ee9368 100644 --- a/src/panels/lovelace/cards/hui-gauge-card.ts +++ b/src/panels/lovelace/cards/hui-gauge-card.ts @@ -10,7 +10,7 @@ import { isValidEntityId } from "../../../common/entity/valid_entity_id"; import { getNumberFormatOptions } from "../../../common/number/format_number"; import "../../../components/ha-card"; import "../../../components/ha-gauge"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; diff --git a/src/panels/lovelace/cards/hui-glance-card.ts b/src/panels/lovelace/cards/hui-glance-card.ts index f8aa4ece03..607740e52d 100644 --- a/src/panels/lovelace/cards/hui-glance-card.ts +++ b/src/panels/lovelace/cards/hui-glance-card.ts @@ -9,7 +9,7 @@ import "../../../components/entity/state-badge"; import "../../../components/ha-card"; import "../../../components/ha-icon"; import "../../../components/ha-relative-time"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import type { CallServiceActionConfig, diff --git a/src/panels/lovelace/cards/hui-light-card.ts b/src/panels/lovelace/cards/hui-light-card.ts index 72faf88b18..df3503862c 100644 --- a/src/panels/lovelace/cards/hui-light-card.ts +++ b/src/panels/lovelace/cards/hui-light-card.ts @@ -11,7 +11,7 @@ import { stateColorBrightness } from "../../../common/entity/state_color"; import "../../../components/ha-card"; import "../../../components/ha-icon-button"; import "../../../components/ha-state-icon"; -import { UNAVAILABLE, isUnavailableState } from "../../../data/entity"; +import { UNAVAILABLE, isUnavailableState } from "../../../data/entity/entity"; import type { LightEntity } from "../../../data/light"; import { lightSupportsBrightness } from "../../../data/light"; import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; diff --git a/src/panels/lovelace/cards/hui-media-control-card.ts b/src/panels/lovelace/cards/hui-media-control-card.ts index 1c7c0c32c1..af51692ea1 100644 --- a/src/panels/lovelace/cards/hui-media-control-card.ts +++ b/src/panels/lovelace/cards/hui-media-control-card.ts @@ -12,15 +12,16 @@ import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; import { fireEvent } from "../../../common/dom/fire_event"; +import { stateActive } from "../../../common/entity/state_active"; import { supportsFeature } from "../../../common/entity/supports-feature"; import { extractColors } from "../../../common/image/extract_color"; -import { stateActive } from "../../../common/entity/state_active"; import { debounce } from "../../../common/util/debounce"; import "../../../components/ha-card"; import "../../../components/ha-icon-button"; import "../../../components/ha-state-icon"; +import { showJoinMediaPlayersDialog } from "../../../components/media-player/show-join-media-players-dialog"; import { showMediaBrowserDialog } from "../../../components/media-player/show-media-browser-dialog"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { MediaPickedEvent, MediaPlayerEntity, @@ -42,7 +43,6 @@ import "../components/hui-marquee"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import type { LovelaceCard, LovelaceCardEditor } from "../types"; import type { MediaControlCardConfig } from "./types"; -import { showJoinMediaPlayersDialog } from "../../../components/media-player/show-join-media-players-dialog"; @customElement("hui-media-control-card") export class HuiMediaControlCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-todo-list-card.ts b/src/panels/lovelace/cards/hui-todo-list-card.ts index 5726c8e896..b6e5781e51 100644 --- a/src/panels/lovelace/cards/hui-todo-list-card.ts +++ b/src/panels/lovelace/cards/hui-todo-list-card.ts @@ -34,7 +34,7 @@ import "../../../components/ha-sortable"; import "../../../components/ha-svg-icon"; import "../../../components/ha-textfield"; import type { HaTextField } from "../../../components/ha-textfield"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { TodoItem } from "../../../data/todo"; import { TodoItemStatus, diff --git a/src/panels/lovelace/cards/hui-weather-forecast-card.ts b/src/panels/lovelace/cards/hui-weather-forecast-card.ts index abba75db84..770038daeb 100644 --- a/src/panels/lovelace/cards/hui-weather-forecast-card.ts +++ b/src/panels/lovelace/cards/hui-weather-forecast-card.ts @@ -2,19 +2,22 @@ import { ResizeController } from "@lit-labs/observers/resize-controller"; import type { CSSResultGroup, PropertyValues } from "lit"; import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { ifDefined } from "lit/directives/if-defined"; import { classMap } from "lit/directives/class-map"; +import { ifDefined } from "lit/directives/if-defined"; +import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { formatDateWeekdayShort } from "../../../common/datetime/format_date"; import { formatTime } from "../../../common/datetime/format_time"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; import { isValidEntityId } from "../../../common/entity/valid_entity_id"; import { formatNumber } from "../../../common/number/format_number"; +import { round } from "../../../common/number/round"; import "../../../components/ha-card"; import "../../../components/ha-svg-icon"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import type { ForecastEvent, WeatherEntity } from "../../../data/weather"; import { + WEATHER_TEMPERATURE_ATTRIBUTES, getForecast, getSecondaryWeatherAttribute, getWeatherStateIcon, @@ -23,10 +26,8 @@ import { subscribeForecast, weatherAttrIcons, weatherSVGStyles, - WEATHER_TEMPERATURE_ATTRIBUTES, } from "../../../data/weather"; import type { HomeAssistant } from "../../../types"; -import { round } from "../../../common/number/round"; import { actionHandler } from "../common/directives/action-handler-directive"; import { computeLovelaceEntityName } from "../common/entity/compute-lovelace-entity-name"; import { findEntities } from "../common/find-entities"; @@ -40,7 +41,6 @@ import type { LovelaceGridOptions, } from "../types"; import type { WeatherForecastCardConfig } from "./types"; -import { isComponentLoaded } from "../../../common/config/is_component_loaded"; @customElement("hui-weather-forecast-card") class HuiWeatherForecastCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/tile/badges/tile-badge.ts b/src/panels/lovelace/cards/tile/badges/tile-badge.ts index f4e2c152b3..4dcbaa996b 100644 --- a/src/panels/lovelace/cards/tile/badges/tile-badge.ts +++ b/src/panels/lovelace/cards/tile/badges/tile-badge.ts @@ -4,13 +4,13 @@ import type { TemplateResult } from "lit"; import { html, nothing } from "lit"; import { styleMap } from "lit/directives/style-map"; import { computeDomain } from "../../../../../common/entity/compute_domain"; -import { UNAVAILABLE, UNKNOWN } from "../../../../../data/entity"; +import "../../../../../components/ha-svg-icon"; +import "../../../../../components/tile/ha-tile-badge"; +import { UNAVAILABLE, UNKNOWN } from "../../../../../data/entity/entity"; import type { HomeAssistant } from "../../../../../types"; import { renderClimateBadge } from "./tile-badge-climate"; import { renderHumidifierBadge } from "./tile-badge-humidifier"; import { renderPersonBadge } from "./tile-badge-person"; -import "../../../../../components/tile/ha-tile-badge"; -import "../../../../../components/ha-svg-icon"; export type RenderBadgeFunction = ( stateObj: HassEntity, diff --git a/src/panels/lovelace/common/has-changed.ts b/src/panels/lovelace/common/has-changed.ts index 8f3005f6b1..814502743c 100644 --- a/src/panels/lovelace/common/has-changed.ts +++ b/src/panels/lovelace/common/has-changed.ts @@ -1,6 +1,6 @@ import type { HassEntity } from "home-assistant-js-websocket"; import type { PropertyValues } from "lit"; -import type { EntityRegistryDisplayEntry } from "../../../data/entity_registry"; +import type { EntityRegistryDisplayEntry } from "../../../data/entity/entity_registry"; import type { HomeAssistant } from "../../../types"; import { processConfigEntities } from "./process-config-entities"; diff --git a/src/panels/lovelace/common/validate-condition.ts b/src/panels/lovelace/common/validate-condition.ts index c782482b2b..39d239ef87 100644 --- a/src/panels/lovelace/common/validate-condition.ts +++ b/src/panels/lovelace/common/validate-condition.ts @@ -1,6 +1,3 @@ -import type { HomeAssistant } from "../../../types"; -import { UNKNOWN } from "../../../data/entity"; -import { getUserPerson } from "../../../data/person"; import { ensureArray } from "../../../common/array/ensure-array"; import { checkTimeInRange, @@ -11,6 +8,9 @@ import { type WeekdayShort, } from "../../../common/datetime/weekday"; import { isValidEntityId } from "../../../common/entity/valid_entity_id"; +import { UNKNOWN } from "../../../data/entity/entity"; +import { getUserPerson } from "../../../data/person"; +import type { HomeAssistant } from "../../../types"; export type Condition = | LocationCondition diff --git a/src/panels/lovelace/components/hui-entity-editor.ts b/src/panels/lovelace/components/hui-entity-editor.ts index 719ee263a7..f0d3fac445 100644 --- a/src/panels/lovelace/components/hui-entity-editor.ts +++ b/src/panels/lovelace/components/hui-entity-editor.ts @@ -9,7 +9,7 @@ import "../../../components/entity/ha-entity-picker"; import type { HaEntityPicker } from "../../../components/entity/ha-entity-picker"; import "../../../components/ha-icon-button"; import "../../../components/ha-sortable"; -import type { HaEntityPickerEntityFilterFunc } from "../../../data/entity"; +import type { HaEntityPickerEntityFilterFunc } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import type { EntityConfig } from "../entity-rows/types"; diff --git a/src/panels/lovelace/components/hui-image.ts b/src/panels/lovelace/components/hui-image.ts index 8027f19b05..9a4ee09702 100644 --- a/src/panels/lovelace/components/hui-image.ts +++ b/src/panels/lovelace/components/hui-image.ts @@ -11,14 +11,14 @@ import type { HaCameraStream } from "../../../components/ha-camera-stream"; import "../../../components/ha-spinner"; import type { CameraEntity } from "../../../data/camera"; import { fetchThumbnailUrlWithCache } from "../../../data/camera"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { ImageEntity } from "../../../data/image"; import { computeImageUrl } from "../../../data/image"; -import type { HomeAssistant } from "../../../types"; import { isMediaSourceContentId, resolveMediaSource, } from "../../../data/media_source"; +import type { HomeAssistant } from "../../../types"; const UPDATE_INTERVAL = 10000; const DEFAULT_FILTER = "grayscale(100%)"; diff --git a/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts b/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts index 9c594844a0..97a5887101 100644 --- a/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts +++ b/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts @@ -12,7 +12,7 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import { stringCompare } from "../../../../common/string/compare"; import "../../../../components/ha-spinner"; import "../../../../components/search-input"; -import { isUnavailableState } from "../../../../data/entity"; +import { isUnavailableState } from "../../../../data/entity/entity"; import type { LovelaceBadgeConfig } from "../../../../data/lovelace/config/badge"; import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; import type { CustomBadgeEntry } from "../../../../data/lovelace_custom_cards"; diff --git a/src/panels/lovelace/editor/card-editor/hui-card-picker.ts b/src/panels/lovelace/editor/card-editor/hui-card-picker.ts index 5dcfc152a9..ffcacfdc0c 100644 --- a/src/panels/lovelace/editor/card-editor/hui-card-picker.ts +++ b/src/panels/lovelace/editor/card-editor/hui-card-picker.ts @@ -11,7 +11,7 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import { stringCompare } from "../../../../common/string/compare"; import "../../../../components/ha-spinner"; import "../../../../components/search-input"; -import { isUnavailableState } from "../../../../data/entity"; +import { isUnavailableState } from "../../../../data/entity/entity"; import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; import type { CustomCardEntry } from "../../../../data/lovelace_custom_cards"; diff --git a/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts index 0beec32e2f..91ea146be2 100644 --- a/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts @@ -16,7 +16,7 @@ import { import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; -import { NON_NUMERIC_ATTRIBUTES } from "../../../../data/entity_attributes"; +import { NON_NUMERIC_ATTRIBUTES } from "../../../../data/entity/entity_attributes"; import type { HomeAssistant } from "../../../../types"; import { DEFAULT_MAX, DEFAULT_MIN } from "../../cards/hui-gauge-card"; import type { GaugeCardConfig } from "../../cards/types"; diff --git a/src/panels/lovelace/editor/config-elements/hui-logbook-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-logbook-card-editor.ts index 3f3de5881c..1c85112945 100644 --- a/src/panels/lovelace/editor/config-elements/hui-logbook-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-logbook-card-editor.ts @@ -16,7 +16,7 @@ import "../../../../components/entity/ha-entities-picker"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; import "../../../../components/ha-target-picker"; -import type { HaEntityPickerEntityFilterFunc } from "../../../../data/entity"; +import type { HaEntityPickerEntityFilterFunc } from "../../../../data/entity/entity"; import { filterLogbookCompatibleEntities } from "../../../../data/logbook"; import { targetStruct } from "../../../../data/script"; import { resolveEntityIDs } from "../../../../data/selector"; diff --git a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts index bd36aae1b9..46a7d1060d 100644 --- a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts @@ -16,7 +16,7 @@ import { supportsFeature } from "../../../../common/entity/supports-feature"; import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; -import { UNAVAILABLE } from "../../../../data/entity"; +import { UNAVAILABLE } from "../../../../data/entity/entity"; import type { ForecastType, WeatherEntity } from "../../../../data/weather"; import { WeatherEntityFeature } from "../../../../data/weather"; import type { HomeAssistant } from "../../../../types"; diff --git a/src/panels/lovelace/elements/hui-state-badge-element.ts b/src/panels/lovelace/elements/hui-state-badge-element.ts index c37bf1c0f8..89f2ddc54c 100644 --- a/src/panels/lovelace/elements/hui-state-badge-element.ts +++ b/src/panels/lovelace/elements/hui-state-badge-element.ts @@ -3,20 +3,20 @@ import type { PropertyValues } from "lit"; import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; -import { findEntities } from "../common/find-entities"; import { computeStateName } from "../../../common/entity/compute_state_name"; import "../../../components/entity/ha-state-label-badge"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; +import { findEntities } from "../common/find-entities"; import { handleAction } from "../common/handle-action"; import { hasAction } from "../common/has-action"; -import { isUnavailableState } from "../../../data/entity"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import "../components/hui-warning-element"; -import type { LovelaceElement, StateBadgeElementConfig } from "./types"; import type { LovelacePictureElementEditor } from "../types"; +import type { LovelaceElement, StateBadgeElementConfig } from "./types"; @customElement("hui-state-badge-element") export class HuiStateBadgeElement diff --git a/src/panels/lovelace/elements/hui-state-icon-element.ts b/src/panels/lovelace/elements/hui-state-icon-element.ts index f43e6e4c1b..4181c6dee7 100644 --- a/src/panels/lovelace/elements/hui-state-icon-element.ts +++ b/src/panels/lovelace/elements/hui-state-icon-element.ts @@ -4,7 +4,7 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import "../../../components/entity/state-badge"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import type { HomeAssistant } from "../../../types"; import { computeTooltip } from "../common/compute-tooltip"; diff --git a/src/panels/lovelace/elements/hui-state-label-element.ts b/src/panels/lovelace/elements/hui-state-label-element.ts index 3a19293423..0123af451e 100644 --- a/src/panels/lovelace/elements/hui-state-label-element.ts +++ b/src/panels/lovelace/elements/hui-state-label-element.ts @@ -3,7 +3,7 @@ import type { PropertyValues } from "lit"; import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import type { HomeAssistant } from "../../../types"; import { computeTooltip } from "../common/compute-tooltip"; diff --git a/src/panels/lovelace/entity-rows/hui-button-entity-row.ts b/src/panels/lovelace/entity-rows/hui-button-entity-row.ts index 4f1b792b66..4d3877a97a 100644 --- a/src/panels/lovelace/entity-rows/hui-button-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-button-entity-row.ts @@ -1,14 +1,14 @@ import type { PropertyValues } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { UNAVAILABLE } from "../../../data/entity"; +import "../../../components/ha-button"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; +import { confirmAction } from "../common/confirm-action"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; -import "../../../components/ha-button"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import type { ActionRowConfig, LovelaceRow } from "./types"; -import { confirmAction } from "../common/confirm-action"; @customElement("hui-button-entity-row") class HuiButtonEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-date-entity-row.ts b/src/panels/lovelace/entity-rows/hui-date-entity-row.ts index 6f964fb320..0a8554a618 100644 --- a/src/panels/lovelace/entity-rows/hui-date-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-date-entity-row.ts @@ -2,8 +2,8 @@ import type { PropertyValues, TemplateResult } from "lit"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-date-input"; -import { isUnavailableState, UNAVAILABLE } from "../../../data/entity"; import { setDateValue } from "../../../data/date"; +import { isUnavailableState, UNAVAILABLE } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; diff --git a/src/panels/lovelace/entity-rows/hui-datetime-entity-row.ts b/src/panels/lovelace/entity-rows/hui-datetime-entity-row.ts index 981f78b2e4..815942cef3 100644 --- a/src/panels/lovelace/entity-rows/hui-datetime-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-datetime-entity-row.ts @@ -5,13 +5,13 @@ import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-date-input"; import "../../../components/ha-time-input"; import { setDateTimeValue } from "../../../data/datetime"; -import { isUnavailableState, UNAVAILABLE } from "../../../data/entity"; +import { isUnavailableState, UNAVAILABLE } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; +import { computeLovelaceEntityName } from "../common/entity/compute-lovelace-entity-name"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import type { EntityConfig, LovelaceRow } from "./types"; -import { computeLovelaceEntityName } from "../common/entity/compute-lovelace-entity-name"; @customElement("hui-datetime-entity-row") class HuiInputDatetimeEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-event-entity-row.ts b/src/panels/lovelace/entity-rows/hui-event-entity-row.ts index 370ebda972..143cb72a58 100644 --- a/src/panels/lovelace/entity-rows/hui-event-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-event-entity-row.ts @@ -1,7 +1,7 @@ import type { PropertyValues } from "lit"; import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import type { HomeAssistant } from "../../../types"; import type { EntitiesCardEntityConfig } from "../cards/types"; diff --git a/src/panels/lovelace/entity-rows/hui-input-button-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-button-entity-row.ts index 297d16bc66..2831df8120 100644 --- a/src/panels/lovelace/entity-rows/hui-input-button-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-input-button-entity-row.ts @@ -1,11 +1,11 @@ import type { PropertyValues } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { UNAVAILABLE } from "../../../data/entity"; +import "../../../components/ha-button"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import { confirmAction } from "../common/confirm-action"; import { hasConfigOrEntityChanged } from "../common/has-changed"; -import "../../../components/ha-button"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import type { ActionRowConfig, LovelaceRow } from "./types"; diff --git a/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts index 53079da0e3..d058126b25 100644 --- a/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts @@ -3,7 +3,7 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-date-input"; import "../../../components/ha-time-input"; -import { isUnavailableState, UNKNOWN } from "../../../data/entity"; +import { isUnavailableState, UNKNOWN } from "../../../data/entity/entity"; import { setInputDateTimeValue, stateToIsoDateString, diff --git a/src/panels/lovelace/entity-rows/hui-input-number-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-number-entity-row.ts index ca093dd208..b781d22ab9 100644 --- a/src/panels/lovelace/entity-rows/hui-input-number-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-input-number-entity-row.ts @@ -4,7 +4,7 @@ import { customElement, property, state } from "lit/decorators"; import { debounce } from "../../../common/util/debounce"; import "../../../components/ha-slider"; import "../../../components/ha-textfield"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import { setValue } from "../../../data/input_text"; import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; diff --git a/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts index 49442a2ab0..dfd8f7ec8d 100644 --- a/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts @@ -4,7 +4,7 @@ import { customElement, property, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import "../../../components/ha-list-item"; import "../../../components/ha-select"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import { forwardHaptic } from "../../../data/haptics"; import type { InputSelectEntity } from "../../../data/input_select"; import { setInputSelectOption } from "../../../data/input_select"; diff --git a/src/panels/lovelace/entity-rows/hui-input-text-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-text-entity-row.ts index 9d4d596374..8d4568fd99 100644 --- a/src/panels/lovelace/entity-rows/hui-input-text-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-input-text-entity-row.ts @@ -2,7 +2,7 @@ import type { PropertyValues } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-textfield"; -import { isUnavailableState, UNAVAILABLE } from "../../../data/entity"; +import { isUnavailableState, UNAVAILABLE } from "../../../data/entity/entity"; import { setValue } from "../../../data/input_text"; import type { HomeAssistant } from "../../../types"; import { computeLovelaceEntityName } from "../common/entity/compute-lovelace-entity-name"; diff --git a/src/panels/lovelace/entity-rows/hui-lock-entity-row.ts b/src/panels/lovelace/entity-rows/hui-lock-entity-row.ts index f8f5b7848f..6bdbae83dd 100644 --- a/src/panels/lovelace/entity-rows/hui-lock-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-lock-entity-row.ts @@ -1,15 +1,15 @@ import type { PropertyValues } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { isUnavailableState } from "../../../data/entity"; +import "../../../components/ha-button"; +import { isUnavailableState } from "../../../data/entity/entity"; +import { callProtectedLockService } from "../../../data/lock"; import type { HomeAssistant } from "../../../types"; +import { confirmAction } from "../common/confirm-action"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import "../../../components/ha-button"; import type { ConfirmableRowConfig, LovelaceRow } from "./types"; -import { callProtectedLockService } from "../../../data/lock"; -import { confirmAction } from "../common/confirm-action"; @customElement("hui-lock-entity-row") class HuiLockEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-media-player-entity-row.ts b/src/panels/lovelace/entity-rows/hui-media-player-entity-row.ts index ab8c98816a..1e4e12553a 100644 --- a/src/panels/lovelace/entity-rows/hui-media-player-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-media-player-entity-row.ts @@ -20,7 +20,7 @@ import { supportsFeature } from "../../../common/entity/supports-feature"; import { debounce } from "../../../common/util/debounce"; import "../../../components/ha-icon-button"; import "../../../components/ha-slider"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { ControlButton, MediaPlayerEntity, diff --git a/src/panels/lovelace/entity-rows/hui-number-entity-row.ts b/src/panels/lovelace/entity-rows/hui-number-entity-row.ts index 3b95ef8c9e..c22f275d7c 100644 --- a/src/panels/lovelace/entity-rows/hui-number-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-number-entity-row.ts @@ -4,7 +4,7 @@ import { customElement, property, state } from "lit/decorators"; import { debounce } from "../../../common/util/debounce"; import "../../../components/ha-slider"; import "../../../components/ha-textfield"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import { setValue } from "../../../data/input_text"; import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; diff --git a/src/panels/lovelace/entity-rows/hui-scene-entity-row.ts b/src/panels/lovelace/entity-rows/hui-scene-entity-row.ts index ef8f56e608..0c29d52f9c 100644 --- a/src/panels/lovelace/entity-rows/hui-scene-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-scene-entity-row.ts @@ -3,14 +3,14 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/entity/ha-entity-toggle"; import "../../../components/ha-button"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import { activateScene } from "../../../data/scene"; import type { HomeAssistant } from "../../../types"; +import { confirmAction } from "../common/confirm-action"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import type { ActionRowConfig, LovelaceRow } from "./types"; -import { confirmAction } from "../common/confirm-action"; @customElement("hui-scene-entity-row") class HuiSceneEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-script-entity-row.ts b/src/panels/lovelace/entity-rows/hui-script-entity-row.ts index 1a23b21b7d..4839f01759 100644 --- a/src/panels/lovelace/entity-rows/hui-script-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-script-entity-row.ts @@ -1,17 +1,17 @@ import type { PropertyValues } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { isUnavailableState } from "../../../data/entity"; +import "../../../components/ha-button"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { ScriptEntity } from "../../../data/script"; import { canRun, hasScriptFields } from "../../../data/script"; +import { showMoreInfoDialog } from "../../../dialogs/more-info/show-ha-more-info-dialog"; import type { HomeAssistant } from "../../../types"; +import { confirmAction } from "../common/confirm-action"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import "../../../components/ha-button"; import type { ActionRowConfig, LovelaceRow } from "./types"; -import { showMoreInfoDialog } from "../../../dialogs/more-info/show-ha-more-info-dialog"; -import { confirmAction } from "../common/confirm-action"; @customElement("hui-script-entity-row") class HuiScriptEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-select-entity-row.ts b/src/panels/lovelace/entity-rows/hui-select-entity-row.ts index b2aff6eedd..99a1550383 100644 --- a/src/panels/lovelace/entity-rows/hui-select-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-select-entity-row.ts @@ -4,7 +4,7 @@ import { customElement, property, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import "../../../components/ha-list-item"; import "../../../components/ha-select"; -import { UNAVAILABLE } from "../../../data/entity"; +import { UNAVAILABLE } from "../../../data/entity/entity"; import { forwardHaptic } from "../../../data/haptics"; import type { SelectEntity } from "../../../data/select"; import { setSelectOption } from "../../../data/select"; diff --git a/src/panels/lovelace/entity-rows/hui-sensor-entity-row.ts b/src/panels/lovelace/entity-rows/hui-sensor-entity-row.ts index 8fb50ac831..2450c1d105 100644 --- a/src/panels/lovelace/entity-rows/hui-sensor-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-sensor-entity-row.ts @@ -1,7 +1,7 @@ import type { PropertyValues } from "lit"; import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import { SENSOR_DEVICE_CLASS_TIMESTAMP } from "../../../data/sensor"; import type { HomeAssistant } from "../../../types"; import type { EntitiesCardEntityConfig } from "../cards/types"; diff --git a/src/panels/lovelace/entity-rows/hui-text-entity-row.ts b/src/panels/lovelace/entity-rows/hui-text-entity-row.ts index a823535127..8f0f3c4d13 100644 --- a/src/panels/lovelace/entity-rows/hui-text-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-text-entity-row.ts @@ -2,15 +2,15 @@ import type { PropertyValues } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-textfield"; -import { isUnavailableState, UNAVAILABLE } from "../../../data/entity"; +import { isUnavailableState, UNAVAILABLE } from "../../../data/entity/entity"; import type { TextEntity } from "../../../data/text"; import { setValue } from "../../../data/text"; import type { HomeAssistant } from "../../../types"; +import { computeLovelaceEntityName } from "../common/entity/compute-lovelace-entity-name"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import type { EntityConfig, LovelaceRow } from "./types"; -import { computeLovelaceEntityName } from "../common/entity/compute-lovelace-entity-name"; @customElement("hui-text-entity-row") class HuiTextEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-time-entity-row.ts b/src/panels/lovelace/entity-rows/hui-time-entity-row.ts index b5050badf0..97bd1e7fb7 100644 --- a/src/panels/lovelace/entity-rows/hui-time-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-time-entity-row.ts @@ -2,14 +2,14 @@ import type { PropertyValues, TemplateResult } from "lit"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-date-input"; -import { isUnavailableState, UNAVAILABLE } from "../../../data/entity"; +import "../../../components/ha-time-input"; +import { isUnavailableState, UNAVAILABLE } from "../../../data/entity/entity"; import { setTimeValue } from "../../../data/time"; import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import type { EntityConfig, LovelaceRow } from "./types"; -import "../../../components/ha-time-input"; @customElement("hui-time-entity-row") class HuiTimeEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-toggle-entity-row.ts b/src/panels/lovelace/entity-rows/hui-toggle-entity-row.ts index 63ccda2389..a15c5ae2a2 100644 --- a/src/panels/lovelace/entity-rows/hui-toggle-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-toggle-entity-row.ts @@ -2,7 +2,7 @@ import type { PropertyValues } from "lit"; import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/entity/ha-entity-toggle"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; diff --git a/src/panels/lovelace/entity-rows/hui-valve-entity-row.ts b/src/panels/lovelace/entity-rows/hui-valve-entity-row.ts index d291fa2090..cebbbfc8ef 100644 --- a/src/panels/lovelace/entity-rows/hui-valve-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-valve-entity-row.ts @@ -2,7 +2,7 @@ import type { PropertyValues } from "lit"; import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/entity/ha-entity-toggle"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; diff --git a/src/panels/lovelace/entity-rows/hui-weather-entity-row.ts b/src/panels/lovelace/entity-rows/hui-weather-entity-row.ts index 5fd62a11fb..fefb83d161 100644 --- a/src/panels/lovelace/entity-rows/hui-weather-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-weather-entity-row.ts @@ -3,7 +3,7 @@ import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; -import { isUnavailableState } from "../../../data/entity"; +import { isUnavailableState } from "../../../data/entity/entity"; import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import type { ForecastEvent, WeatherEntity } from "../../../data/weather"; import { @@ -17,13 +17,13 @@ import { import type { HomeAssistant } from "../../../types"; import type { EntitiesCardEntityConfig } from "../cards/types"; import { actionHandler } from "../common/directives/action-handler-directive"; +import { computeLovelaceEntityName } from "../common/entity/compute-lovelace-entity-name"; import { handleAction } from "../common/handle-action"; import { hasAction, hasAnyAction } from "../common/has-action"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import type { LovelaceRow } from "./types"; -import { computeLovelaceEntityName } from "../common/entity/compute-lovelace-entity-name"; @customElement("hui-weather-entity-row") class HuiWeatherEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/media-browser/ha-bar-media-player.ts b/src/panels/media-browser/ha-bar-media-player.ts index cfb70a2140..338f0f2f7d 100644 --- a/src/panels/media-browser/ha-bar-media-player.ts +++ b/src/panels/media-browser/ha-bar-media-player.ts @@ -29,7 +29,7 @@ import "../../components/ha-slider"; import "../../components/ha-spinner"; import "../../components/ha-state-icon"; import "../../components/ha-svg-icon"; -import { UNAVAILABLE } from "../../data/entity"; +import { UNAVAILABLE } from "../../data/entity/entity"; import type { ControlButton, MediaPlayerEntity, diff --git a/src/panels/todo/ha-panel-todo.ts b/src/panels/todo/ha-panel-todo.ts index 060a343fac..e8346c2ab7 100644 --- a/src/panels/todo/ha-panel-todo.ts +++ b/src/panels/todo/ha-panel-todo.ts @@ -37,7 +37,7 @@ import "../../components/ha-state-icon"; import "../../components/ha-svg-icon"; import "../../components/ha-two-pane-top-app-bar-fixed"; import { deleteConfigEntry } from "../../data/config_entries"; -import { getExtendedEntityRegistryEntry } from "../../data/entity_registry"; +import { getExtendedEntityRegistryEntry } from "../../data/entity/entity_registry"; import { fetchIntegrationManifest } from "../../data/integration"; import type { LovelaceCardConfig } from "../../data/lovelace/config/card"; import { TodoListEntityFeature, getTodoLists } from "../../data/todo"; diff --git a/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts b/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts index 5c19d3dceb..debc08e1d2 100644 --- a/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts +++ b/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts @@ -16,7 +16,7 @@ import { ALARM_MODES, setProtectedAlarmControlPanelMode, } from "../../data/alarm_control_panel"; -import { UNAVAILABLE } from "../../data/entity"; +import { UNAVAILABLE } from "../../data/entity/entity"; import type { HomeAssistant } from "../../types"; @customElement("ha-state-control-alarm_control_panel-modes") diff --git a/src/state-control/climate/ha-state-control-climate-humidity.ts b/src/state-control/climate/ha-state-control-climate-humidity.ts index a6bfba7daa..142372db33 100644 --- a/src/state-control/climate/ha-state-control-climate-humidity.ts +++ b/src/state-control/climate/ha-state-control-climate-humidity.ts @@ -14,7 +14,7 @@ import "../../components/ha-outlined-icon-button"; import "../../components/ha-svg-icon"; import type { ClimateEntity } from "../../data/climate"; import { ClimateEntityFeature } from "../../data/climate"; -import { UNAVAILABLE } from "../../data/entity"; +import { UNAVAILABLE } from "../../data/entity/entity"; import { computeCssVariable } from "../../resources/css-variables"; import type { HomeAssistant } from "../../types"; import { diff --git a/src/state-control/climate/ha-state-control-climate-temperature.ts b/src/state-control/climate/ha-state-control-climate-temperature.ts index 8af23ed6a4..bb586564d3 100644 --- a/src/state-control/climate/ha-state-control-climate-temperature.ts +++ b/src/state-control/climate/ha-state-control-climate-temperature.ts @@ -22,7 +22,7 @@ import { CLIMATE_HVAC_ACTION_TO_MODE, ClimateEntityFeature, } from "../../data/climate"; -import { UNAVAILABLE } from "../../data/entity"; +import { UNAVAILABLE } from "../../data/entity/entity"; import type { HomeAssistant } from "../../types"; import { createStateControlCircularSliderController, diff --git a/src/state-control/cover/ha-state-control-cover-position.ts b/src/state-control/cover/ha-state-control-cover-position.ts index 7631b34747..0360690205 100644 --- a/src/state-control/cover/ha-state-control-cover-position.ts +++ b/src/state-control/cover/ha-state-control-cover-position.ts @@ -6,8 +6,8 @@ import { computeAttributeNameDisplay } from "../../common/entity/compute_attribu import { stateColorCss } from "../../common/entity/state_color"; import "../../components/ha-control-slider"; import type { CoverEntity } from "../../data/cover"; -import { UNAVAILABLE } from "../../data/entity"; -import { DOMAIN_ATTRIBUTES_UNITS } from "../../data/entity_attributes"; +import { UNAVAILABLE } from "../../data/entity/entity"; +import { DOMAIN_ATTRIBUTES_UNITS } from "../../data/entity/entity_attributes"; import type { HomeAssistant } from "../../types"; @customElement("ha-state-control-cover-position") diff --git a/src/state-control/cover/ha-state-control-cover-tilt-position.ts b/src/state-control/cover/ha-state-control-cover-tilt-position.ts index 8b180aefd6..8e03a8be47 100644 --- a/src/state-control/cover/ha-state-control-cover-tilt-position.ts +++ b/src/state-control/cover/ha-state-control-cover-tilt-position.ts @@ -6,8 +6,8 @@ import { computeAttributeNameDisplay } from "../../common/entity/compute_attribu import { stateColorCss } from "../../common/entity/state_color"; import "../../components/ha-control-slider"; import type { CoverEntity } from "../../data/cover"; -import { UNAVAILABLE } from "../../data/entity"; -import { DOMAIN_ATTRIBUTES_UNITS } from "../../data/entity_attributes"; +import { UNAVAILABLE } from "../../data/entity/entity"; +import { DOMAIN_ATTRIBUTES_UNITS } from "../../data/entity/entity_attributes"; import type { HomeAssistant } from "../../types"; export function generateTiltSliderTrackBackgroundGradient() { diff --git a/src/state-control/cover/ha-state-control-cover-toggle.ts b/src/state-control/cover/ha-state-control-cover-toggle.ts index 6b6ff617f2..8f3cfda0bd 100644 --- a/src/state-control/cover/ha-state-control-cover-toggle.ts +++ b/src/state-control/cover/ha-state-control-cover-toggle.ts @@ -8,7 +8,7 @@ import { stateColorCss } from "../../common/entity/state_color"; import "../../components/ha-control-button"; import "../../components/ha-control-switch"; import "../../components/ha-state-icon"; -import { UNAVAILABLE, UNKNOWN } from "../../data/entity"; +import { UNAVAILABLE, UNKNOWN } from "../../data/entity/entity"; import { forwardHaptic } from "../../data/haptics"; import { stateControlToggleStyle } from "../../resources/state-control-styles"; import type { HomeAssistant } from "../../types"; diff --git a/src/state-control/fan/ha-state-control-fan-speed.ts b/src/state-control/fan/ha-state-control-fan-speed.ts index ae5e9b044f..50f59f9087 100644 --- a/src/state-control/fan/ha-state-control-fan-speed.ts +++ b/src/state-control/fan/ha-state-control-fan-speed.ts @@ -7,8 +7,8 @@ import { stateColorCss } from "../../common/entity/state_color"; import "../../components/ha-control-select"; import type { ControlSelectOption } from "../../components/ha-control-select"; import "../../components/ha-control-slider"; -import { UNAVAILABLE } from "../../data/entity"; -import { DOMAIN_ATTRIBUTES_UNITS } from "../../data/entity_attributes"; +import { UNAVAILABLE } from "../../data/entity/entity"; +import { DOMAIN_ATTRIBUTES_UNITS } from "../../data/entity/entity_attributes"; import type { FanEntity, FanSpeed } from "../../data/fan"; import { computeFanSpeedCount, diff --git a/src/state-control/ha-state-control-toggle.ts b/src/state-control/ha-state-control-toggle.ts index 367143d54c..3f1a227a60 100644 --- a/src/state-control/ha-state-control-toggle.ts +++ b/src/state-control/ha-state-control-toggle.ts @@ -10,7 +10,7 @@ import { stateActive } from "../common/entity/state_active"; import { stateColorCss } from "../common/entity/state_color"; import "../components/ha-control-button"; import "../components/ha-control-switch"; -import { UNAVAILABLE, UNKNOWN } from "../data/entity"; +import { UNAVAILABLE, UNKNOWN } from "../data/entity/entity"; import { forwardHaptic } from "../data/haptics"; import { stateControlToggleStyle } from "../resources/state-control-styles"; import type { HomeAssistant } from "../types"; diff --git a/src/state-control/humidifier/ha-state-control-humidifier-humidity.ts b/src/state-control/humidifier/ha-state-control-humidifier-humidity.ts index 3072710d2c..69b46ae97d 100644 --- a/src/state-control/humidifier/ha-state-control-humidifier-humidity.ts +++ b/src/state-control/humidifier/ha-state-control-humidifier-humidity.ts @@ -11,8 +11,8 @@ import "../../components/ha-big-number"; import "../../components/ha-control-circular-slider"; import "../../components/ha-outlined-icon-button"; import "../../components/ha-svg-icon"; -import { UNAVAILABLE } from "../../data/entity"; -import { DOMAIN_ATTRIBUTES_UNITS } from "../../data/entity_attributes"; +import { UNAVAILABLE } from "../../data/entity/entity"; +import { DOMAIN_ATTRIBUTES_UNITS } from "../../data/entity/entity_attributes"; import type { HumidifierEntity } from "../../data/humidifier"; import { HUMIDIFIER_ACTION_MODE, diff --git a/src/state-control/light/ha-state-control-light-brightness.ts b/src/state-control/light/ha-state-control-light-brightness.ts index 6ea8741b30..013162e530 100644 --- a/src/state-control/light/ha-state-control-light-brightness.ts +++ b/src/state-control/light/ha-state-control-light-brightness.ts @@ -6,7 +6,7 @@ import { hsv2rgb, rgb2hex, rgb2hsv } from "../../common/color/convert-color"; import { stateActive } from "../../common/entity/state_active"; import { stateColorCss } from "../../common/entity/state_color"; import "../../components/ha-control-slider"; -import { UNAVAILABLE } from "../../data/entity"; +import { UNAVAILABLE } from "../../data/entity/entity"; import type { LightEntity } from "../../data/light"; import type { HomeAssistant } from "../../types"; diff --git a/src/state-control/lock/ha-state-control-lock-toggle.ts b/src/state-control/lock/ha-state-control-lock-toggle.ts index 9c6d0c9f19..eef8392a63 100644 --- a/src/state-control/lock/ha-state-control-lock-toggle.ts +++ b/src/state-control/lock/ha-state-control-lock-toggle.ts @@ -8,13 +8,13 @@ import { stateColorCss } from "../../common/entity/state_color"; import "../../components/ha-control-button"; import "../../components/ha-control-switch"; import "../../components/ha-state-icon"; -import { UNAVAILABLE, UNKNOWN } from "../../data/entity"; +import { UNAVAILABLE, UNKNOWN } from "../../data/entity/entity"; import { forwardHaptic } from "../../data/haptics"; import type { LockEntity } from "../../data/lock"; import { callProtectedLockService } from "../../data/lock"; import { - stateControlToggleStyle, stateControlPulseStyle, + stateControlToggleStyle, } from "../../resources/state-control-styles"; import type { HomeAssistant } from "../../types"; diff --git a/src/state-control/valve/ha-state-control-valve-position.ts b/src/state-control/valve/ha-state-control-valve-position.ts index 1bbcac32b7..9b15c7edf8 100644 --- a/src/state-control/valve/ha-state-control-valve-position.ts +++ b/src/state-control/valve/ha-state-control-valve-position.ts @@ -6,8 +6,8 @@ import { computeAttributeNameDisplay } from "../../common/entity/compute_attribu import { stateColorCss } from "../../common/entity/state_color"; import "../../components/ha-control-slider"; import type { CoverEntity } from "../../data/cover"; -import { UNAVAILABLE } from "../../data/entity"; -import { DOMAIN_ATTRIBUTES_UNITS } from "../../data/entity_attributes"; +import { UNAVAILABLE } from "../../data/entity/entity"; +import { DOMAIN_ATTRIBUTES_UNITS } from "../../data/entity/entity_attributes"; import type { HomeAssistant } from "../../types"; @customElement("ha-state-control-valve-position") diff --git a/src/state-control/valve/ha-state-control-valve-toggle.ts b/src/state-control/valve/ha-state-control-valve-toggle.ts index 4bd6717ce3..8257fc908e 100644 --- a/src/state-control/valve/ha-state-control-valve-toggle.ts +++ b/src/state-control/valve/ha-state-control-valve-toggle.ts @@ -8,7 +8,7 @@ import { stateColorCss } from "../../common/entity/state_color"; import "../../components/ha-control-button"; import "../../components/ha-control-switch"; import "../../components/ha-state-icon"; -import { UNAVAILABLE, UNKNOWN } from "../../data/entity"; +import { UNAVAILABLE, UNKNOWN } from "../../data/entity/entity"; import { forwardHaptic } from "../../data/haptics"; import { stateControlToggleStyle } from "../../resources/state-control-styles"; import type { HomeAssistant } from "../../types"; diff --git a/src/state-control/water_heater/ha-state-control-water_heater-temperature.ts b/src/state-control/water_heater/ha-state-control-water_heater-temperature.ts index 0bad74a565..bd44686217 100644 --- a/src/state-control/water_heater/ha-state-control-water_heater-temperature.ts +++ b/src/state-control/water_heater/ha-state-control-water_heater-temperature.ts @@ -13,7 +13,7 @@ import "../../components/ha-big-number"; import "../../components/ha-control-circular-slider"; import "../../components/ha-outlined-icon-button"; import "../../components/ha-svg-icon"; -import { UNAVAILABLE } from "../../data/entity"; +import { UNAVAILABLE } from "../../data/entity/entity"; import type { WaterHeaterEntity } from "../../data/water_heater"; import { WaterHeaterEntityFeature } from "../../data/water_heater"; import type { HomeAssistant } from "../../types"; diff --git a/src/state-display/state-display.ts b/src/state-display/state-display.ts index a112024d0a..d7a2216e13 100644 --- a/src/state-display/state-display.ts +++ b/src/state-display/state-display.ts @@ -6,7 +6,7 @@ import { join } from "lit/directives/join"; import { ensureArray } from "../common/array/ensure-array"; import { computeStateDomain } from "../common/entity/compute_state_domain"; import "../components/ha-relative-time"; -import { isUnavailableState } from "../data/entity"; +import { isUnavailableState } from "../data/entity/entity"; import { SENSOR_DEVICE_CLASS_TIMESTAMP } from "../data/sensor"; import type { UpdateEntity } from "../data/update"; import { computeUpdateStateDisplay } from "../data/update"; diff --git a/src/state-summary/state-card-button.ts b/src/state-summary/state-card-button.ts index b9f9fbbec7..8e521092ea 100644 --- a/src/state-summary/state-card-button.ts +++ b/src/state-summary/state-card-button.ts @@ -5,7 +5,7 @@ import { customElement, property } from "lit/decorators"; import "../components/entity/ha-entity-toggle"; import "../components/entity/state-info"; import "../components/ha-button"; -import { UNAVAILABLE } from "../data/entity"; +import { UNAVAILABLE } from "../data/entity/entity"; import { haStyle } from "../resources/styles"; import type { HomeAssistant } from "../types"; diff --git a/src/state-summary/state-card-display.ts b/src/state-summary/state-card-display.ts index 3928af0742..ecd47d5eee 100755 --- a/src/state-summary/state-card-display.ts +++ b/src/state-summary/state-card-display.ts @@ -5,7 +5,7 @@ import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { computeDomain } from "../common/entity/compute_domain"; import "../components/entity/state-info"; -import { isUnavailableState } from "../data/entity"; +import { isUnavailableState } from "../data/entity/entity"; import { SENSOR_DEVICE_CLASS_TIMESTAMP } from "../data/sensor"; import "../panels/lovelace/components/hui-timestamp-display"; import { haStyle } from "../resources/styles"; diff --git a/src/state-summary/state-card-input_button.ts b/src/state-summary/state-card-input_button.ts index 5e8f460a47..d9453d359c 100644 --- a/src/state-summary/state-card-input_button.ts +++ b/src/state-summary/state-card-input_button.ts @@ -5,7 +5,7 @@ import { customElement, property } from "lit/decorators"; import "../components/entity/ha-entity-toggle"; import "../components/entity/state-info"; import "../components/ha-button"; -import { UNAVAILABLE } from "../data/entity"; +import { UNAVAILABLE } from "../data/entity/entity"; import { haStyle } from "../resources/styles"; import type { HomeAssistant } from "../types"; diff --git a/src/state-summary/state-card-input_number.ts b/src/state-summary/state-card-input_number.ts index 39497ead04..c6e1227d47 100644 --- a/src/state-summary/state-card-input_number.ts +++ b/src/state-summary/state-card-input_number.ts @@ -6,7 +6,7 @@ import { debounce } from "../common/util/debounce"; import "../components/entity/state-info"; import "../components/ha-slider"; import "../components/ha-textfield"; -import { isUnavailableState } from "../data/entity"; +import { isUnavailableState } from "../data/entity/entity"; import { setValue } from "../data/input_text"; import type { HomeAssistant } from "../types"; diff --git a/src/state-summary/state-card-input_select.ts b/src/state-summary/state-card-input_select.ts index d08fdccc1f..ca0d063ad1 100644 --- a/src/state-summary/state-card-input_select.ts +++ b/src/state-summary/state-card-input_select.ts @@ -6,7 +6,7 @@ import { computeStateName } from "../common/entity/compute_state_name"; import "../components/entity/state-badge"; import "../components/ha-list-item"; import "../components/ha-select"; -import { UNAVAILABLE } from "../data/entity"; +import { UNAVAILABLE } from "../data/entity/entity"; import type { InputSelectEntity } from "../data/input_select"; import { setInputSelectOption } from "../data/input_select"; import type { HomeAssistant } from "../types"; diff --git a/src/state-summary/state-card-number.ts b/src/state-summary/state-card-number.ts index c722127846..38c1be6a73 100644 --- a/src/state-summary/state-card-number.ts +++ b/src/state-summary/state-card-number.ts @@ -2,13 +2,13 @@ import type { HassEntity } from "home-assistant-js-websocket"; import type { CSSResultGroup } from "lit"; import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; +import { debounce } from "../common/util/debounce"; import "../components/entity/state-info"; import "../components/ha-slider"; import "../components/ha-textfield"; -import type { HomeAssistant } from "../types"; +import { isUnavailableState } from "../data/entity/entity"; import { haStyle } from "../resources/styles"; -import { isUnavailableState } from "../data/entity"; -import { debounce } from "../common/util/debounce"; +import type { HomeAssistant } from "../types"; @customElement("state-card-number") class StateCardNumber extends LitElement { diff --git a/src/state-summary/state-card-script.ts b/src/state-summary/state-card-script.ts index ce9ae87b70..4d307831c1 100644 --- a/src/state-summary/state-card-script.ts +++ b/src/state-summary/state-card-script.ts @@ -5,12 +5,12 @@ import { customElement, property } from "lit/decorators"; import "../components/entity/ha-entity-toggle"; import "../components/entity/state-info"; import "../components/ha-button"; -import { isUnavailableState } from "../data/entity"; +import { isUnavailableState } from "../data/entity/entity"; import type { ScriptEntity } from "../data/script"; import { canRun, hasScriptFields } from "../data/script"; +import { showMoreInfoDialog } from "../dialogs/more-info/show-ha-more-info-dialog"; import { haStyle } from "../resources/styles"; import type { HomeAssistant } from "../types"; -import { showMoreInfoDialog } from "../dialogs/more-info/show-ha-more-info-dialog"; @customElement("state-card-script") class StateCardScript extends LitElement { diff --git a/src/state-summary/state-card-select.ts b/src/state-summary/state-card-select.ts index 9027a17100..956454e5f2 100644 --- a/src/state-summary/state-card-select.ts +++ b/src/state-summary/state-card-select.ts @@ -6,7 +6,7 @@ import { computeStateName } from "../common/entity/compute_state_name"; import "../components/entity/state-badge"; import "../components/ha-list-item"; import "../components/ha-select"; -import { UNAVAILABLE } from "../data/entity"; +import { UNAVAILABLE } from "../data/entity/entity"; import type { SelectEntity } from "../data/select"; import { setSelectOption } from "../data/select"; import type { HomeAssistant } from "../types"; diff --git a/src/state-summary/state-card-text.ts b/src/state-summary/state-card-text.ts index e7b45da80f..17493a1e9d 100644 --- a/src/state-summary/state-card-text.ts +++ b/src/state-summary/state-card-text.ts @@ -1,11 +1,11 @@ -import "../components/ha-textfield"; import type { TemplateResult } from "lit"; import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { computeStateName } from "../common/entity/compute_state_name"; import { stopPropagation } from "../common/dom/stop_propagation"; +import { computeStateName } from "../common/entity/compute_state_name"; import "../components/entity/state-badge"; -import { isUnavailableState, UNAVAILABLE } from "../data/entity"; +import "../components/ha-textfield"; +import { isUnavailableState, UNAVAILABLE } from "../data/entity/entity"; import type { TextEntity } from "../data/text"; import { setValue } from "../data/text"; import type { HomeAssistant } from "../types"; diff --git a/src/state/connection-mixin.ts b/src/state/connection-mixin.ts index b8ca0c31a0..c89d43f75a 100644 --- a/src/state/connection-mixin.ts +++ b/src/state/connection-mixin.ts @@ -12,7 +12,7 @@ import { computeStateName } from "../common/entity/compute_state_name"; import { promiseTimeout } from "../common/util/promise-timeout"; import { subscribeAreaRegistry } from "../data/area_registry"; import { broadcastConnectionStatus } from "../data/connection-status"; -import { subscribeDeviceRegistry } from "../data/device_registry"; +import { subscribeDeviceRegistry } from "../data/device/device_registry"; import { subscribeFrontendSystemData, subscribeFrontendUserData, diff --git a/src/state/context-mixin.ts b/src/state/context-mixin.ts index 29094e98ed..7f90fb0930 100644 --- a/src/state/context-mixin.ts +++ b/src/state/context-mixin.ts @@ -17,7 +17,7 @@ import { userContext, userDataContext, } from "../data/context"; -import { subscribeLabelRegistry } from "../data/label_registry"; +import { subscribeLabelRegistry } from "../data/label/label_registry"; import type { Constructor, HomeAssistant } from "../types"; import type { HassBaseEl } from "./hass-base-mixin"; diff --git a/src/types.ts b/src/types.ts index b542d6f410..64fef3388b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -15,8 +15,8 @@ import type { } from "./common/entity/compute_entity_name_display"; import type { LocalizeFunc } from "./common/translations/localize"; import type { AreaRegistryEntry } from "./data/area_registry"; -import type { DeviceRegistryEntry } from "./data/device_registry"; -import type { EntityRegistryDisplayEntry } from "./data/entity_registry"; +import type { DeviceRegistryEntry } from "./data/device/device_registry"; +import type { EntityRegistryDisplayEntry } from "./data/entity/entity_registry"; import type { FloorRegistryEntry } from "./data/floor_registry"; import type { CoreFrontendSystemData, diff --git a/test/common/entity/compute_state_display.test.ts b/test/common/entity/compute_state_display.test.ts index 05934c5ba2..b1faa1c8a0 100644 --- a/test/common/entity/compute_state_display.test.ts +++ b/test/common/entity/compute_state_display.test.ts @@ -1,20 +1,20 @@ import type { HassConfig } from "home-assistant-js-websocket"; -import { assert, describe, it, beforeEach, expect } from "vitest"; +import { assert, beforeEach, describe, expect, it } from "vitest"; import { computeStateDisplay, computeStateDisplayFromEntityAttributes, } from "../../../src/common/entity/compute_state_display"; -import { UNKNOWN } from "../../../src/data/entity"; +import { UNKNOWN } from "../../../src/data/entity/entity"; +import type { EntityRegistryDisplayEntry } from "../../../src/data/entity/entity_registry"; import type { FrontendLocaleData } from "../../../src/data/translation"; import { + DateFormat, + FirstWeekday, NumberFormat, TimeFormat, - FirstWeekday, - DateFormat, TimeZone, } from "../../../src/data/translation"; import { demoConfig } from "../../../src/fake_data/demo_config"; -import type { EntityRegistryDisplayEntry } from "../../../src/data/entity_registry"; let localeData: FrontendLocaleData; diff --git a/test/common/entity/context/context-mock.ts b/test/common/entity/context/context-mock.ts index 1f38f26c56..e662d22bd5 100644 --- a/test/common/entity/context/context-mock.ts +++ b/test/common/entity/context/context-mock.ts @@ -1,10 +1,10 @@ import type { HassEntity } from "home-assistant-js-websocket"; import type { AreaRegistryEntry } from "../../../../src/data/area_registry"; -import type { DeviceRegistryEntry } from "../../../../src/data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../src/data/device/device_registry"; import type { EntityRegistryDisplayEntry, EntityRegistryEntry, -} from "../../../../src/data/entity_registry"; +} from "../../../../src/data/entity/entity_registry"; import type { FloorRegistryEntry } from "../../../../src/data/floor_registry"; export const mockStateObj = (partial: Partial): HassEntity => ({ diff --git a/test/common/entity/delete_entity.test.ts b/test/common/entity/delete_entity.test.ts index 58f645990d..b9809fe539 100644 --- a/test/common/entity/delete_entity.test.ts +++ b/test/common/entity/delete_entity.test.ts @@ -1,13 +1,13 @@ -import { describe, it, expect, vi } from "vitest"; +import { describe, expect, it, vi } from "vitest"; import { - isDeletableEntity, deleteEntity, + isDeletableEntity, } from "../../../src/common/entity/delete_entity"; -import type { HomeAssistant } from "../../../src/types"; -import type { EntityRegistryEntry } from "../../../src/data/entity_registry"; -import type { IntegrationManifest } from "../../../src/data/integration"; import type { ConfigEntry } from "../../../src/data/config_entries"; +import type { EntityRegistryEntry } from "../../../src/data/entity/entity_registry"; +import type { IntegrationManifest } from "../../../src/data/integration"; import type { Helper } from "../../../src/panels/config/helpers/const"; +import type { HomeAssistant } from "../../../src/types"; describe("isDeletableEntity", () => { it("should return true for restored entities", () => {