Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 41 additions & 11 deletions src/panels/config/entities/entity-registry-settings.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "@material/mwc-formfield/mwc-formfield";
import "../../../components/ha-radio";
import "@material/mwc-button/mwc-button";
import "@material/mwc-formfield/mwc-formfield";
import "@material/mwc-list/mwc-list-item";
import { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket";
import {
Expand All @@ -20,9 +19,15 @@ import "../../../components/ha-alert";
import "../../../components/ha-area-picker";
import "../../../components/ha-expansion-panel";
import "../../../components/ha-icon-picker";
import "../../../components/ha-radio";
import "../../../components/ha-select";
import "../../../components/ha-switch";
import "../../../components/ha-textfield";
import {
ConfigEntry,
deleteConfigEntry,
getConfigEntries,
} from "../../../data/config_entries";
import {
DeviceRegistryEntry,
subscribeDeviceRegistry,
Expand All @@ -34,6 +39,7 @@ import {
removeEntityRegistryEntry,
updateEntityRegistryEntry,
} from "../../../data/entity_registry";
import { showOptionsFlowDialog } from "../../../dialogs/config-flow/show-dialog-options-flow";
import {
showAlertDialog,
showConfirmationDialog,
Expand All @@ -42,12 +48,6 @@ import { SubscribeMixin } from "../../../mixins/subscribe-mixin";
import { haStyle } from "../../../resources/styles";
import type { HomeAssistant } from "../../../types";
import { showDeviceRegistryDetailDialog } from "../devices/device-registry-detail/show-dialog-device-registry-detail";
import {
ConfigEntry,
deleteConfigEntry,
getConfigEntries,
} from "../../../data/config_entries";
import { showOptionsFlowDialog } from "../../../dialogs/config-flow/show-dialog-options-flow";

const OVERRIDE_DEVICE_CLASSES = {
cover: [
Expand All @@ -62,7 +62,36 @@ const OVERRIDE_DEVICE_CLASSES = {
"shutter",
"window",
],
binary_sensor: ["window", "door", "garage_door", "opening"],
binary_sensor: [
Comment thread
zsarnett marked this conversation as resolved.
"battery",
"battery_charging",
"carbon_monoxide",
"cold",
"connectivity",
"door",
"garage_door",
"gas",
"heat",
"light",
"lock",
"moisture",
"motion",
"moving",
"occupancy",
"opening",
"plug",
"power",
"presence",
"problem",
"running",
"safety",
"smoke",
"sound",
"tamper",
"update",
"vibration",
"window",
],
};

@customElement("entity-registry-settings")
Expand Down Expand Up @@ -197,8 +226,9 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
: undefined}
.disabled=${this._submitting}
></ha-icon-picker>
${OVERRIDE_DEVICE_CLASSES[domain]?.includes(this._deviceClass) ||
(domain === "cover" && this.entry.original_device_class === null)
${OVERRIDE_DEVICE_CLASSES[domain] &&
(OVERRIDE_DEVICE_CLASSES[domain].includes(this._deviceClass) ||
this.entry.original_device_class === null)
? html`<ha-select
.label=${this.hass.localize(
"ui.dialogs.entity_registry.editor.device_class"
Expand Down
26 changes: 25 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,31 @@
"door": "Door",
"garage_door": "Garage door",
"window": "Window",
"opening": "Other"
"opening": "Other",
Comment thread
zsarnett marked this conversation as resolved.
Outdated
"battery": "Battery",
"battery_charging": "Battery charging",
"carbon_monoxide": "Carbon monoxide",
"cold": "Cold",
"connectivity": "Connectivity",
"gas": "Gas",
"heat": "Heat",
"light": "Light",
"lock": "Lock",
"moisture": "Moisture",
"motion": "Motion",
"moving": "Moving",
"occupancy": "Occupancy",
"plug": "Plug",
"power": "Power",
"presence": "Presence",
"problem": "Problem",
"running": "Running",
"safety": "Safety",
"smoke": "Smoke",
"sound": "Sound",
"tamper": "Tamper",
"update": "Update",
"vibration": "Vibration"
},
"cover": {
"door": "Door",
Expand Down