View the status of a node and manage its configuration.
diff --git a/src/panels/config/integrations/integration-panels/ozw/ozw-node-router.ts b/src/panels/config/integrations/integration-panels/ozw/ozw-node-router.ts
index f09357928e..45a922f8b7 100644
--- a/src/panels/config/integrations/integration-panels/ozw/ozw-node-router.ts
+++ b/src/panels/config/integrations/integration-panels/ozw/ozw-node-router.ts
@@ -11,20 +11,18 @@ import { HomeAssistant } from "../../../../../types";
export const ozwNodeTabs = (
instance: number,
node: number
-): PageNavigation[] => {
- return [
- {
- translationKey: "ui.panel.config.ozw.navigation.node.dashboard",
- path: `/config/ozw/network/${instance}/node/${node}/dashboard`,
- iconPath: mdiNetwork,
- },
- {
- translationKey: "ui.panel.config.ozw.navigation.node.config",
- path: `/config/ozw/network/${instance}/node/${node}/config`,
- iconPath: mdiWrench,
- },
- ];
-};
+): PageNavigation[] => [
+ {
+ translationKey: "ui.panel.config.ozw.navigation.node.dashboard",
+ path: `/config/ozw/network/${instance}/node/${node}/dashboard`,
+ iconPath: mdiNetwork,
+ },
+ {
+ translationKey: "ui.panel.config.ozw.navigation.node.config",
+ path: `/config/ozw/network/${instance}/node/${node}/config`,
+ iconPath: mdiWrench,
+ },
+];
@customElement("ozw-node-router")
class OZWNodeRouter extends HassRouterPage {
diff --git a/src/panels/config/integrations/integration-panels/zha/functions.ts b/src/panels/config/integrations/integration-panels/zha/functions.ts
index 7715d0badc..dd892df867 100644
--- a/src/panels/config/integrations/integration-panels/zha/functions.ts
+++ b/src/panels/config/integrations/integration-panels/zha/functions.ts
@@ -23,8 +23,7 @@ export const sortZHAGroups = (a: ZHAGroup, b: ZHAGroup): number => {
return nameA.localeCompare(nameb);
};
-export const computeClusterKey = (cluster: Cluster): string => {
- return `${cluster.name} (Endpoint id: ${
+export const computeClusterKey = (cluster: Cluster): string =>
+ `${cluster.name} (Endpoint id: ${
cluster.endpoint_id
}, Id: ${formatAsPaddedHex(cluster.id)}, Type: ${cluster.type})`;
-};
diff --git a/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts b/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts
index 7727d50593..2ef7ed2784 100644
--- a/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts
+++ b/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts
@@ -206,9 +206,7 @@ export class ZHAClusterAttributes extends LitElement {
this.selectedCluster!.id,
this.selectedCluster!.type
);
- this._attributes.sort((a, b) => {
- return a.name.localeCompare(b.name);
- });
+ this._attributes.sort((a, b) => a.name.localeCompare(b.name));
}
}
diff --git a/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts b/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts
index 994071a6a4..f66f398148 100644
--- a/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts
+++ b/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts
@@ -171,9 +171,7 @@ export class ZHAClusterCommands extends LitElement {
this.selectedCluster!.id,
this.selectedCluster!.type
);
- this._commands.sort((a, b) => {
- return a.name.localeCompare(b.name);
- });
+ this._commands.sort((a, b) => a.name.localeCompare(b.name));
}
}
diff --git a/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts b/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts
index 111e5456af..cfaa1a1717 100644
--- a/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts
+++ b/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts
@@ -35,12 +35,10 @@ export class ZHAClustersDataTable extends LitElement {
private _clusters = memoizeOne((clusters: Cluster[]) => {
let outputClusters: ClusterRowData[] = clusters;
- outputClusters = outputClusters.map((cluster) => {
- return {
- ...cluster,
- cluster_id: cluster.endpoint_id + "-" + cluster.id,
- };
- });
+ outputClusters = outputClusters.map((cluster) => ({
+ ...cluster,
+ cluster_id: cluster.endpoint_id + "-" + cluster.id,
+ }));
return outputClusters;
});
@@ -65,9 +63,7 @@ export class ZHAClustersDataTable extends LitElement {
},
id: {
title: "ID",
- template: (id: number) => {
- return html` ${formatAsPaddedHex(id)} `;
- },
+ template: (id: number) => html` ${formatAsPaddedHex(id)} `,
sortable: true,
width: "15%",
},
diff --git a/src/panels/config/integrations/integration-panels/zha/zha-clusters.ts b/src/panels/config/integrations/integration-panels/zha/zha-clusters.ts
index 02649ff358..9761d1b0b6 100644
--- a/src/panels/config/integrations/integration-panels/zha/zha-clusters.ts
+++ b/src/panels/config/integrations/integration-panels/zha/zha-clusters.ts
@@ -117,9 +117,7 @@ export class ZHAClusters extends LitElement {
this.hass,
this.selectedDevice!.ieee
);
- this._clusters.sort((a, b) => {
- return a.name.localeCompare(b.name);
- });
+ this._clusters.sort((a, b) => a.name.localeCompare(b.name));
}
}
diff --git a/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts b/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts
index 5fc0a889f9..fd67ae4c04 100644
--- a/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts
+++ b/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts
@@ -63,6 +63,7 @@ class ZHAConfigDashboard extends LitElement {
protected firstUpdated(changedProperties: PropertyValues): void {
super.firstUpdated(changedProperties);
if (this.hass) {
+ this.hass.loadBackendTranslation("config_panel", "zha", false);
this._fetchConfiguration();
}
}
@@ -108,7 +109,7 @@ class ZHAConfigDashboard extends LitElement {
? Object.entries(this._configuration.schemas).map(
([section, schema]) => html`
@@ -164,9 +165,8 @@ class ZHAConfigDashboard extends LitElement {
private _computeLabelCallback(localize, section: string) {
// Returns a callback for ha-form to calculate labels per schema object
return (schema) =>
- localize(
- `ui.panel.config.zha.configuration_page.${section}.${schema.name}`
- ) || schema.name;
+ localize(`component.zha.config_panel.${section}.${schema.name}`) ||
+ schema.name;
}
static get styles(): CSSResultArray {
diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-binding.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-binding.ts
index ce5d13a8e0..41d269f69c 100644
--- a/src/panels/config/integrations/integration-panels/zha/zha-device-binding.ts
+++ b/src/panels/config/integrations/integration-panels/zha/zha-device-binding.ts
@@ -94,11 +94,7 @@ export class ZHADeviceBindingControl extends LitElement {
>Bind
${this._showHelp
- ? html`
-
- Bind devices.
-
- `
+ ? html`
Bind devices.
`
: ""}
Unbind
${this._showHelp
- ? html`
-
- Unbind devices.
-
- `
+ ? html`
Unbind devices.
`
: ""}
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 c810a397ee..763bb5d49a 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
@@ -52,9 +52,10 @@ class ZHADeviceCard extends SubscribeMixin(LitElement) {
): EntityRegistryStateEntry[] =>
entities
.filter((entity) => entity.device_id === deviceId)
- .map((entity) => {
- return { ...entity, stateName: this._computeEntityName(entity) };
- })
+ .map((entity) => ({
+ ...entity,
+ stateName: this._computeEntityName(entity),
+ }))
.sort((ent1, ent2) =>
compare(
ent1.stateName || `zzz${ent1.entity_id}`,
diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts
index 1364f6e2a9..2b09a8220a 100644
--- a/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts
+++ b/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts
@@ -113,14 +113,16 @@ export class ZHADeviceEndpointDataTable extends LitElement {
template: (entities) => html`
${entities.length
? entities.length > 3
- ? html`${entities.slice(0, 2).map(
- (entity) =>
- html`
- ${entity.name || entity.original_name}
-
`
- )}
+ ? html`${entities
+ .slice(0, 2)
+ .map(
+ (entity) =>
+ html`
+ ${entity.name || entity.original_name}
+
`
+ )}
And ${entities.length - 2} more...
`
: entities.map(
(entity) =>
diff --git a/src/panels/config/integrations/integration-panels/zha/zha-group-binding.ts b/src/panels/config/integrations/integration-panels/zha/zha-group-binding.ts
index 41fbe0d83c..449db0795a 100644
--- a/src/panels/config/integrations/integration-panels/zha/zha-group-binding.ts
+++ b/src/panels/config/integrations/integration-panels/zha/zha-group-binding.ts
@@ -222,9 +222,9 @@ export class ZHAGroupBindingControl extends LitElement {
this._clustersToBind = [];
for (const clusterIndex of this._selectedClusters) {
- const selectedCluster = this._clusters.find((cluster) => {
- return clusterIndex === cluster.endpoint_id + "-" + cluster.id;
- });
+ const selectedCluster = this._clusters.find(
+ (cluster) => clusterIndex === cluster.endpoint_id + "-" + cluster.id
+ );
this._clustersToBind.push(selectedCluster!);
}
}
@@ -236,12 +236,8 @@ export class ZHAGroupBindingControl extends LitElement {
this.selectedDevice!.ieee
);
this._clusters = this._clusters
- .filter((cluster) => {
- return cluster.type.toLowerCase() === "out";
- })
- .sort((a, b) => {
- return a.name.localeCompare(b.name);
- });
+ .filter((cluster) => cluster.type.toLowerCase() === "out")
+ .sort((a, b) => a.name.localeCompare(b.name));
}
}
diff --git a/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts b/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts
index 7bf78650ea..e56c145673 100644
--- a/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts
+++ b/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts
@@ -142,11 +142,7 @@ export class ZHAGroupPage extends LitElement {
>
`
)
- : html`
-
- This group has no members
-
- `}
+ : html`
This group has no members `}
${this.group.members.length
? html`
@@ -237,13 +233,12 @@ export class ZHAGroupPage extends LitElement {
private _filterDevices() {
// filter the groupable devices so we only show devices that aren't already in the group
this._filteredDeviceEndpoints = this.deviceEndpoints.filter(
- (deviceEndpoint) => {
- return !this.group!.members.some(
+ (deviceEndpoint) =>
+ !this.group!.members.some(
(member) =>
member.device.ieee === deviceEndpoint.device.ieee &&
member.endpoint_id === deviceEndpoint.endpoint_id
- );
- }
+ )
);
}
diff --git a/src/panels/config/integrations/integration-panels/zha/zha-groups-dashboard.ts b/src/panels/config/integrations/integration-panels/zha/zha-groups-dashboard.ts
index 4295161225..ce1e02415a 100644
--- a/src/panels/config/integrations/integration-panels/zha/zha-groups-dashboard.ts
+++ b/src/panels/config/integrations/integration-panels/zha/zha-groups-dashboard.ts
@@ -63,12 +63,10 @@ export class ZHAGroupsDashboard extends LitElement {
private _formattedGroups = memoizeOne((groups: ZHAGroup[]) => {
let outputGroups: GroupRowData[] = groups;
- outputGroups = outputGroups.map((group) => {
- return {
- ...group,
- id: String(group.group_id),
- };
- });
+ outputGroups = outputGroups.map((group) => ({
+ ...group,
+ id: String(group.group_id),
+ }));
return outputGroups;
});
@@ -97,18 +95,15 @@ export class ZHAGroupsDashboard extends LitElement {
title: this.hass.localize("ui.panel.config.zha.groups.group_id"),
type: "numeric",
width: "15%",
- template: (groupId: number) => {
- return html` ${formatAsPaddedHex(groupId)} `;
- },
+ template: (groupId: number) =>
+ html` ${formatAsPaddedHex(groupId)} `,
sortable: true,
},
members: {
title: this.hass.localize("ui.panel.config.zha.groups.members"),
type: "numeric",
width: "15%",
- template: (members: ZHADevice[]) => {
- return html` ${members.length} `;
- },
+ template: (members: ZHADevice[]) => html` ${members.length} `,
sortable: true,
},
}
diff --git a/src/panels/config/integrations/integration-panels/zwave/ha-config-zwave.js b/src/panels/config/integrations/integration-panels/zwave/ha-config-zwave.js
index 3835c47499..cda283547a 100644
--- a/src/panels/config/integrations/integration-panels/zwave/ha-config-zwave.js
+++ b/src/panels/config/integrations/integration-panels/zwave/ha-config-zwave.js
@@ -96,9 +96,7 @@ class HaConfigZwave extends LocalizeMixin(EventsMixin(PolymerElement)) {
hass="[[hass]]"
on-click="_backTapped"
>
-
- [[localize('component.zwave.title')]]
-
+
[[localize('component.zwave.title')]]
diff --git a/src/panels/config/integrations/integration-panels/zwave/zwave-migration.ts b/src/panels/config/integrations/integration-panels/zwave/zwave-migration.ts
index ce595713af..5ea9be159f 100644
--- a/src/panels/config/integrations/integration-panels/zwave/zwave-migration.ts
+++ b/src/panels/config/integrations/integration-panels/zwave/zwave-migration.ts
@@ -180,9 +180,7 @@ export class ZwaveMigration extends LitElement {
? html`
-
- Now it's time to set up the OZW integration.
-
+
Now it's time to set up the OZW integration.
${isComponentLoaded(this.hass, "hassio")
? html`
diff --git a/src/panels/config/integrations/integration-panels/zwave/zwave-values.ts b/src/panels/config/integrations/integration-panels/zwave/zwave-values.ts
index 948e8fe492..9d2ee97f3e 100644
--- a/src/panels/config/integrations/integration-panels/zwave/zwave-values.ts
+++ b/src/panels/config/integrations/integration-panels/zwave/zwave-values.ts
@@ -43,9 +43,7 @@ export class ZwaveValues extends LitElement {
>
${this.values.map(
(item) => html`
-
- ${this._computeCaption(item)}
-
+ ${this._computeCaption(item)}
`
)}
diff --git a/src/panels/config/logs/error-log-card.ts b/src/panels/config/logs/error-log-card.ts
index 9da5772c9b..2dd3fc9ceb 100644
--- a/src/panels/config/logs/error-log-card.ts
+++ b/src/panels/config/logs/error-log-card.ts
@@ -27,9 +27,7 @@ class ErrorLogCard extends LitElement {
icon="hass:refresh"
@click=${this._refreshErrorLog}
>
-
- ${this._errorHTML}
-
+
${this._errorHTML}
`
: html`
diff --git a/src/panels/config/logs/system-log-card.ts b/src/panels/config/logs/system-log-card.ts
index c1ff9183ff..3cc184b8be 100644
--- a/src/panels/config/logs/system-log-card.ts
+++ b/src/panels/config/logs/system-log-card.ts
@@ -63,9 +63,7 @@ export class SystemLogCard extends LitElement {
(item, idx) => html`
-
- ${item.message[0]}
-
+ ${item.message[0]}
${formatSystemLogTime(
item.timestamp,
diff --git a/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts b/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts
index 6a4f1d14c2..e40fbcd9db 100644
--- a/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts
+++ b/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts
@@ -190,13 +190,11 @@ export class HaConfigLovelaceDashboards extends LitElement {
mode: defaultMode,
filename: defaultMode === "yaml" ? "ui-lovelace.yaml" : "",
},
- ...dashboards.map((dashboard) => {
- return {
- filename: "",
- ...dashboard,
- default: defaultUrlPath === dashboard.url_path,
- };
- }),
+ ...dashboards.map((dashboard) => ({
+ filename: "",
+ ...dashboard,
+ default: defaultUrlPath === dashboard.url_path,
+ })),
];
});
diff --git a/src/panels/config/lovelace/resources/ha-config-lovelace-resources.ts b/src/panels/config/lovelace/resources/ha-config-lovelace-resources.ts
index c1a975e71e..68a64a4b65 100644
--- a/src/panels/config/lovelace/resources/ha-config-lovelace-resources.ts
+++ b/src/panels/config/lovelace/resources/ha-config-lovelace-resources.ts
@@ -52,34 +52,32 @@ export class HaConfigLovelaceRescources extends LitElement {
@internalProperty() private _resources: LovelaceResource[] = [];
private _columns = memoize(
- (_language): DataTableColumnContainer => {
- return {
- url: {
- title: this.hass.localize(
- "ui.panel.config.lovelace.resources.picker.headers.url"
- ),
- sortable: true,
- filterable: true,
- direction: "asc",
- grows: true,
- forceLTR: true,
- },
- type: {
- title: this.hass.localize(
- "ui.panel.config.lovelace.resources.picker.headers.type"
- ),
- sortable: true,
- filterable: true,
- width: "30%",
- template: (type) =>
- html`
- ${this.hass.localize(
- `ui.panel.config.lovelace.resources.types.${type}`
- ) || type}
- `,
- },
- };
- }
+ (_language): DataTableColumnContainer => ({
+ url: {
+ title: this.hass.localize(
+ "ui.panel.config.lovelace.resources.picker.headers.url"
+ ),
+ sortable: true,
+ filterable: true,
+ direction: "asc",
+ grows: true,
+ forceLTR: true,
+ },
+ type: {
+ title: this.hass.localize(
+ "ui.panel.config.lovelace.resources.picker.headers.type"
+ ),
+ sortable: true,
+ filterable: true,
+ width: "30%",
+ template: (type) =>
+ html`
+ ${this.hass.localize(
+ `ui.panel.config.lovelace.resources.types.${type}`
+ ) || type}
+ `,
+ },
+ })
);
protected render(): TemplateResult {
diff --git a/src/panels/config/person/dialog-person-detail.ts b/src/panels/config/person/dialog-person-detail.ts
index 9cbe669ab4..9d83ae4d9a 100644
--- a/src/panels/config/person/dialog-person-detail.ts
+++ b/src/panels/config/person/dialog-person-detail.ts
@@ -70,12 +70,12 @@ class DialogPersonDetail extends LitElement {
@internalProperty() private _personExists = false;
- private _deviceTrackersAvailable = memoizeOne((hass) => {
- return Object.keys(hass.states).some(
+ private _deviceTrackersAvailable = memoizeOne((hass) =>
+ Object.keys(hass.states).some(
(entityId) =>
entityId.substr(0, entityId.indexOf(".")) === "device_tracker"
- );
- });
+ )
+ );
public async showDialog(params: PersonDetailDialogParams): Promise
{
this._params = params;
diff --git a/src/panels/config/person/ha-config-person.ts b/src/panels/config/person/ha-config-person.ts
index 0a6a0128ae..697627e09f 100644
--- a/src/panels/config/person/ha-config-person.ts
+++ b/src/panels/config/person/ha-config-person.ts
@@ -75,9 +75,7 @@ class HaConfigPerson extends LitElement {
>${hass.localize("ui.panel.config.person.caption")}
-
- ${hass.localize("ui.panel.config.person.introduction")}
-
+ ${hass.localize("ui.panel.config.person.introduction")}
${this._configItems.length > 0
? html`
@@ -98,19 +96,17 @@ class HaConfigPerson extends LitElement {
- ${this._storageItems.map((entry) => {
- return html`
+ ${this._storageItems.map(
+ (entry) => html`
-
- ${entry.name}
-
+ ${entry.name}
- `;
- })}
+ `
+ )}
${this._storageItems.length === 0
? html`
@@ -129,19 +125,17 @@ class HaConfigPerson extends LitElement {
${this._configItems.length > 0
? html`
- ${this._configItems.map((entry) => {
- return html`
+ ${this._configItems.map(
+ (entry) => html`
-
- ${entry.name}
-
+ ${entry.name}
- `;
- })}
+ `
+ )}
`
: ""}
diff --git a/src/panels/config/scene/ha-config-scene.ts b/src/panels/config/scene/ha-config-scene.ts
index 5cae67b775..275a00200f 100644
--- a/src/panels/config/scene/ha-config-scene.ts
+++ b/src/panels/config/scene/ha-config-scene.ts
@@ -51,11 +51,12 @@ class HaConfigScene extends HassRouterPage {
}
}, 10);
- private _getScenes = memoizeOne((states: HassEntities): SceneEntity[] => {
- return Object.values(states).filter(
- (entity) => computeStateDomain(entity) === "scene"
- ) as SceneEntity[];
- });
+ private _getScenes = memoizeOne(
+ (states: HassEntities): SceneEntity[] =>
+ Object.values(states).filter(
+ (entity) => computeStateDomain(entity) === "scene"
+ ) as SceneEntity[]
+ );
protected updatePageEl(pageEl, changedProps: PropertyValues) {
pageEl.hass = this.hass;
diff --git a/src/panels/config/scene/ha-scene-dashboard.ts b/src/panels/config/scene/ha-scene-dashboard.ts
index 2aebf9293a..cdecf87ec2 100644
--- a/src/panels/config/scene/ha-scene-dashboard.ts
+++ b/src/panels/config/scene/ha-scene-dashboard.ts
@@ -64,99 +64,93 @@ class HaSceneDashboard extends LitElement {
return (filteredScenes
? scenes.filter((scene) => filteredScenes!.includes(scene.entity_id))
: scenes
- ).map((scene) => {
- return {
- ...scene,
- name: computeStateName(scene),
- icon: stateIcon(scene),
- };
- });
+ ).map((scene) => ({
+ ...scene,
+ name: computeStateName(scene),
+ icon: stateIcon(scene),
+ }));
}
);
private _columns = memoizeOne(
- (_language): DataTableColumnContainer => {
- return {
- activate: {
- title: "",
- type: "icon-button",
- template: (_toggle, scene) =>
- html`
-
this._activateScene(ev)}
- >
-
-
- `,
- },
- icon: {
- title: "",
- type: "icon",
- template: (icon) => html`
`,
- },
- name: {
- title: this.hass.localize(
- "ui.panel.config.scene.picker.headers.name"
- ),
- sortable: true,
- filterable: true,
- direction: "asc",
- grows: true,
- },
- info: {
- title: "",
- type: "icon-button",
- template: (_info, scene) => html`
+ (_language): DataTableColumnContainer => ({
+ activate: {
+ title: "",
+ type: "icon-button",
+ template: (_toggle, scene) =>
+ html`
this._activateScene(ev)}
>
-
+
`,
- },
- edit: {
- title: "",
- type: "icon-button",
- template: (_info, scene: any) => html`
-
html` `,
+ },
+ name: {
+ title: this.hass.localize("ui.panel.config.scene.picker.headers.name"),
+ sortable: true,
+ filterable: true,
+ direction: "asc",
+ grows: true,
+ },
+ info: {
+ title: "",
+ type: "icon-button",
+ template: (_info, scene) => html`
+
+
+
+ `,
+ },
+ edit: {
+ title: "",
+ type: "icon-button",
+ template: (_info, scene: any) => html`
+
+
-
-
-
-
- ${!scene.attributes.id
- ? html`
-
- ${this.hass.localize(
- "ui.panel.config.scene.picker.only_editable"
- )}
-
- `
- : ""}
- `,
- },
- };
- }
+
+
+
+ ${!scene.attributes.id
+ ? html`
+
+ ${this.hass.localize(
+ "ui.panel.config.scene.picker.only_editable"
+ )}
+
+ `
+ : ""}
+ `,
+ },
+ })
);
protected render(): TemplateResult {
diff --git a/src/panels/config/scene/ha-scene-editor.ts b/src/panels/config/scene/ha-scene-editor.ts
index 63a0e8df14..0fd4d9dcd1 100644
--- a/src/panels/config/scene/ha-scene-editor.ts
+++ b/src/panels/config/scene/ha-scene-editor.ts
@@ -489,9 +489,10 @@ export class HaSceneEditor extends SubscribeMixin(
this._scene = scene;
const { context } = await activateScene(this.hass, this._scene.entity_id);
this._activateContextId = context.id;
- this._unsubscribeEvents = await this.hass!.connection.subscribeEvents<
- HassEvent
- >((event) => this._stateChanged(event), "state_changed");
+ this._unsubscribeEvents = await this.hass!.connection.subscribeEvents
(
+ (event) => this._stateChanged(event),
+ "state_changed"
+ );
}
private _showMoreInfo(ev: Event) {
diff --git a/src/panels/config/script/ha-config-script.ts b/src/panels/config/script/ha-config-script.ts
index 93e52ea6a4..6efe063b55 100644
--- a/src/panels/config/script/ha-config-script.ts
+++ b/src/panels/config/script/ha-config-script.ts
@@ -51,11 +51,12 @@ class HaConfigScript extends HassRouterPage {
}
}, 10);
- private _getScripts = memoizeOne((states: HassEntities): ScriptEntity[] => {
- return Object.values(states).filter(
- (entity) => computeStateDomain(entity) === "script"
- ) as ScriptEntity[];
- });
+ private _getScripts = memoizeOne(
+ (states: HassEntities): ScriptEntity[] =>
+ Object.values(states).filter(
+ (entity) => computeStateDomain(entity) === "script"
+ ) as ScriptEntity[]
+ );
protected firstUpdated(changedProps) {
super.firstUpdated(changedProps);
diff --git a/src/panels/config/script/ha-script-editor.ts b/src/panels/config/script/ha-script-editor.ts
index 03f57fc674..e59a8b7429 100644
--- a/src/panels/config/script/ha-script-editor.ts
+++ b/src/panels/config/script/ha-script-editor.ts
@@ -357,9 +357,7 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
${!this.narrow
? html`
+ >
diff --git a/src/panels/config/script/ha-script-picker.ts b/src/panels/config/script/ha-script-picker.ts
index b60e594ab5..bd38f62599 100644
--- a/src/panels/config/script/ha-script-picker.ts
+++ b/src/panels/config/script/ha-script-picker.ts
@@ -64,14 +64,12 @@ class HaScriptPicker extends LitElement {
filteredScripts!.includes(script.entity_id)
)
: scripts
- ).map((script) => {
- return {
- ...script,
- name: computeStateName(script),
- icon: stateIcon(script),
- last_triggered: script.attributes.last_triggered || undefined,
- };
- });
+ ).map((script) => ({
+ ...script,
+ name: computeStateName(script),
+ icon: stateIcon(script),
+ last_triggered: script.attributes.last_triggered || undefined,
+ }));
}
);
diff --git a/src/panels/config/tags/dialog-tag-detail.ts b/src/panels/config/tags/dialog-tag-detail.ts
index a424892175..68e9f39b0e 100644
--- a/src/panels/config/tags/dialog-tag-detail.ts
+++ b/src/panels/config/tags/dialog-tag-detail.ts
@@ -24,7 +24,8 @@ import { TagDetailDialogParams } from "./show-dialog-tag-detail";
const QR_LOGO_URL = "/static/icons/favicon-192x192.png";
@customElement("dialog-tag-detail")
-class DialogTagDetail extends LitElement
+class DialogTagDetail
+ extends LitElement
implements HassDialog
{
@property({ attribute: false }) public hass!: HomeAssistant;
diff --git a/src/panels/config/tags/ha-config-tags.ts b/src/panels/config/tags/ha-config-tags.ts
index 2e4a73b2ba..d543b5c6af 100644
--- a/src/panels/config/tags/ha-config-tags.ts
+++ b/src/panels/config/tags/ha-config-tags.ts
@@ -149,17 +149,15 @@ export class HaConfigTags extends SubscribeMixin(LitElement) {
}
);
- private _data = memoizeOne((tags: Tag[]): TagRowData[] => {
- return tags.map((tag) => {
- return {
- ...tag,
- display_name: tag.name || tag.id,
- last_scanned_datetime: tag.last_scanned
- ? new Date(tag.last_scanned)
- : null,
- };
- });
- });
+ private _data = memoizeOne((tags: Tag[]): TagRowData[] =>
+ tags.map((tag) => ({
+ ...tag,
+ display_name: tag.name || tag.id,
+ last_scanned_datetime: tag.last_scanned
+ ? new Date(tag.last_scanned)
+ : null,
+ }))
+ );
protected firstUpdated(changedProperties: PropertyValues) {
super.firstUpdated(changedProperties);
diff --git a/src/panels/config/zone/ha-config-zone.ts b/src/panels/config/zone/ha-config-zone.ts
index 94864843bf..0e1972f69e 100644
--- a/src/panels/config/zone/ha-config-zone.ts
+++ b/src/panels/config/zone/ha-config-zone.ts
@@ -76,33 +76,28 @@ export class HaConfigZone extends SubscribeMixin(LitElement) {
private _getZones = memoizeOne(
(storageItems: Zone[], stateItems: HassEntity[]): MarkerLocation[] => {
- const stateLocations: MarkerLocation[] = stateItems.map((state) => {
- return {
- id: state.entity_id,
- icon: state.attributes.icon,
- name: state.attributes.friendly_name || state.entity_id,
- latitude: state.attributes.latitude,
- longitude: state.attributes.longitude,
- radius: state.attributes.radius,
- radius_color:
- state.entity_id === "zone.home"
- ? homeRadiusColor
- : state.attributes.passive
- ? passiveRadiusColor
- : defaultRadiusColor,
- location_editable:
- state.entity_id === "zone.home" && this._canEditCore,
- radius_editable: false,
- };
- });
- const storageLocations: MarkerLocation[] = storageItems.map((zone) => {
- return {
- ...zone,
- radius_color: zone.passive ? passiveRadiusColor : defaultRadiusColor,
- location_editable: true,
- radius_editable: true,
- };
- });
+ const stateLocations: MarkerLocation[] = stateItems.map((state) => ({
+ id: state.entity_id,
+ icon: state.attributes.icon,
+ name: state.attributes.friendly_name || state.entity_id,
+ latitude: state.attributes.latitude,
+ longitude: state.attributes.longitude,
+ radius: state.attributes.radius,
+ radius_color:
+ state.entity_id === "zone.home"
+ ? homeRadiusColor
+ : state.attributes.passive
+ ? passiveRadiusColor
+ : defaultRadiusColor,
+ location_editable: state.entity_id === "zone.home" && this._canEditCore,
+ radius_editable: false,
+ }));
+ const storageLocations: MarkerLocation[] = storageItems.map((zone) => ({
+ ...zone,
+ radius_color: zone.passive ? passiveRadiusColor : defaultRadiusColor,
+ location_editable: true,
+ radius_editable: true,
+ }));
return storageLocations.concat(stateLocations);
}
);
@@ -143,17 +138,15 @@ export class HaConfigZone extends SubscribeMixin(LitElement) {
attr-for-selected="data-id"
.selected=${this._activeEntry || ""}
>
- ${this._storageItems.map((entry) => {
- return html`
+ ${this._storageItems.map(
+ (entry) => html`
-
- ${entry.name}
-
+ ${entry.name}
${!this.narrow
? html`
- `;
- })}
- ${this._stateItems.map((state) => {
- return html`
+ `
+ )}
+ ${this._stateItems.map(
+ (state) => html`
- `;
- })}
+ `
+ )}
`;
@@ -249,9 +242,7 @@ export class HaConfigZone extends SubscribeMixin(LitElement) {
@radius-updated=${this._radiusUpdated}
@marker-clicked=${this._markerClicked}
>
-
- ${listBox}
-
+ ${listBox}
`
: ""}
diff --git a/src/panels/developer-tools/event/developer-tools-event.js b/src/panels/developer-tools/event/developer-tools-event.js
index 163c034b2b..6c508799cc 100644
--- a/src/panels/developer-tools/event/developer-tools-event.js
+++ b/src/panels/developer-tools/event/developer-tools-event.js
@@ -86,9 +86,7 @@ class HaPanelDevEvent extends EventsMixin(LocalizeMixin(PolymerElement)) {
required
value="{{eventType}}"
>
-
- [[localize( 'ui.panel.developer-tools.tabs.events.data' )]]
-
+ [[localize( 'ui.panel.developer-tools.tabs.events.data' )]]
{
- return { key: field, ...fields[field] };
- });
+ const result = Object.keys(fields).map((field) => ({
+ key: field,
+ ...fields[field],
+ }));
return {
target,
diff --git a/src/panels/developer-tools/state/developer-tools-state.js b/src/panels/developer-tools/state/developer-tools-state.js
index 6eb56c8656..64f85edfae 100644
--- a/src/panels/developer-tools/state/developer-tools-state.js
+++ b/src/panels/developer-tools/state/developer-tools-state.js
@@ -220,9 +220,7 @@ class HaPanelDevState extends EventsMixin(LocalizeMixin(PolymerElement)) {
>
[[entity.entity_id]]
-
- [[entity.state]]
- |
+ [[entity.state]] |
{
- return html`
+ ).map(
+ (state) => html`
${this._actionDisplay(state)}
- `;
- })}
+ `
+ )}
${!stateObj.attributes.code_format
? html``
@@ -200,8 +200,8 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard {
? html``
: html`
- ${BUTTONS.map((value) => {
- return value === ""
+ ${BUTTONS.map((value) =>
+ value === ""
? html` `
: html`
- `;
- })}
+ `
+ )}
`}
diff --git a/src/panels/lovelace/cards/hui-calendar-card.ts b/src/panels/lovelace/cards/hui-calendar-card.ts
index 18100de6b8..ae3280920f 100644
--- a/src/panels/lovelace/cards/hui-calendar-card.ts
+++ b/src/panels/lovelace/cards/hui-calendar-card.ts
@@ -87,12 +87,10 @@ export class HuiCalendarCard extends LitElement implements LovelaceCard {
throw new Error("Entities need to be an array");
}
- this._calendars = config!.entities.map((entity, idx) => {
- return {
- entity_id: entity,
- backgroundColor: `#${HA_COLOR_PALETTE[idx % HA_COLOR_PALETTE.length]}`,
- };
- });
+ this._calendars = config!.entities.map((entity, idx) => ({
+ entity_id: entity,
+ backgroundColor: `#${HA_COLOR_PALETTE[idx % HA_COLOR_PALETTE.length]}`,
+ }));
if (this._config?.entities !== config.entities) {
this._fetchCalendarEvents();
diff --git a/src/panels/lovelace/cards/hui-entities-card.ts b/src/panels/lovelace/cards/hui-entities-card.ts
index fa6837c5c5..09cf5f7574 100644
--- a/src/panels/lovelace/cards/hui-entities-card.ts
+++ b/src/panels/lovelace/cards/hui-entities-card.ts
@@ -181,9 +181,7 @@ class HuiEntitiesCard extends LitElement implements LovelaceCard {
return html`
${this._headerElement
- ? html``
+ ? html``
: ""}
${!this._config.title && !this._showHeaderToggle && !this._config.icon
? ""
@@ -219,9 +217,7 @@ class HuiEntitiesCard extends LitElement implements LovelaceCard {
${this._footerElement
- ? html``
+ ? html``
: ""}
`;
diff --git a/src/panels/lovelace/cards/hui-gauge-card.ts b/src/panels/lovelace/cards/hui-gauge-card.ts
index a87bb5a9ba..770706a861 100644
--- a/src/panels/lovelace/cards/hui-gauge-card.ts
+++ b/src/panels/lovelace/cards/hui-gauge-card.ts
@@ -46,9 +46,8 @@ class HuiGaugeCard extends LitElement implements LovelaceCard {
): GaugeCardConfig {
const includeDomains = ["sensor"];
const maxEntities = 1;
- const entityFilter = (stateObj: HassEntity): boolean => {
- return !isNaN(Number(stateObj.state));
- };
+ const entityFilter = (stateObj: HassEntity): boolean =>
+ !isNaN(Number(stateObj.state));
const foundEntities = findEntities(
hass,
diff --git a/src/panels/lovelace/cards/hui-glance-card.ts b/src/panels/lovelace/cards/hui-glance-card.ts
index 180cb8514b..e59d0dd4ac 100644
--- a/src/panels/lovelace/cards/hui-glance-card.ts
+++ b/src/panels/lovelace/cards/hui-glance-card.ts
@@ -91,12 +91,10 @@ export class HuiGlanceCard extends LitElement implements LovelaceCard {
};
const entities = processConfigEntities
(
config.entities
- ).map((entityConf) => {
- return {
- hold_action: { action: "more-info" } as MoreInfoActionConfig,
- ...entityConf,
- };
- });
+ ).map((entityConf) => ({
+ hold_action: { action: "more-info" } as MoreInfoActionConfig,
+ ...entityConf,
+ }));
for (const entity of entities) {
if (
diff --git a/src/panels/lovelace/cards/hui-grid-card.ts b/src/panels/lovelace/cards/hui-grid-card.ts
index 256d889a12..b7880b2f6d 100644
--- a/src/panels/lovelace/cards/hui-grid-card.ts
+++ b/src/panels/lovelace/cards/hui-grid-card.ts
@@ -25,7 +25,9 @@ class HuiGridCard extends HuiStackCard {
if (this.square) {
const rowHeight = SQUARE_ROW_HEIGHTS_BY_COLUMNS[this.columns] || 1;
return (
- (this._cards.length / this.columns) * rowHeight +
+ (this._cards.length < this.columns
+ ? rowHeight
+ : (this._cards.length / this.columns) * rowHeight) +
(this._config.title ? 1 : 0)
);
}
diff --git a/src/panels/lovelace/cards/hui-humidifier-card.ts b/src/panels/lovelace/cards/hui-humidifier-card.ts
index baa2b772a8..db983222df 100644
--- a/src/panels/lovelace/cards/hui-humidifier-card.ts
+++ b/src/panels/lovelace/cards/hui-humidifier-card.ts
@@ -171,15 +171,11 @@ export class HuiHumidifierCard extends LitElement implements LovelaceCard {
${slider}
-
- ${setValues}
-
+
${setValues}
-