Bump typescript, lint, prettier (#10108)

This commit is contained in:
Bram Kragten 2021-09-30 12:39:03 +02:00 committed by GitHub
parent ff2bf1f3c1
commit 2936865c55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
294 changed files with 1553 additions and 1639 deletions

View File

@ -1,9 +1,10 @@
{ {
"extends": [ "extends": [
"airbnb-base",
"airbnb-typescript/base", "airbnb-typescript/base",
"plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended",
"plugin:wc/recommended", "plugin:wc/recommended",
"plugin:lit/recommended", "plugin:lit/all",
"prettier" "prettier"
], ],
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
@ -109,7 +110,9 @@
} }
], ],
"unused-imports/no-unused-imports": "error", "unused-imports/no-unused-imports": "error",
"lit/attribute-value-entities": "off" "lit/attribute-value-entities": "off",
"lit/no-template-map": "off",
"lit/no-template-arrow": "warn"
}, },
"plugins": ["disable", "unused-imports"], "plugins": ["disable", "unused-imports"],
"processor": "disable/disable" "processor": "disable/disable"

View File

@ -191,7 +191,7 @@ class HcCast extends LitElement {
} }
this.connection.close(); this.connection.close();
location.reload(); location.reload();
} catch (err) { } catch (err: any) {
alert("Unable to log out!"); alert("Unable to log out!");
} }
} }

View File

@ -212,7 +212,7 @@ export class HcConnect extends LitElement {
let url: URL; let url: URL;
try { try {
url = new URL(value); url = new URL(value);
} catch (err) { } catch (err: any) {
this.error = "Invalid URL"; this.error = "Invalid URL";
return; return;
} }
@ -240,7 +240,7 @@ export class HcConnect extends LitElement {
try { try {
this.loading = true; this.loading = true;
auth = await getAuth(options); auth = await getAuth(options);
} catch (err) { } catch (err: any) {
if (init === "saved-tokens" && err === ERR_CANNOT_CONNECT) { if (init === "saved-tokens" && err === ERR_CANNOT_CONNECT) {
this.cannotConnect = true; this.cannotConnect = true;
return; return;
@ -259,7 +259,7 @@ export class HcConnect extends LitElement {
try { try {
conn = await createConnection({ auth }); conn = await createConnection({ auth });
} catch (err) { } catch (err: any) {
// In case of saved tokens, silently solve problems. // In case of saved tokens, silently solve problems.
if (init === "saved-tokens") { if (init === "saved-tokens") {
if (err === ERR_CANNOT_CONNECT) { if (err === ERR_CANNOT_CONNECT) {
@ -285,7 +285,7 @@ export class HcConnect extends LitElement {
try { try {
saveTokens(null); saveTokens(null);
location.reload(); location.reload();
} catch (err) { } catch (err: any) {
alert("Unable to log out!"); alert("Unable to log out!");
} }
} }

View File

@ -148,14 +148,14 @@ export class HcMain extends HassElement {
expires_in: 0, expires_in: 0,
}), }),
}); });
} catch (err) { } catch (err: any) {
this._error = this._getErrorMessage(err); this._error = this._getErrorMessage(err);
return; return;
} }
let connection; let connection;
try { try {
connection = await createConnection({ auth }); connection = await createConnection({ auth });
} catch (err) { } catch (err: any) {
this._error = this._getErrorMessage(err); this._error = this._getErrorMessage(err);
return; return;
} }
@ -193,7 +193,7 @@ export class HcMain extends HassElement {
this._unsubLovelace = llColl.subscribe((lovelaceConfig) => this._unsubLovelace = llColl.subscribe((lovelaceConfig) =>
this._handleNewLovelaceConfig(lovelaceConfig) this._handleNewLovelaceConfig(lovelaceConfig)
); );
} catch (err) { } catch (err: any) {
// eslint-disable-next-line // eslint-disable-next-line
console.log("Error fetching Lovelace configuration", err, msg); console.log("Error fetching Lovelace configuration", err, msg);
// Generate a Lovelace config. // Generate a Lovelace config.

View File

@ -44,7 +44,7 @@ export class HADemoCard extends LitElement implements LovelaceCard {
(conf) => html` (conf) => html`
${conf.name} ${conf.name}
<small> <small>
<a target="_blank" href="${conf.authorUrl}"> <a target="_blank" href=${conf.authorUrl}>
${this.hass.localize( ${this.hass.localize(
"ui.panel.page-demo.cards.demo.demo_by", "ui.panel.page-demo.cards.demo.demo_by",
"name", "name",
@ -94,7 +94,7 @@ export class HADemoCard extends LitElement implements LovelaceCard {
this._switching = true; this._switching = true;
try { try {
await setDemoConfig(this.hass, this.lovelace!, index); await setDemoConfig(this.hass, this.lovelace!, index);
} catch (err) { } catch (err: any) {
alert("Failed to switch config :-("); alert("Failed to switch config :-(");
} finally { } finally {
this._switching = false; this._switching = false;

View File

@ -23,9 +23,9 @@ customElements.whenDefined("hui-view").then(() => {
// eslint-disable-next-line // eslint-disable-next-line
const HUIView = customElements.get("hui-view"); const HUIView = customElements.get("hui-view");
// Patch HUI-VIEW to make the lovelace object available to the demo card // Patch HUI-VIEW to make the lovelace object available to the demo card
const oldCreateCard = HUIView.prototype.createCardElement; const oldCreateCard = HUIView!.prototype.createCardElement;
HUIView.prototype.createCardElement = function (config) { HUIView!.prototype.createCardElement = function (config) {
const el = oldCreateCard.call(this, config); const el = oldCreateCard.call(this, config);
if (el.tagName === "HA-DEMO-CARD") { if (el.tagName === "HA-DEMO-CARD") {
(el as HADemoCard).lovelace = this.lovelace; (el as HADemoCard).lovelace = this.lovelace;

View File

@ -1,5 +1,5 @@
import "@material/mwc-button"; import "@material/mwc-button";
import { html, LitElement, TemplateResult } from "lit"; import { css, html, LitElement, TemplateResult } from "lit";
import { customElement } from "lit/decorators"; import { customElement } from "lit/decorators";
import "../../../src/components/ha-card"; import "../../../src/components/ha-card";
import { ActionHandlerEvent } from "../../../src/data/lovelace"; import { ActionHandlerEvent } from "../../../src/data/lovelace";
@ -9,7 +9,6 @@ import { actionHandler } from "../../../src/panels/lovelace/common/directives/ac
export class DemoUtilLongPress extends LitElement { export class DemoUtilLongPress extends LitElement {
protected render(): TemplateResult { protected render(): TemplateResult {
return html` return html`
${this.renderStyle()}
${[1, 2, 3].map( ${[1, 2, 3].map(
() => html` () => html`
<ha-card> <ha-card>
@ -41,26 +40,22 @@ export class DemoUtilLongPress extends LitElement {
area.scrollTop = area.scrollHeight; area.scrollTop = area.scrollHeight;
} }
private renderStyle() { static styles = css`
return html` ha-card {
<style> width: 200px;
ha-card { margin: calc(42vh - 140px) auto;
width: 200px; padding: 8px;
margin: calc(42vh - 140px) auto; text-align: center;
padding: 8px; }
text-align: center; ha-card:first-of-type {
} margin-top: 16px;
ha-card:first-of-type { }
margin-top: 16px; ha-card:last-of-type {
} margin-bottom: 16px;
ha-card:last-of-type { }
margin-bottom: 16px;
}
textarea { textarea {
height: 50px; height: 50px;
} }
</style> `;
`;
}
} }

View File

@ -259,7 +259,7 @@ class HassioAddonConfig extends LitElement {
path: "options", path: "options",
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize(
"addon.common.update_available", "addon.common.update_available",
"error", "error",
@ -300,7 +300,7 @@ class HassioAddonConfig extends LitElement {
if (this.addon?.state === "started") { if (this.addon?.state === "started") {
await suggestAddonRestart(this, this.hass, this.supervisor, this.addon); await suggestAddonRestart(this, this.hass, this.supervisor, this.addon);
} }
} catch (err) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize(
"addon.failed_to_save", "addon.failed_to_save",
"error", "error",

View File

@ -89,9 +89,9 @@ class HassioAddonNetwork extends LitElement {
<td> <td>
<paper-input <paper-input
@value-changed=${this._configChanged} @value-changed=${this._configChanged}
placeholder="${this.supervisor.localize( placeholder=${this.supervisor.localize(
"addon.configuration.network.disabled" "addon.configuration.network.disabled"
)}" )}
.value=${item.host ? String(item.host) : ""} .value=${item.host ? String(item.host) : ""}
.container=${item.container} .container=${item.container}
no-label-float no-label-float
@ -171,7 +171,7 @@ class HassioAddonNetwork extends LitElement {
if (this.addon?.state === "started") { if (this.addon?.state === "started") {
await suggestAddonRestart(this, this.hass, this.supervisor, this.addon); await suggestAddonRestart(this, this.hass, this.supervisor, this.addon);
} }
} catch (err) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize(
"addon.failed_to_reset", "addon.failed_to_reset",
"error", "error",
@ -207,7 +207,7 @@ class HassioAddonNetwork extends LitElement {
if (this.addon?.state === "started") { if (this.addon?.state === "started") {
await suggestAddonRestart(this, this.hass, this.supervisor, this.addon); await suggestAddonRestart(this, this.hass, this.supervisor, this.addon);
} }
} catch (err) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize(
"addon.failed_to_save", "addon.failed_to_save",
"error", "error",

View File

@ -79,7 +79,7 @@ class HassioAddonDocumentationDashboard extends LitElement {
this.hass, this.hass,
this.addon!.slug this.addon!.slug
); );
} catch (err) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize(
"addon.documentation.get_logs", "addon.documentation.get_logs",
"error", "error",

View File

@ -222,7 +222,7 @@ class HassioAddonDashboard extends LitElement {
try { try {
const addoninfo = await fetchHassioAddonInfo(this.hass, addon); const addoninfo = await fetchHassioAddonInfo(this.hass, addon);
this.addon = addoninfo; this.addon = addoninfo;
} catch (err) { } catch (err: any) {
this._error = `Error fetching addon info: ${extractApiErrorMessage(err)}`; this._error = `Error fetching addon info: ${extractApiErrorMessage(err)}`;
this.addon = undefined; this.addon = undefined;
} }

View File

@ -123,18 +123,18 @@ class HassioAddonInfo extends LitElement {
<div class="card-content"> <div class="card-content">
<hassio-card-content <hassio-card-content
.hass=${this.hass} .hass=${this.hass}
.title="${this.supervisor.localize( .title=${this.supervisor.localize(
"addon.dashboard.new_update_available", "addon.dashboard.new_update_available",
"name", "name",
this.addon.name, this.addon.name,
"version", "version",
this.addon.version_latest this.addon.version_latest
)}" )}
.description="${this.supervisor.localize( .description=${this.supervisor.localize(
"common.running_version", "common.running_version",
"version", "version",
this.addon.version this.addon.version
)}" )}
icon=${mdiArrowUpBoldCircle} icon=${mdiArrowUpBoldCircle}
iconClass="update" iconClass="update"
></hassio-card-content> ></hassio-card-content>
@ -254,7 +254,7 @@ class HassioAddonInfo extends LitElement {
${this.supervisor.localize( ${this.supervisor.localize(
"addon.dashboard.visit_addon_page", "addon.dashboard.visit_addon_page",
"name", "name",
html`<a href="${this.addon.url!}" target="_blank" rel="noreferrer" html`<a href=${this.addon.url!} target="_blank" rel="noreferrer"
>${this.addon.name}</a >${this.addon.name}</a
>` >`
)} )}
@ -437,10 +437,10 @@ class HassioAddonInfo extends LitElement {
${this.addon.version ${this.addon.version
? html` ? html`
<div <div
class="${classMap({ class=${classMap({
"addon-options": true, "addon-options": true,
started: this.addon.state === "started", started: this.addon.state === "started",
})}" })}
> >
<ha-settings-row ?three-line=${this.narrow}> <ha-settings-row ?three-line=${this.narrow}>
<span slot="heading"> <span slot="heading">
@ -796,7 +796,7 @@ class HassioAddonInfo extends LitElement {
path: "option", path: "option",
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize(
"addon.failed_to_save", "addon.failed_to_save",
"error", "error",
@ -818,7 +818,7 @@ class HassioAddonInfo extends LitElement {
path: "option", path: "option",
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize(
"addon.failed_to_save", "addon.failed_to_save",
"error", "error",
@ -840,7 +840,7 @@ class HassioAddonInfo extends LitElement {
path: "option", path: "option",
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize(
"addon.failed_to_save", "addon.failed_to_save",
"error", "error",
@ -862,7 +862,7 @@ class HassioAddonInfo extends LitElement {
path: "security", path: "security",
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize(
"addon.failed_to_save", "addon.failed_to_save",
"error", "error",
@ -884,7 +884,7 @@ class HassioAddonInfo extends LitElement {
path: "option", path: "option",
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize(
"addon.failed_to_save", "addon.failed_to_save",
"error", "error",
@ -912,7 +912,7 @@ class HassioAddonInfo extends LitElement {
title: this.supervisor.localize("addon.dashboard.changelog"), title: this.supervisor.localize("addon.dashboard.changelog"),
content, content,
}); });
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize( title: this.supervisor.localize(
"addon.dashboard.action_error.get_changelog" "addon.dashboard.action_error.get_changelog"
@ -934,7 +934,7 @@ class HassioAddonInfo extends LitElement {
path: "install", path: "install",
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize("addon.dashboard.action_error.install"), title: this.supervisor.localize("addon.dashboard.action_error.install"),
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),
@ -955,7 +955,7 @@ class HassioAddonInfo extends LitElement {
path: "stop", path: "stop",
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize("addon.dashboard.action_error.stop"), title: this.supervisor.localize("addon.dashboard.action_error.stop"),
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),
@ -976,7 +976,7 @@ class HassioAddonInfo extends LitElement {
path: "stop", path: "stop",
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize("addon.dashboard.action_error.restart"), title: this.supervisor.localize("addon.dashboard.action_error.restart"),
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),
@ -1035,7 +1035,7 @@ class HassioAddonInfo extends LitElement {
button.progress = false; button.progress = false;
return; return;
} }
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: "Failed to validate addon configuration", title: "Failed to validate addon configuration",
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),
@ -1053,7 +1053,7 @@ class HassioAddonInfo extends LitElement {
path: "start", path: "start",
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize("addon.dashboard.action_error.start"), title: this.supervisor.localize("addon.dashboard.action_error.start"),
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),
@ -1091,7 +1091,7 @@ class HassioAddonInfo extends LitElement {
path: "uninstall", path: "uninstall",
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize( title: this.supervisor.localize(
"addon.dashboard.action_error.uninstall" "addon.dashboard.action_error.uninstall"

View File

@ -71,7 +71,7 @@ class HassioAddonLogs extends LitElement {
this._error = undefined; this._error = undefined;
try { try {
this._content = await fetchHassioAddonLogs(this.hass, this.addon.slug); this._content = await fetchHassioAddonLogs(this.hass, this.addon.slug);
} catch (err) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize(
"addon.logs.get_logs", "addon.logs.get_logs",
"error", "error",

View File

@ -294,7 +294,7 @@ export class HassioBackups extends LitElement {
await Promise.all( await Promise.all(
this._selectedBackups.map((slug) => removeBackup(this.hass, slug)) this._selectedBackups.map((slug) => removeBackup(this.hass, slug))
); );
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize("backup.failed_to_delete"), title: this.supervisor.localize("backup.failed_to_delete"),
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),

View File

@ -37,7 +37,7 @@ class HassioCardContent extends LitElement {
${this.iconImage ${this.iconImage
? html` ? html`
<div class="icon_image ${this.iconClass}"> <div class="icon_image ${this.iconClass}">
<img src="${this.iconImage}" .title=${this.iconTitle} /> <img src=${this.iconImage} .title=${this.iconTitle} />
<div></div> <div></div>
</div> </div>
` `

View File

@ -70,7 +70,7 @@ export class HassioUploadBackup extends LitElement {
try { try {
const backup = await uploadBackup(this.hass, file); const backup = await uploadBackup(this.hass, file);
fireEvent(this, "backup-uploaded", { backup: backup.data }); fireEvent(this, "backup-uploaded", { backup: backup.data });
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: "Upload failed", title: "Upload failed",
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),

View File

@ -20,10 +20,10 @@ class SupervisorMetric extends LitElement {
<div slot="description" .title=${this.tooltip ?? ""}> <div slot="description" .title=${this.tooltip ?? ""}>
<span class="value"> ${roundedValue} % </span> <span class="value"> ${roundedValue} % </span>
<ha-bar <ha-bar
class="${classMap({ class=${classMap({
"target-warning": roundedValue > 50, "target-warning": roundedValue > 50,
"target-critical": roundedValue > 85, "target-critical": roundedValue > 85,
})}" })}
.value=${this.value} .value=${this.value}
></ha-bar> ></ha-bar>
</div> </div>

View File

@ -136,7 +136,7 @@ export class HassioUpdate extends LitElement {
</ha-settings-row> </ha-settings-row>
</div> </div>
<div class="card-actions"> <div class="card-actions">
<a href="${releaseNotesUrl}" target="_blank" rel="noreferrer"> <a href=${releaseNotesUrl} target="_blank" rel="noreferrer">
<mwc-button> <mwc-button>
${this.supervisor.localize("common.release_notes")} ${this.supervisor.localize("common.release_notes")}
</mwc-button> </mwc-button>
@ -206,7 +206,7 @@ export class HassioUpdate extends LitElement {
fireEvent(this, "supervisor-collection-refresh", { fireEvent(this, "supervisor-collection-refresh", {
collection: item.key, collection: item.key,
}); });
} catch (err) { } catch (err: any) {
// Only show an error if the status code was not expected (user behind proxy) // Only show an error if the status code was not expected (user behind proxy)
// or no status at all(connection terminated) // or no status at all(connection terminated)
if (this.hass.connection.connected && !ignoreSupervisorError(err)) { if (this.hass.connection.connected && !ignoreSupervisorError(err)) {

View File

@ -311,7 +311,7 @@ class HassioBackupDialog
: "snapshots" : "snapshots"
}/${this._backup!.slug}/download` }/${this._backup!.slug}/download`
); );
} catch (err) { } catch (err: any) {
await showAlertDialog(this, { await showAlertDialog(this, {
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),
}); });

View File

@ -127,7 +127,7 @@ class HassioCreateBackupDialog extends LitElement {
this._dialogParams!.onCreate(); this._dialogParams!.onCreate();
this.closeDialog(); this.closeDialog();
} catch (err) { } catch (err: any) {
this._error = extractApiErrorMessage(err); this._error = extractApiErrorMessage(err);
} }
this._creatingBackup = false; this._creatingBackup = false;

View File

@ -149,7 +149,7 @@ class HassioDatadiskDialog extends LitElement {
this.moving = true; this.moving = true;
try { try {
await moveDatadisk(this.hass, this.selectedDevice!); await moveDatadisk(this.hass, this.selectedDevice!);
} catch (err) { } catch (err: any) {
if (this.hass.connection.connected && !ignoreSupervisorError(err)) { if (this.hass.connection.connected && !ignoreSupervisorError(err)) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.dialogParams!.supervisor.localize( title: this.dialogParams!.supervisor.localize(

View File

@ -287,7 +287,7 @@ export class DialogHassioNetwork
this.hass, this.hass,
this._interface.interface this._interface.interface
); );
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: "Failed to scan for accesspoints", title: "Failed to scan for accesspoints",
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),
@ -448,7 +448,7 @@ export class DialogHassioNetwork
this._interface!.interface, this._interface!.interface,
interfaceOptions interfaceOptions
); );
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize("dialog.network.failed_to_change"), title: this.supervisor.localize("dialog.network.failed_to_change"),
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),

View File

@ -190,7 +190,7 @@ class HassioRegistriesDialog extends LitElement {
await addHassioDockerRegistry(this.hass, data); await addHassioDockerRegistry(this.hass, data);
await this._loadRegistries(); await this._loadRegistries();
this._addingRegistry = false; this._addingRegistry = false;
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize("dialog.registries.failed_to_add"), title: this.supervisor.localize("dialog.registries.failed_to_add"),
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),
@ -204,7 +204,7 @@ class HassioRegistriesDialog extends LitElement {
try { try {
await removeHassioDockerRegistry(this.hass, entry.registry); await removeHassioDockerRegistry(this.hass, entry.registry);
await this._loadRegistries(); await this._loadRegistries();
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize("dialog.registries.failed_to_remove"), title: this.supervisor.localize("dialog.registries.failed_to_remove"),
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),

View File

@ -185,7 +185,7 @@ class HassioRepositoriesDialog extends LitElement {
this._repositories = addonsinfo.repositories; this._repositories = addonsinfo.repositories;
fireEvent(this, "supervisor-collection-refresh", { collection: "addon" }); fireEvent(this, "supervisor-collection-refresh", { collection: "addon" });
} catch (err) { } catch (err: any) {
this._error = extractApiErrorMessage(err); this._error = extractApiErrorMessage(err);
} }
} }
@ -207,7 +207,7 @@ class HassioRepositoriesDialog extends LitElement {
await this._loadData(); await this._loadData();
input.value = ""; input.value = "";
} catch (err) { } catch (err: any) {
this._error = extractApiErrorMessage(err); this._error = extractApiErrorMessage(err);
} }
this._processing = false; this._processing = false;
@ -229,7 +229,7 @@ class HassioRepositoriesDialog extends LitElement {
addons_repositories: newRepositories, addons_repositories: newRepositories,
}); });
await this._loadData(); await this._loadData();
} catch (err) { } catch (err: any) {
this._error = extractApiErrorMessage(err); this._error = extractApiErrorMessage(err);
} }
} }

View File

@ -26,7 +26,7 @@ export const suggestAddonRestart = async (
if (confirmed) { if (confirmed) {
try { try {
await restartHassioAddon(hass, addon.slug); await restartHassioAddon(hass, addon.slug);
} catch (err) { } catch (err: any) {
showAlertDialog(element, { showAlertDialog(element, {
title: supervisor.localize( title: supervisor.localize(
"common.failed_to_restart_name", "common.failed_to_restart_name",

View File

@ -148,7 +148,7 @@ class DialogSupervisorUpdate extends LitElement {
this.hass, this.hass,
this._dialogParams!.backupParams this._dialogParams!.backupParams
); );
} catch (err) { } catch (err: any) {
this._error = extractApiErrorMessage(err); this._error = extractApiErrorMessage(err);
this._action = null; this._action = null;
return; return;
@ -158,7 +158,7 @@ class DialogSupervisorUpdate extends LitElement {
this._action = "update"; this._action = "update";
try { try {
await this._dialogParams!.updateHandler!(); await this._dialogParams!.updateHandler!();
} catch (err) { } catch (err: any) {
if (this.hass.connection.connected && !ignoreSupervisorError(err)) { if (this.hass.connection.connected && !ignoreSupervisorError(err)) {
this._error = extractApiErrorMessage(err); this._error = extractApiErrorMessage(err);
this._action = null; this._action = null;

View File

@ -87,7 +87,7 @@ class HassioMyRedirect extends LitElement {
let url: string; let url: string;
try { try {
url = this._createRedirectUrl(redirect); url = this._createRedirectUrl(redirect);
} catch (err) { } catch (err: any) {
this._error = this.supervisor.localize("my.error"); this._error = this.supervisor.localize("my.error");
return; return;
} }

View File

@ -91,7 +91,7 @@ class HassioIngressView extends LitElement {
if (requestedAddon) { if (requestedAddon) {
try { try {
addonInfo = await fetchHassioAddonInfo(this.hass, requestedAddon); addonInfo = await fetchHassioAddonInfo(this.hass, requestedAddon);
} catch (err) { } catch (err: any) {
await showAlertDialog(this, { await showAlertDialog(this, {
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),
title: requestedAddon, title: requestedAddon,
@ -145,7 +145,7 @@ class HassioIngressView extends LitElement {
try { try {
addon = await fetchHassioAddonInfo(this.hass, addonSlug); addon = await fetchHassioAddonInfo(this.hass, addonSlug);
} catch (err) { } catch (err: any) {
await showAlertDialog(this, { await showAlertDialog(this, {
text: "Unable to fetch add-on info to start Ingress", text: "Unable to fetch add-on info to start Ingress",
title: "Supervisor", title: "Supervisor",
@ -179,7 +179,7 @@ class HassioIngressView extends LitElement {
try { try {
session = await createSessionPromise; session = await createSessionPromise;
} catch (err) { } catch (err: any) {
await showAlertDialog(this, { await showAlertDialog(this, {
text: "Unable to create an Ingress session", text: "Unable to create an Ingress session",
title: addon.name, title: addon.name,
@ -195,7 +195,7 @@ class HassioIngressView extends LitElement {
this._sessionKeepAlive = window.setInterval(async () => { this._sessionKeepAlive = window.setInterval(async () => {
try { try {
await validateHassioSession(this.hass, session); await validateHassioSession(this.hass, session);
} catch (err) { } catch (err: any) {
session = await createHassioSession(this.hass); session = await createHassioSession(this.hass);
} }
}, 60000); }, 60000);

View File

@ -144,7 +144,7 @@ class HassioCoreInfo extends LitElement {
try { try {
await restartCore(this.hass); await restartCore(this.hass);
} catch (err) { } catch (err: any) {
if (this.hass.connection.connected) { if (this.hass.connection.connected) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize( title: this.supervisor.localize(

View File

@ -247,7 +247,7 @@ class HassioHostInfo extends LitElement {
let hardware; let hardware;
try { try {
hardware = await fetchHassioHardwareInfo(this.hass); hardware = await fetchHassioHardwareInfo(this.hass);
} catch (err) { } catch (err: any) {
await showAlertDialog(this, { await showAlertDialog(this, {
title: this.supervisor.localize( title: this.supervisor.localize(
"system.host.failed_to_get_hardware_list" "system.host.failed_to_get_hardware_list"
@ -277,7 +277,7 @@ class HassioHostInfo extends LitElement {
try { try {
await rebootHost(this.hass); await rebootHost(this.hass);
} catch (err) { } catch (err: any) {
// Ignore connection errors, these are all expected // Ignore connection errors, these are all expected
if (this.hass.connection.connected && !ignoreSupervisorError(err)) { if (this.hass.connection.connected && !ignoreSupervisorError(err)) {
showAlertDialog(this, { showAlertDialog(this, {
@ -307,7 +307,7 @@ class HassioHostInfo extends LitElement {
try { try {
await shutdownHost(this.hass); await shutdownHost(this.hass);
} catch (err) { } catch (err: any) {
// Ignore connection errors, these are all expected // Ignore connection errors, these are all expected
if (this.hass.connection.connected && !ignoreSupervisorError(err)) { if (this.hass.connection.connected && !ignoreSupervisorError(err)) {
showAlertDialog(this, { showAlertDialog(this, {
@ -348,7 +348,7 @@ class HassioHostInfo extends LitElement {
try { try {
await updateOS(this.hass); await updateOS(this.hass);
fireEvent(this, "supervisor-collection-refresh", { collection: "os" }); fireEvent(this, "supervisor-collection-refresh", { collection: "os" });
} catch (err) { } catch (err: any) {
if (this.hass.connection.connected) { if (this.hass.connection.connected) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize( title: this.supervisor.localize(
@ -386,7 +386,7 @@ class HassioHostInfo extends LitElement {
fireEvent(this, "supervisor-collection-refresh", { fireEvent(this, "supervisor-collection-refresh", {
collection: "host", collection: "host",
}); });
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize("system.host.failed_to_set_hostname"), title: this.supervisor.localize("system.host.failed_to_set_hostname"),
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),
@ -401,7 +401,7 @@ class HassioHostInfo extends LitElement {
fireEvent(this, "supervisor-collection-refresh", { fireEvent(this, "supervisor-collection-refresh", {
collection: "host", collection: "host",
}); });
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize( title: this.supervisor.localize(
"system.host.failed_to_import_from_usb" "system.host.failed_to_import_from_usb"

View File

@ -282,7 +282,7 @@ class HassioSupervisorInfo extends LitElement {
}; };
await setSupervisorOption(this.hass, data); await setSupervisorOption(this.hass, data);
await this._reloadSupervisor(); await this._reloadSupervisor();
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize( title: this.supervisor.localize(
"system.supervisor.failed_to_set_option" "system.supervisor.failed_to_set_option"
@ -300,7 +300,7 @@ class HassioSupervisorInfo extends LitElement {
try { try {
await this._reloadSupervisor(); await this._reloadSupervisor();
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize("system.supervisor.failed_to_reload"), title: this.supervisor.localize("system.supervisor.failed_to_reload"),
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),
@ -343,7 +343,7 @@ class HassioSupervisorInfo extends LitElement {
try { try {
await restartSupervisor(this.hass); await restartSupervisor(this.hass);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize( title: this.supervisor.localize(
"common.failed_to_restart_name", "common.failed_to_restart_name",
@ -388,7 +388,7 @@ class HassioSupervisorInfo extends LitElement {
fireEvent(this, "supervisor-collection-refresh", { fireEvent(this, "supervisor-collection-refresh", {
collection: "supervisor", collection: "supervisor",
}); });
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize( title: this.supervisor.localize(
"common.failed_to_update_name", "common.failed_to_update_name",
@ -427,10 +427,10 @@ class HassioSupervisorInfo extends LitElement {
<li> <li>
${UNSUPPORTED_REASON_URL[reason] ${UNSUPPORTED_REASON_URL[reason]
? html`<a ? html`<a
href="${documentationUrl( href=${documentationUrl(
this.hass, this.hass,
UNSUPPORTED_REASON_URL[reason] UNSUPPORTED_REASON_URL[reason]
)}" )}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >
@ -458,10 +458,10 @@ class HassioSupervisorInfo extends LitElement {
<li> <li>
${UNHEALTHY_REASON_URL[reason] ${UNHEALTHY_REASON_URL[reason]
? html`<a ? html`<a
href="${documentationUrl( href=${documentationUrl(
this.hass, this.hass,
UNHEALTHY_REASON_URL[reason] UNHEALTHY_REASON_URL[reason]
)}" )}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >
@ -483,7 +483,7 @@ class HassioSupervisorInfo extends LitElement {
diagnostics: !this.supervisor.supervisor?.diagnostics, diagnostics: !this.supervisor.supervisor?.diagnostics,
}; };
await setSupervisorOption(this.hass, data); await setSupervisorOption(this.hass, data);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize( title: this.supervisor.localize(
"system.supervisor.failed_to_set_option" "system.supervisor.failed_to_set_option"

View File

@ -130,7 +130,7 @@ class HassioSupervisorLog extends LitElement {
this.hass, this.hass,
this._selectedLogProvider this._selectedLogProvider
); );
} catch (err) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize(
"system.log.get_logs", "system.log.get_logs",
"provider", "provider",

View File

@ -145,18 +145,18 @@
"xss": "^1.0.9" "xss": "^1.0.9"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.14.6", "@babel/core": "^7.15.5",
"@babel/plugin-external-helpers": "^7.14.5", "@babel/plugin-external-helpers": "^7.14.5",
"@babel/plugin-proposal-class-properties": "^7.14.5", "@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-decorators": "^7.14.5", "@babel/plugin-proposal-decorators": "^7.15.4",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
"@babel/plugin-proposal-object-rest-spread": "^7.14.7", "@babel/plugin-proposal-object-rest-spread": "^7.15.6",
"@babel/plugin-proposal-optional-chaining": "^7.14.5", "@babel/plugin-proposal-optional-chaining": "^7.14.5",
"@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.10.4", "@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/plugin-syntax-top-level-await": "^7.14.5", "@babel/plugin-syntax-top-level-await": "^7.14.5",
"@babel/preset-env": "^7.14.7", "@babel/preset-env": "^7.15.6",
"@babel/preset-typescript": "^7.14.5", "@babel/preset-typescript": "^7.15.0",
"@koa/cors": "^3.1.0", "@koa/cors": "^3.1.0",
"@open-wc/dev-server-hmr": "^0.0.2", "@open-wc/dev-server-hmr": "^0.0.2",
"@rollup/plugin-babel": "^5.2.1", "@rollup/plugin-babel": "^5.2.1",
@ -173,23 +173,24 @@
"@types/mocha": "^8", "@types/mocha": "^8",
"@types/sortablejs": "^1", "@types/sortablejs": "^1",
"@types/webspeechapi": "^0.0.29", "@types/webspeechapi": "^0.0.29",
"@typescript-eslint/eslint-plugin": "^4.28.3", "@typescript-eslint/eslint-plugin": "^4.32.0",
"@typescript-eslint/parser": "^4.28.3", "@typescript-eslint/parser": "^4.32.0",
"@web/dev-server": "^0.0.24", "@web/dev-server": "^0.0.24",
"@web/dev-server-rollup": "^0.2.11", "@web/dev-server-rollup": "^0.2.11",
"babel-loader": "^8.2.2", "babel-loader": "^8.2.2",
"chai": "^4.3.4", "chai": "^4.3.4",
"del": "^4.0.0", "del": "^4.0.0",
"eslint": "^7.30.0", "eslint": "^7.32.0",
"eslint-config-airbnb-typescript": "^12.3.1", "eslint-config-airbnb-base": "^14.2.1",
"eslint-config-airbnb-typescript": "^14.0.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-webpack": "^0.13.1", "eslint-import-resolver-webpack": "^0.13.1",
"eslint-plugin-disable": "^2.0.1", "eslint-plugin-disable": "^2.0.1",
"eslint-plugin-import": "^2.23.4", "eslint-plugin-import": "^2.24.2",
"eslint-plugin-lit": "^1.5.1", "eslint-plugin-lit": "^1.5.1",
"eslint-plugin-prettier": "^3.4.0", "eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-unused-imports": "^1.1.2", "eslint-plugin-unused-imports": "^1.1.5",
"eslint-plugin-wc": "^1.3.0", "eslint-plugin-wc": "^1.3.2",
"fancy-log": "^1.3.3", "fancy-log": "^1.3.3",
"fs-extra": "^7.0.1", "fs-extra": "^7.0.1",
"gulp": "^4.0.2", "gulp": "^4.0.2",
@ -201,7 +202,7 @@
"html-minifier": "^4.0.0", "html-minifier": "^4.0.0",
"husky": "^1.3.1", "husky": "^1.3.1",
"instant-mocha": "^1.3.1", "instant-mocha": "^1.3.1",
"lint-staged": "^11.0.1", "lint-staged": "^11.1.2",
"lit-analyzer": "^1.2.1", "lit-analyzer": "^1.2.1",
"lodash.template": "^4.5.0", "lodash.template": "^4.5.0",
"magic-string": "^0.25.7", "magic-string": "^0.25.7",
@ -210,7 +211,7 @@
"mocha": "^8.4.0", "mocha": "^8.4.0",
"object-hash": "^2.0.3", "object-hash": "^2.0.3",
"open": "^7.0.4", "open": "^7.0.4",
"prettier": "^2.3.2", "prettier": "^2.4.1",
"require-dir": "^1.2.0", "require-dir": "^1.2.0",
"rollup": "^2.8.2", "rollup": "^2.8.2",
"rollup-plugin-string": "^3.0.0", "rollup-plugin-string": "^3.0.0",
@ -222,7 +223,7 @@
"systemjs": "^6.3.2", "systemjs": "^6.3.2",
"terser-webpack-plugin": "^5.2.4", "terser-webpack-plugin": "^5.2.4",
"ts-lit-plugin": "^1.2.1", "ts-lit-plugin": "^1.2.1",
"typescript": "^4.3.5", "typescript": "^4.4.3",
"vinyl-buffer": "^1.0.1", "vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0", "vinyl-source-stream": "^2.0.0",
"webpack": "^5.55.1", "webpack": "^5.55.1",

View File

@ -194,7 +194,7 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
this._state = "error"; this._state = "error";
this._errorMessage = data.message; this._errorMessage = data.message;
} }
} catch (err) { } catch (err: any) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error("Error starting auth flow", err); console.error("Error starting auth flow", err);
this._state = "error"; this._state = "error";
@ -317,7 +317,7 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
return; return;
} }
await this._updateStep(newStep); await this._updateStep(newStep);
} catch (err) { } catch (err: any) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error("Error submitting step", err); console.error("Error submitting step", err);
this._state = "error"; this._state = "error";

View File

@ -76,20 +76,20 @@ class HaAuthorize extends litLocalizeLiteMixin(LitElement) {
${loggingInWith} ${loggingInWith}
<ha-auth-flow <ha-auth-flow
.resources="${this.resources}" .resources=${this.resources}
.clientId="${this.clientId}" .clientId=${this.clientId}
.redirectUri="${this.redirectUri}" .redirectUri=${this.redirectUri}
.oauth2State="${this.oauth2State}" .oauth2State=${this.oauth2State}
.authProvider="${this._authProvider}" .authProvider=${this._authProvider}
></ha-auth-flow> ></ha-auth-flow>
${inactiveProviders.length > 0 ${inactiveProviders.length > 0
? html` ? html`
<ha-pick-auth-provider <ha-pick-auth-provider
.resources="${this.resources}" .resources=${this.resources}
.clientId="${this.clientId}" .clientId=${this.clientId}
.authProviders="${inactiveProviders}" .authProviders=${inactiveProviders}
@pick-auth-provider="${this._handleAuthProviderPick}" @pick-auth-provider=${this._handleAuthProviderPick}
></ha-pick-auth-provider> ></ha-pick-auth-provider>
` `
: ""} : ""}
@ -158,7 +158,7 @@ class HaAuthorize extends litLocalizeLiteMixin(LitElement) {
this._authProviders = authProviders; this._authProviders = authProviders;
this._authProvider = authProviders[0]; this._authProvider = authProviders[0];
} catch (err) { } catch (err: any) {
// eslint-disable-next-line // eslint-disable-next-line
console.error("Error loading auth providers", err); console.error("Error loading auth providers", err);
} }

View File

@ -1,3 +1,4 @@
/* eslint-disable lit/prefer-static-styles */
import { html, LitElement, TemplateResult } from "lit"; import { html, LitElement, TemplateResult } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event"; import { fireEvent } from "../common/dom/fire_event";

View File

@ -1,6 +1,6 @@
import "@polymer/paper-item/paper-item"; import "@polymer/paper-item/paper-item";
import "@polymer/paper-item/paper-item-body"; import "@polymer/paper-item/paper-item-body";
import { html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { property } from "lit/decorators"; import { property } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event"; import { fireEvent } from "../common/dom/fire_event";
import "../components/ha-icon-next"; import "../components/ha-icon-next";
@ -18,14 +18,6 @@ class HaPickAuthProvider extends litLocalizeLiteMixin(LitElement) {
protected render() { protected render() {
return html` return html`
<style>
paper-item {
cursor: pointer;
}
p {
margin-top: 0;
}
</style>
<p>${this.localize("ui.panel.page-authorize.pick_auth_provider")}:</p> <p>${this.localize("ui.panel.page-authorize.pick_auth_provider")}:</p>
${this.authProviders.map( ${this.authProviders.map(
(provider) => html` (provider) => html`
@ -41,5 +33,14 @@ class HaPickAuthProvider extends litLocalizeLiteMixin(LitElement) {
private _handlePick(ev) { private _handlePick(ev) {
fireEvent(this, "pick-auth-provider", ev.currentTarget.auth_provider); fireEvent(this, "pick-auth-provider", ev.currentTarget.auth_provider);
} }
static styles = css`
paper-item {
cursor: pointer;
}
p {
margin-top: 0;
}
`;
} }
customElements.define("ha-pick-auth-provider", HaPickAuthProvider); customElements.define("ha-pick-auth-provider", HaPickAuthProvider);

View File

@ -33,7 +33,7 @@ export function saveTokens(tokens: AuthData | null) {
if (tokenCache.writeEnabled) { if (tokenCache.writeEnabled) {
try { try {
storage.hassTokens = JSON.stringify(tokens); storage.hassTokens = JSON.stringify(tokens);
} catch (err) { } catch (err: any) {
// write failed, ignore it. Happens if storage is full or private mode. // write failed, ignore it. Happens if storage is full or private mode.
} }
} }
@ -58,7 +58,7 @@ export function loadTokens() {
} else { } else {
tokenCache.tokens = null; tokenCache.tokens = null;
} }
} catch (err) { } catch (err: any) {
tokenCache.tokens = null; tokenCache.tokens = null;
} }
} }

View File

@ -74,7 +74,7 @@ class Storage {
this._storage[storageKey] = value; this._storage[storageKey] = value;
try { try {
window.localStorage.setItem(storageKey, JSON.stringify(value)); window.localStorage.setItem(storageKey, JSON.stringify(value));
} catch (err) { } catch (err: any) {
// Safari in private mode doesn't allow localstorage // Safari in private mode doesn't allow localstorage
} }
} }

View File

@ -167,7 +167,7 @@ const processTheme = (
const prefixedRgbKey = `--${rgbKey}`; const prefixedRgbKey = `--${rgbKey}`;
styles[prefixedRgbKey] = rgbValue; styles[prefixedRgbKey] = rgbValue;
keys[prefixedRgbKey] = ""; keys[prefixedRgbKey] = "";
} catch (e) { } catch (err: any) {
continue; continue;
} }
} }

View File

@ -5,4 +5,4 @@ export const mainWindow =
? window ? window
: parent.name === MAIN_WINDOW_NAME : parent.name === MAIN_WINDOW_NAME
? parent ? parent
: top; : top!;

View File

@ -51,10 +51,10 @@ export const formatNumber = (
locale, locale,
getDefaultFormatOptions(num, options) getDefaultFormatOptions(num, options)
).format(Number(num)); ).format(Number(num));
} catch (error) { } catch (err: any) {
// Don't fail when using "TEST" language // Don't fail when using "TEST" language
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(error); console.error(err);
return new Intl.NumberFormat( return new Intl.NumberFormat(
undefined, undefined,
getDefaultFormatOptions(num, options) getDefaultFormatOptions(num, options)

View File

@ -108,7 +108,7 @@ export const computeLocalize = async (
language, language,
formats formats
); );
} catch (err) { } catch (err: any) {
return "Translation error: " + err.message; return "Translation error: " + err.message;
} }
cache._localizationCache[messageKey] = translatedMessage; cache._localizationCache[messageKey] = translatedMessage;
@ -125,7 +125,7 @@ export const computeLocalize = async (
try { try {
return translatedMessage.format<string>(argObject) as string; return translatedMessage.format<string>(argObject) as string;
} catch (err) { } catch (err: any) {
return "Translation " + err; return "Translation " + err;
} }
}; };

View File

@ -25,7 +25,7 @@ export default function parseAspectRatio(input: string) {
return arr.length === 1 return arr.length === 1
? { w: parseOrThrow(arr[0]), h: 1 } ? { w: parseOrThrow(arr[0]), h: 1 }
: { w: parseOrThrow(arr[0]), h: parseOrThrow(arr[1]) }; : { w: parseOrThrow(arr[0]), h: parseOrThrow(arr[1]) };
} catch (err) { } catch (err: any) {
// Ignore the error // Ignore the error
} }
return null; return null;

View File

@ -50,7 +50,7 @@ class HaCallApiButton extends LitElement {
this._progressButton.actionSuccess(); this._progressButton.actionSuccess();
eventData.success = true; eventData.success = true;
eventData.response = resp; eventData.response = resp;
} catch (err) { } catch (err: any) {
this.progress = false; this.progress = false;
this._progressButton.actionError(); this._progressButton.actionError();
eventData.success = false; eventData.success = false;

View File

@ -50,6 +50,7 @@ interface AreaDevices {
devices: string[]; devices: string[];
} }
// eslint-disable-next-line lit/prefer-static-styles
const rowRenderer: ComboBoxLitRenderer<AreaDevices> = (item) => html`<style> const rowRenderer: ComboBoxLitRenderer<AreaDevices> = (item) => html`<style>
paper-item { paper-item {
padding: 0; padding: 0;

View File

@ -46,6 +46,7 @@ export type HaDevicePickerDeviceFilterFunc = (
device: DeviceRegistryEntry device: DeviceRegistryEntry
) => boolean; ) => boolean;
// eslint-disable-next-line lit/prefer-static-styles
const rowRenderer: ComboBoxLitRenderer<Device> = (item) => html`<style> const rowRenderer: ComboBoxLitRenderer<Device> = (item) => html`<style>
paper-item { paper-item {
padding: 0; padding: 0;

View File

@ -23,6 +23,7 @@ import "./state-badge";
export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean; export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;
// eslint-disable-next-line lit/prefer-static-styles
const rowRenderer: ComboBoxLitRenderer<string> = (item) => html`<style> const rowRenderer: ComboBoxLitRenderer<string> = (item) => html`<style>
paper-item { paper-item {
padding: 0; padding: 0;

View File

@ -26,6 +26,7 @@ import "./state-badge";
export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean; export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;
// eslint-disable-next-line lit/prefer-static-styles
const rowRenderer: ComboBoxLitRenderer<HassEntity> = (item) => html`<style> const rowRenderer: ComboBoxLitRenderer<HassEntity> = (item) => html`<style>
paper-icon-item { paper-icon-item {
padding: 0; padding: 0;

View File

@ -57,11 +57,11 @@ export class HaStateLabelBadge extends LitElement {
return html` return html`
<ha-label-badge <ha-label-badge
class="warning" class="warning"
label="${this.hass!.localize("state_badge.default.error")}" label=${this.hass!.localize("state_badge.default.error")}
icon="hass:alert" icon="hass:alert"
description="${this.hass!.localize( description=${this.hass!.localize(
"state_badge.default.entity_not_found" "state_badge.default.entity_not_found"
)}" )}
></ha-label-badge> ></ha-label-badge>
`; `;
} }
@ -70,27 +70,25 @@ export class HaStateLabelBadge extends LitElement {
return html` return html`
<ha-label-badge <ha-label-badge
class="${classMap({ class=${classMap({
[domain]: true, [domain]: true,
"has-unit_of_measurement": "has-unit_of_measurement":
"unit_of_measurement" in entityState.attributes, "unit_of_measurement" in entityState.attributes,
})}" })}
.value="${this._computeValue(domain, entityState)}" .value=${this._computeValue(domain, entityState)}
.icon="${this.icon .icon=${this.icon ? this.icon : this._computeIcon(domain, entityState)}
? this.icon .image=${this.icon
: this._computeIcon(domain, entityState)}"
.image="${this.icon
? "" ? ""
: this.image : this.image
? this.image ? this.image
: entityState.attributes.entity_picture_local || : entityState.attributes.entity_picture_local ||
entityState.attributes.entity_picture}" entityState.attributes.entity_picture}
.label="${this._computeLabel( .label=${this._computeLabel(
domain, domain,
entityState, entityState,
this._timerTimeRemaining this._timerTimeRemaining
)}" )}
.description="${this.name ? this.name : computeStateName(entityState)}" .description=${this.name ? this.name : computeStateName(entityState)}
></ha-label-badge> ></ha-label-badge>
`; `;
} }

View File

@ -77,6 +77,7 @@ export class HaStatisticPicker extends LitElement {
id: string; id: string;
name: string; name: string;
state?: HassEntity; state?: HassEntity;
// eslint-disable-next-line lit/prefer-static-styles
}> = (item) => html`<style> }> = (item) => html`<style>
paper-icon-item { paper-icon-item {
padding: 0; padding: 0;
@ -110,7 +111,7 @@ export class HaStatisticPicker extends LitElement {
? html`<a ? html`<a
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
href="${documentationUrl(this.hass, "/more-info/statistics/")}" href=${documentationUrl(this.hass, "/more-info/statistics/")}
>${this.hass.localize( >${this.hass.localize(
"ui.components.statistic-picker.learn_more" "ui.components.statistic-picker.learn_more"
)}</a )}</a

View File

@ -12,6 +12,7 @@ import { PolymerChangedEvent } from "../polymer-types";
import { HomeAssistant } from "../types"; import { HomeAssistant } from "../types";
import { HaComboBox } from "./ha-combo-box"; import { HaComboBox } from "./ha-combo-box";
// eslint-disable-next-line lit/prefer-static-styles
const rowRenderer: ComboBoxLitRenderer<HassioAddonInfo> = (item) => html`<style> const rowRenderer: ComboBoxLitRenderer<HassioAddonInfo> = (item) => html`<style>
paper-item { paper-item {
padding: 0; padding: 0;
@ -109,7 +110,7 @@ class HaAddonPicker extends LitElement {
), ),
}); });
} }
} catch (error) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.hass.localize( title: this.hass.localize(
"ui.componencts.addon-picker.error.fetch_addons.title" "ui.componencts.addon-picker.error.fetch_addons.title"

View File

@ -46,6 +46,7 @@ import "./ha-svg-icon";
const rowRenderer: ComboBoxLitRenderer<AreaRegistryEntry> = ( const rowRenderer: ComboBoxLitRenderer<AreaRegistryEntry> = (
item item
// eslint-disable-next-line lit/prefer-static-styles
) => html`<style> ) => html`<style>
paper-item { paper-item {
padding: 0; padding: 0;
@ -435,7 +436,7 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) {
}); });
this._areas = [...this._areas!, area]; this._areas = [...this._areas!, area];
this._setValue(area.area_id); this._setValue(area.area_id);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.components.area-picker.add_dialog.failed_create_area" "ui.components.area-picker.add_dialog.failed_create_area"

View File

@ -117,7 +117,7 @@ class HaCameraStream extends LitElement {
); );
this._url = url; this._url = url;
} catch (err) { } catch (err: any) {
// Fails if we were unable to get a stream // Fails if we were unable to get a stream
// eslint-disable-next-line // eslint-disable-next-line
console.error(err); console.error(err);

View File

@ -13,6 +13,7 @@ import { PolymerChangedEvent } from "../polymer-types";
import { HomeAssistant } from "../types"; import { HomeAssistant } from "../types";
import "./ha-svg-icon"; import "./ha-svg-icon";
// eslint-disable-next-line lit/prefer-static-styles
const defaultRowRenderer: ComboBoxLitRenderer<string> = (item) => html`<style> const defaultRowRenderer: ComboBoxLitRenderer<string> = (item) => html`<style>
paper-item { paper-item {
margin: -5px -10px; margin: -5px -10px;

View File

@ -26,10 +26,10 @@ class HaLabelBadge extends LitElement {
<div class="badge-container"> <div class="badge-container">
<div class="label-badge" id="badge"> <div class="label-badge" id="badge">
<div <div
class="${classMap({ class=${classMap({
value: true, value: true,
big: Boolean(this.value && this.value.length > 4), big: Boolean(this.value && this.value.length > 4),
})}" })}
> >
<slot> <slot>
${this.icon && !this.value && !this.image ${this.icon && !this.value && !this.image
@ -43,10 +43,10 @@ class HaLabelBadge extends LitElement {
${this.label ${this.label
? html` ? html`
<div <div
class="${classMap({ class=${classMap({
label: true, label: true,
big: this.label.length > 5, big: this.label.length > 5,
})}" })}
> >
<span>${this.label}</span> <span>${this.label}</span>
</div> </div>

View File

@ -38,9 +38,8 @@ class HaMarkdownElement extends ReactiveElement {
const walker = document.createTreeWalker( const walker = document.createTreeWalker(
this, this,
1 /* SHOW_ELEMENT */, NodeFilter.SHOW_ELEMENT,
null, null
false
); );
while (walker.nextNode()) { while (walker.nextNode()) {

View File

@ -89,7 +89,7 @@ export class HaPictureUpload extends LitElement {
const media = await createImage(this.hass, file); const media = await createImage(this.hass, file);
this.value = generateImageThumbnailUrl(media.id, this.size); this.value = generateImageThumbnailUrl(media.id, this.size);
fireEvent(this, "change"); fireEvent(this, "change");
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
text: err.toString(), text: err.toString(),
}); });

View File

@ -162,7 +162,7 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
<li> <li>
<button <button
@click=${this._openMoreInfo} @click=${this._openMoreInfo}
.entityId="${entityId}" .entityId=${entityId}
class="link" class="link"
> >
${entity.attributes.friendly_name || entityId} ${entity.attributes.friendly_name || entityId}
@ -187,7 +187,7 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
<button <button
class="link" class="link"
@click=${this._openMoreInfo} @click=${this._openMoreInfo}
.entityId="${groupId}" .entityId=${groupId}
> >
${group.attributes.friendly_name || group.entity_id} ${group.attributes.friendly_name || group.entity_id}
</button> </button>
@ -212,7 +212,7 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
<button <button
class="link" class="link"
@click=${this._openMoreInfo} @click=${this._openMoreInfo}
.entityId="${sceneId}" .entityId=${sceneId}
> >
${scene.attributes.friendly_name || scene.entity_id} ${scene.attributes.friendly_name || scene.entity_id}
</button> </button>
@ -239,7 +239,7 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
<button <button
class="link" class="link"
@click=${this._openMoreInfo} @click=${this._openMoreInfo}
.entityId="${automationId}" .entityId=${automationId}
> >
${automation.attributes.friendly_name || ${automation.attributes.friendly_name ||
automation.entity_id} automation.entity_id}
@ -267,7 +267,7 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
<button <button
class="link" class="link"
@click=${this._openMoreInfo} @click=${this._openMoreInfo}
.entityId="${scriptId}" .entityId=${scriptId}
> >
${script.attributes.friendly_name || script.entity_id} ${script.attributes.friendly_name || script.entity_id}
</button> </button>

View File

@ -197,10 +197,10 @@ export class HaServiceControl extends LitElement {
<p>${serviceData?.description}</p> <p>${serviceData?.description}</p>
${this._manifest ${this._manifest
? html` <a ? html` <a
href="${this._manifest.documentation}" href=${this._manifest.documentation}
title="${this.hass.localize( title=${this.hass.localize(
"ui.components.service-control.integration_doc" "ui.components.service-control.integration_doc"
)}" )}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >
@ -406,7 +406,7 @@ export class HaServiceControl extends LitElement {
this._manifest = undefined; this._manifest = undefined;
try { try {
this._manifest = await fetchIntegrationManifest(this.hass, integration); this._manifest = await fetchIntegrationManifest(this.hass, integration);
} catch (err) { } catch (err: any) {
// Ignore if loading manifest fails. Probably bad JSON in manifest // Ignore if loading manifest fails. Probably bad JSON in manifest
} }
} }

View File

@ -11,6 +11,7 @@ import "./ha-combo-box";
const rowRenderer: ComboBoxLitRenderer<{ service: string; name: string }> = ( const rowRenderer: ComboBoxLitRenderer<{ service: string; name: string }> = (
item item
// eslint-disable-next-line lit/prefer-static-styles
) => html`<style> ) => html`<style>
paper-item { paper-item {
padding: 0; padding: 0;

View File

@ -36,7 +36,7 @@ export class HaYamlEditor extends LitElement {
value && !isEmpty(value) value && !isEmpty(value)
? dump(value, { schema: this.yamlSchema }) ? dump(value, { schema: this.yamlSchema })
: ""; : "";
} catch (err) { } catch (err: any) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(err, value); console.error(err, value);
alert(`There was an error converting to YAML: ${err}`); alert(`There was an error converting to YAML: ${err}`);
@ -73,7 +73,7 @@ export class HaYamlEditor extends LitElement {
if (this._yaml) { if (this._yaml) {
try { try {
parsed = load(this._yaml, { schema: this.yamlSchema }); parsed = load(this._yaml, { schema: this.yamlSchema });
} catch (err) { } catch (err: any) {
// Invalid YAML // Invalid YAML
isValid = false; isValid = false;
} }

View File

@ -375,10 +375,10 @@ export class HaMediaPlayerBrowse extends LitElement {
"ui.components.media-browser.learn_adding_local_media", "ui.components.media-browser.learn_adding_local_media",
"documentation", "documentation",
html`<a html`<a
href="${documentationUrl( href=${documentationUrl(
this.hass, this.hass,
"/more-info/local-media/add-media" "/more-info/local-media/add-media"
)}" )}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>${this.hass.localize( >${this.hass.localize(
@ -510,7 +510,7 @@ export class HaMediaPlayerBrowse extends LitElement {
item.media_content_id, item.media_content_id,
item.media_content_type item.media_content_type
); );
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.hass.localize( title: this.hass.localize(
"ui.components.media-browser.media_browsing_error" "ui.components.media-browser.media_browsing_error"
@ -591,10 +591,10 @@ export class HaMediaPlayerBrowse extends LitElement {
"ui.components.media-browser.setup_local_help", "ui.components.media-browser.setup_local_help",
"documentation", "documentation",
html`<a html`<a
href="${documentationUrl( href=${documentationUrl(
this.hass, this.hass,
"/more-info/local-media/setup-media" "/more-info/local-media/setup-media"
)}" )}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>${this.hass.localize( >${this.hass.localize(

View File

@ -88,7 +88,7 @@ export class HatGraphBranch extends LitElement {
` `
: ""} : ""}
<div id="branches"> <div id="branches">
<svg id="lines" width="${this._totalWidth}" height="${this._maxHeight}"> <svg id="lines" width=${this._totalWidth} height=${this._maxHeight}>
${this._branches.map((branch) => { ${this._branches.map((branch) => {
if (branch.end) return ""; if (branch.end) return "";
return svg` return svg`

View File

@ -453,7 +453,7 @@ export class HatScriptGraph extends LitElement {
</mwc-icon-button> </mwc-icon-button>
</div> </div>
`; `;
} catch (err) { } catch (err: any) {
if (__DEV__) { if (__DEV__) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log("Error creating script graph:", err); console.log("Error creating script graph:", err);

View File

@ -239,7 +239,7 @@ class ActionRenderer {
let data; let data;
try { try {
data = getDataFromPath(this.trace.config, path); data = getDataFromPath(this.trace.config, path);
} catch (err) { } catch (err: any) {
this._renderEntry( this._renderEntry(
path, path,
`Unable to extract path ${path}. Download trace and report as bug` `Unable to extract path ${path}. Download trace and report as bug`

View File

@ -136,7 +136,7 @@ export const getRecentWithCache = (
), ),
]); ]);
fetchedHistory = results[1]; fetchedHistory = results[1];
} catch (err) { } catch (err: any) {
delete stateHistoryCache[cacheKey]; delete stateHistoryCache[cacheKey];
throw err; throw err;
} }

View File

@ -63,7 +63,7 @@ export const getOptimisticCollection = <StateType>(
try { try {
return await saveCollection(conn, data); return await saveCollection(conn, data);
} catch (err) { } catch (err: any) {
if (store) { if (store) {
store.setState(current as any, true); store.setState(current as any, true);
} }

View File

@ -103,7 +103,7 @@ export const getLogbookDataCache = async (
DATA_CACHE[cacheKey] = {}; DATA_CACHE[cacheKey] = {};
} }
if (DATA_CACHE[cacheKey][entityId]) { if (entityId in DATA_CACHE[cacheKey]) {
return DATA_CACHE[cacheKey][entityId]; return DATA_CACHE[cacheKey][entityId];
} }

View File

@ -121,7 +121,7 @@ class DialogConfigEntrySystemOptions extends LitElement {
</mwc-button> </mwc-button>
<mwc-button <mwc-button
slot="primaryAction" slot="primaryAction"
@click="${this._updateEntry}" @click=${this._updateEntry}
.disabled=${this._submitting} .disabled=${this._submitting}
> >
${this.hass.localize("ui.dialogs.config_entry_system_options.update")} ${this.hass.localize("ui.dialogs.config_entry_system_options.update")}
@ -171,7 +171,7 @@ class DialogConfigEntrySystemOptions extends LitElement {
} }
this._params!.entryUpdated(result.config_entry); this._params!.entryUpdated(result.config_entry);
this.closeDialog(); this.closeDialog();
} catch (err) { } catch (err: any) {
this._error = err.message || "Unknown error"; this._error = err.message || "Unknown error";
} finally { } finally {
this._submitting = false; this._submitting = false;

View File

@ -115,7 +115,7 @@ class DataEntryFlowDialog extends LitElement {
this.hass, this.hass,
params.continueFlowId params.continueFlowId
); );
} catch (err) { } catch (err: any) {
this._step = undefined; this._step = undefined;
this._params = undefined; this._params = undefined;
showAlertDialog(this, { showAlertDialog(this, {
@ -370,7 +370,7 @@ class DataEntryFlowDialog extends LitElement {
let step: DataEntryFlowStep; let step: DataEntryFlowStep;
try { try {
step = await this._params!.flowConfig.createFlow(this.hass, handler); step = await this._params!.flowConfig.createFlow(this.hass, handler);
} catch (err) { } catch (err: any) {
this._step = undefined; this._step = undefined;
this._params = undefined; this._params = undefined;
showAlertDialog(this, { showAlertDialog(this, {

View File

@ -26,7 +26,7 @@ class StepFlowAbort extends LitElement {
${this.flowConfig.renderAbortDescription(this.hass, this.step)} ${this.flowConfig.renderAbortDescription(this.hass, this.step)}
</div> </div>
<div class="buttons"> <div class="buttons">
<mwc-button @click="${this._flowDone}" <mwc-button @click=${this._flowDone}
>${this.hass.localize( >${this.hass.localize(
"ui.panel.config.integrations.config_flow.close" "ui.panel.config.integrations.config_flow.close"
)}</mwc-button )}</mwc-button

View File

@ -65,7 +65,7 @@ class StepFlowCreateEntry extends LitElement {
`} `}
</div> </div>
<div class="buttons"> <div class="buttons">
<mwc-button @click="${this._flowDone}" <mwc-button @click=${this._flowDone}
>${localize( >${localize(
"ui.panel.config.integrations.config_flow.finish" "ui.panel.config.integrations.config_flow.finish"
)}</mwc-button )}</mwc-button
@ -87,7 +87,7 @@ class StepFlowCreateEntry extends LitElement {
await updateDeviceRegistryEntry(this.hass, device, { await updateDeviceRegistryEntry(this.hass, device, {
area_id: area, area_id: area,
}); });
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.panel.config.integrations.config_flow.error_saving_area", "ui.panel.config.integrations.config_flow.error_saving_area",

View File

@ -159,7 +159,7 @@ class StepFlowForm extends LitElement {
fireEvent(this, "flow-update", { fireEvent(this, "flow-update", {
step, step,
}); });
} catch (err) { } catch (err: any) {
this._errorMsg = this._errorMsg =
(err && err.body && err.body.message) || "Unknown error occurred"; (err && err.body && err.body.message) || "Unknown error occurred";
} finally { } finally {

View File

@ -118,12 +118,12 @@ class StepFlowPickHandler extends LitElement {
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.integrations.note_about_website_reference" "ui.panel.config.integrations.note_about_website_reference"
)}<a )}<a
href="${documentationUrl( href=${documentationUrl(
this.hass, this.hass,
`/integrations/${ `/integrations/${
this._filter ? `#search/${this._filter}` : "" this._filter ? `#search/${this._filter}` : ""
}` }`
)}" )}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>${this.hass.localize( >${this.hass.localize(

View File

@ -84,7 +84,7 @@ export const showDialog = async (
{ dialog: dialogTag, dialogParams: dialogParams, open: true }, { dialog: dialogTag, dialogParams: dialogParams, open: true },
"" ""
); );
} catch (err) { } catch (err: any) {
// dialogParams could not be cloned, probably contains callback // dialogParams could not be cloned, probably contains callback
mainWindow.history.pushState( mainWindow.history.pushState(
{ dialog: dialogTag, dialogParams: null, open: true }, { dialog: dialogTag, dialogParams: null, open: true },

View File

@ -106,7 +106,7 @@ class MoreInfoCamera extends LitElement {
preload_stream: checkbox.checked!, preload_stream: checkbox.checked!,
} }
); );
} catch (err) { } catch (err: any) {
alert(err.message); alert(err.message);
checkbox.checked = !checkbox.checked; checkbox.checked = !checkbox.checked;
} }

View File

@ -21,21 +21,21 @@ class MoreInfoCounter extends LitElement {
return html` return html`
<div class="actions"> <div class="actions">
<mwc-button <mwc-button
.action="${"increment"}" .action=${"increment"}
@click=${this._handleActionClick} @click=${this._handleActionClick}
.disabled=${disabled} .disabled=${disabled}
> >
${this.hass!.localize("ui.card.counter.actions.increment")} ${this.hass!.localize("ui.card.counter.actions.increment")}
</mwc-button> </mwc-button>
<mwc-button <mwc-button
.action="${"decrement"}" .action=${"decrement"}
@click=${this._handleActionClick} @click=${this._handleActionClick}
.disabled=${disabled} .disabled=${disabled}
> >
${this.hass!.localize("ui.card.counter.actions.decrement")} ${this.hass!.localize("ui.card.counter.actions.decrement")}
</mwc-button> </mwc-button>
<mwc-button <mwc-button
.action="${"reset"}" .action=${"reset"}
@click=${this._handleActionClick} @click=${this._handleActionClick}
.disabled=${disabled} .disabled=${disabled}
> >

View File

@ -27,26 +27,17 @@ class MoreInfoTimer extends LitElement {
: ""} : ""}
${this.stateObj.state === "active" ${this.stateObj.state === "active"
? html` ? html`
<mwc-button <mwc-button .action=${"pause"} @click=${this._handleActionClick}>
.action=${"pause"}
@click="${this._handleActionClick}"
>
${this.hass!.localize("ui.card.timer.actions.pause")} ${this.hass!.localize("ui.card.timer.actions.pause")}
</mwc-button> </mwc-button>
` `
: ""} : ""}
${this.stateObj.state === "active" || this.stateObj.state === "paused" ${this.stateObj.state === "active" || this.stateObj.state === "paused"
? html` ? html`
<mwc-button <mwc-button .action=${"cancel"} @click=${this._handleActionClick}>
.action=${"cancel"}
@click="${this._handleActionClick}"
>
${this.hass!.localize("ui.card.timer.actions.cancel")} ${this.hass!.localize("ui.card.timer.actions.cancel")}
</mwc-button> </mwc-button>
<mwc-button <mwc-button .action=${"finish"} @click=${this._handleActionClick}>
.action=${"finish"}
@click="${this._handleActionClick}"
>
${this.hass!.localize("ui.card.timer.actions.finish")} ${this.hass!.localize("ui.card.timer.actions.finish")}
</mwc-button> </mwc-button>
` `

View File

@ -175,7 +175,7 @@ class MoreInfoWeather extends LitElement {
${item.condition ${item.condition
? html` ? html`
<ha-svg-icon <ha-svg-icon
.path="${weatherIcons[item.condition]}" .path=${weatherIcons[item.condition]}
></ha-svg-icon> ></ha-svg-icon>
` `
: ""} : ""}

View File

@ -141,7 +141,7 @@ export class MoreInfoLogbook extends LitElement {
this.hass.user?.is_admin ? loadTraceContexts(this.hass) : {}, this.hass.user?.is_admin ? loadTraceContexts(this.hass) : {},
this._fetchUserPromise, this._fetchUserPromise,
]); ]);
} catch (err) { } catch (err: any) {
this._error = err.message; this._error = err.message;
} }

View File

@ -33,7 +33,7 @@ export class HuiConfiguratorNotificationItem extends LitElement {
)} )}
</div> </div>
<mwc-button slot="actions" @click="${this._handleClick}" <mwc-button slot="actions" @click=${this._handleClick}
>${computeStateDisplay( >${computeStateDisplay(
this.hass.localize, this.hass.localize,
this.notification, this.notification,

View File

@ -29,13 +29,13 @@ export class HuiNotificationItem extends LitElement {
? html` ? html`
<configurator-notification-item <configurator-notification-item
.hass=${this.hass} .hass=${this.hass}
.notification="${this.notification}" .notification=${this.notification}
></configurator-notification-item> ></configurator-notification-item>
` `
: html` : html`
<persistent-notification-item <persistent-notification-item
.hass=${this.hass} .hass=${this.hass}
.notification="${this.notification}" .notification=${this.notification}
></persistent-notification-item> ></persistent-notification-item>
`; `;
} }

View File

@ -24,16 +24,13 @@ export class HuiPersistentNotificationItem extends LitElement {
<notification-item-template> <notification-item-template>
<span slot="header"> ${this.notification.title} </span> <span slot="header"> ${this.notification.title} </span>
<ha-markdown <ha-markdown breaks content=${this.notification.message}></ha-markdown>
breaks
content="${this.notification.message}"
></ha-markdown>
<div class="time"> <div class="time">
<span> <span>
<ha-relative-time <ha-relative-time
.hass=${this.hass} .hass=${this.hass}
.datetime="${this.notification.created_at}" .datetime=${this.notification.created_at}
></ha-relative-time> ></ha-relative-time>
<paper-tooltip animation-delay="0"> <paper-tooltip animation-delay="0">
${this._computeTooltip(this.hass, this.notification)} ${this._computeTooltip(this.hass, this.notification)}
@ -41,7 +38,7 @@ export class HuiPersistentNotificationItem extends LitElement {
</span> </span>
</div> </div>
<mwc-button slot="actions" @click="${this._handleDismiss}" <mwc-button slot="actions" @click=${this._handleDismiss}
>${this.hass.localize( >${this.hass.localize(
"ui.card.persistent_notification.dismiss" "ui.card.persistent_notification.dismiss"
)}</mwc-button )}</mwc-button

View File

@ -271,7 +271,7 @@ export class QuickBar extends LitElement {
> >
<span> <span>
<ha-chip <ha-chip
.label="${item.categoryText}" .label=${item.categoryText}
hasIcon hasIcon
class="command-category ${item.categoryKey}" class="command-category ${item.categoryKey}"
> >

View File

@ -1,3 +1,4 @@
/* eslint-disable lit/prefer-static-styles */
import "@polymer/paper-dialog-scrollable/paper-dialog-scrollable"; import "@polymer/paper-dialog-scrollable/paper-dialog-scrollable";
import type { PaperDialogScrollableElement } from "@polymer/paper-dialog-scrollable/paper-dialog-scrollable"; import type { PaperDialogScrollableElement } from "@polymer/paper-dialog-scrollable/paper-dialog-scrollable";
import "@polymer/paper-input/paper-input"; import "@polymer/paper-input/paper-input";
@ -114,7 +115,7 @@ export class HaVoiceCommandDialog extends LitElement {
<div class="side-by-side" @click=${this._completeOnboarding}> <div class="side-by-side" @click=${this._completeOnboarding}>
<a <a
class="button" class="button"
href="${this._agentInfo.onboarding.url}" href=${this._agentInfo.onboarding.url}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
><mwc-button unelevated ><mwc-button unelevated
@ -138,7 +139,7 @@ export class HaVoiceCommandDialog extends LitElement {
> >
${this._conversation.map( ${this._conversation.map(
(message) => html` (message) => html`
<div class="${this._computeMessageClasses(message)}"> <div class=${this._computeMessageClasses(message)}>
${message.text} ${message.text}
</div> </div>
` `
@ -159,11 +160,11 @@ export class HaVoiceCommandDialog extends LitElement {
<div class="input"> <div class="input">
<paper-input <paper-input
@keyup=${this._handleKeyUp} @keyup=${this._handleKeyUp}
.label="${this.hass.localize( .label=${this.hass.localize(
`ui.dialogs.voice_command.${ `ui.dialogs.voice_command.${
SpeechRecognition ? "label_voice" : "label" SpeechRecognition ? "label_voice" : "label"
}` }`
)}" )}
autofocus autofocus
> >
${SpeechRecognition ${SpeechRecognition

View File

@ -68,7 +68,7 @@ const connProm = async (auth) => {
} }
return { auth, conn }; return { auth, conn };
} catch (err) { } catch (err: any) {
if (err !== ERR_INVALID_AUTH) { if (err !== ERR_INVALID_AUTH) {
throw err; throw err;
} }

View File

@ -71,7 +71,7 @@ export class ExternalAuth extends Auth {
try { try {
await this._tokenCallbackPromise; await this._tokenCallbackPromise;
return; return;
} catch (e) { } catch (err: any) {
// _tokenCallbackPromise is in a rejected state // _tokenCallbackPromise is in a rejected state
// Clear the _tokenCallbackPromise and go on refreshing access token // Clear the _tokenCallbackPromise and go on refreshing access token
this._tokenCallbackPromise = undefined; this._tokenCallbackPromise = undefined;

View File

@ -1,3 +1,4 @@
/* eslint-plugin-disable lit */
/** /**
@license @license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved. Copyright (c) 2015 The Polymer Project Authors. All rights reserved.

View File

@ -169,7 +169,7 @@ export class HaTabsSubpageDataTable extends LitElement {
? html`<div class="active-filters"> ? html`<div class="active-filters">
${this.narrow ${this.narrow
? html`<div> ? html`<div>
<ha-svg-icon .path="${mdiFilterVariant}"></ha-svg-icon> <ha-svg-icon .path=${mdiFilterVariant}></ha-svg-icon>
<paper-tooltip animation-delay="0" position="left"> <paper-tooltip animation-delay="0" position="left">
${filterInfo} ${filterInfo}
</paper-tooltip> </paper-tooltip>

View File

@ -178,7 +178,7 @@ class HassTabsSubpage extends LitElement {
> >
<slot></slot> <slot></slot>
</div> </div>
<div id="fab" class="${classMap({ tabs: showTabs })}"> <div id="fab" class=${classMap({ tabs: showTabs })}>
<slot name="fab"></slot> <slot name="fab"></slot>
</div> </div>
`; `;

View File

@ -1,3 +1,4 @@
/* eslint-disable lit/prefer-static-styles */
import "@polymer/app-layout/app-drawer-layout/app-drawer-layout"; import "@polymer/app-layout/app-drawer-layout/app-drawer-layout";
import type { AppDrawerLayoutElement } from "@polymer/app-layout/app-drawer-layout/app-drawer-layout"; import type { AppDrawerLayoutElement } from "@polymer/app-layout/app-drawer-layout/app-drawer-layout";
import "@polymer/app-layout/app-drawer/app-drawer"; import "@polymer/app-layout/app-drawer/app-drawer";

View File

@ -145,10 +145,12 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
if (registration) { if (registration) {
registration.update(); registration.update();
} else { } else {
// @ts-ignore Firefox supports forceGet
location.reload(true); location.reload(true);
} }
}); });
} else { } else {
// @ts-ignore Firefox supports forceGet
location.reload(true); location.reload(true);
} }
} }
@ -170,7 +172,7 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
const { auth, conn } = result; const { auth, conn } = result;
this._haVersion = conn.haVersion; this._haVersion = conn.haVersion;
this.initializeHass(auth, conn); this.initializeHass(auth, conn);
} catch (err) { } catch (err: any) {
this._error = true; this._error = true;
} }
} }

View File

@ -183,7 +183,7 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
// Only load if we have supervisor // Only load if we have supervisor
import("./onboarding-restore-backup"); import("./onboarding-restore-backup");
} }
} catch (err) { } catch (err: any) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error( console.error(
"Something went wrong loading onboarding-restore-backup", "Something went wrong loading onboarding-restore-backup",
@ -220,7 +220,7 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
} }
this._steps = steps; this._steps = steps;
} catch (err) { } catch (err: any) {
alert("Something went wrong loading onboarding, try refreshing"); alert("Something went wrong loading onboarding, try refreshing");
} }
} }
@ -240,7 +240,7 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
authCode: result.auth_code, authCode: result.auth_code,
}); });
await this._connectHass(auth); await this._connectHass(auth);
} catch (err) { } catch (err: any) {
alert("Ah snap, something went wrong!"); alert("Ah snap, something went wrong!");
location.reload(); location.reload();
} finally { } finally {
@ -275,7 +275,7 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
client_id: authParams.client_id!, client_id: authParams.client_id!,
redirect_uri: authParams.redirect_uri!, redirect_uri: authParams.redirect_uri!,
}); });
} catch (err) { } catch (err: any) {
this.hass!.connection.close(); this.hass!.connection.close();
await this.hass!.auth.revoke(); await this.hass!.auth.revoke();

View File

@ -72,7 +72,7 @@ class OnboardingAnalytics extends LitElement {
fireEvent(this, "onboarding-step", { fireEvent(this, "onboarding-step", {
type: "analytics", type: "analytics",
}); });
} catch (err) { } catch (err: any) {
alert(`Failed to save: ${err.message}`); alert(`Failed to save: ${err.message}`);
} }
} }

View File

@ -307,7 +307,7 @@ class OnboardingCoreConfig extends LitElement {
if (values.currency) { if (values.currency) {
this._currency = values.currency; this._currency = values.currency;
} }
} catch (err) { } catch (err: any) {
alert(`Failed to detect location information: ${err.message}`); alert(`Failed to detect location information: ${err.message}`);
} finally { } finally {
this._working = false; this._working = false;
@ -333,7 +333,7 @@ class OnboardingCoreConfig extends LitElement {
type: "core_config", type: "core_config",
result, result,
}); });
} catch (err) { } catch (err: any) {
this._working = false; this._working = false;
alert(`Failed to save: ${err.message}`); alert(`Failed to save: ${err.message}`);
} }

View File

@ -58,49 +58,49 @@ class OnboardingCreateUser extends LitElement {
<form> <form>
<paper-input <paper-input
name="name" name="name"
label="${this.localize("ui.panel.page-onboarding.user.data.name")}" label=${this.localize("ui.panel.page-onboarding.user.data.name")}
.value=${this._name} .value=${this._name}
@value-changed=${this._handleValueChanged} @value-changed=${this._handleValueChanged}
required required
auto-validate auto-validate
autocapitalize='on' autocapitalize='on'
.errorMessage="${this.localize( .errorMessage=${this.localize(
"ui.panel.page-onboarding.user.required_field" "ui.panel.page-onboarding.user.required_field"
)}" )}
@blur=${this._maybePopulateUsername} @blur=${this._maybePopulateUsername}
></paper-input> ></paper-input>
<paper-input <paper-input
name="username" name="username"
label="${this.localize("ui.panel.page-onboarding.user.data.username")}" label=${this.localize("ui.panel.page-onboarding.user.data.username")}
value=${this._username} value=${this._username}
@value-changed=${this._handleValueChanged} @value-changed=${this._handleValueChanged}
required required
auto-validate auto-validate
autocapitalize='none' autocapitalize='none'
.errorMessage="${this.localize( .errorMessage=${this.localize(
"ui.panel.page-onboarding.user.required_field" "ui.panel.page-onboarding.user.required_field"
)}" )}
></paper-input> ></paper-input>
<paper-input <paper-input
name="password" name="password"
label="${this.localize("ui.panel.page-onboarding.user.data.password")}" label=${this.localize("ui.panel.page-onboarding.user.data.password")}
value=${this._password} value=${this._password}
@value-changed=${this._handleValueChanged} @value-changed=${this._handleValueChanged}
required required
type='password' type='password'
auto-validate auto-validate
.errorMessage="${this.localize( .errorMessage=${this.localize(
"ui.panel.page-onboarding.user.required_field" "ui.panel.page-onboarding.user.required_field"
)}" )}
></paper-input> ></paper-input>
<paper-input <paper-input
name="passwordConfirm" name="passwordConfirm"
label="${this.localize( label=${this.localize(
"ui.panel.page-onboarding.user.data.password_confirm" "ui.panel.page-onboarding.user.data.password_confirm"
)}" )}
value=${this._passwordConfirm} value=${this._passwordConfirm}
@value-changed=${this._handleValueChanged} @value-changed=${this._handleValueChanged}
required required
@ -110,9 +110,9 @@ class OnboardingCreateUser extends LitElement {
this._passwordConfirm !== "" && this._passwordConfirm !== "" &&
this._passwordConfirm !== this._password this._passwordConfirm !== this._password
} }
.errorMessage="${this.localize( .errorMessage=${this.localize(
"ui.panel.page-onboarding.user.error.password_not_match" "ui.panel.page-onboarding.user.error.password_not_match"
)}" )}
></paper-input> ></paper-input>
<p class="action"> <p class="action">
@ -189,7 +189,7 @@ class OnboardingCreateUser extends LitElement {
type: "user", type: "user",
result, result,
}); });
} catch (err) { } catch (err: any) {
// eslint-disable-next-line // eslint-disable-next-line
console.error(err); console.error(err);
this._loading = false; this._loading = false;

View File

@ -62,7 +62,7 @@ class OnboardingRestoreBackup extends ProvideHassLitMixin(LitElement) {
if (this.restoring) { if (this.restoring) {
try { try {
await fetchInstallationType(); await fetchInstallationType();
} catch (err) { } catch (err: any) {
if ((err as Error).message === "unauthorized") { if ((err as Error).message === "unauthorized") {
window.location.replace("/"); window.location.replace("/");
} }

View File

@ -83,7 +83,7 @@ class DialogAreaDetail extends LitElement {
<mwc-button <mwc-button
slot="secondaryAction" slot="secondaryAction"
class="warning" class="warning"
@click="${this._deleteEntry}" @click=${this._deleteEntry}
.disabled=${this._submitting} .disabled=${this._submitting}
> >
${this.hass.localize("ui.panel.config.areas.editor.delete")} ${this.hass.localize("ui.panel.config.areas.editor.delete")}
@ -92,7 +92,7 @@ class DialogAreaDetail extends LitElement {
: html``} : html``}
<mwc-button <mwc-button
slot="primaryAction" slot="primaryAction"
@click="${this._updateEntry}" @click=${this._updateEntry}
.disabled=${nameInvalid || this._submitting} .disabled=${nameInvalid || this._submitting}
> >
${entry ${entry
@ -130,7 +130,7 @@ class DialogAreaDetail extends LitElement {
await this._params!.createEntry!(values); await this._params!.createEntry!(values);
} }
this._params = undefined; this._params = undefined;
} catch (err) { } catch (err: any) {
this._error = this._error =
err.message || err.message ||
this.hass.localize("ui.panel.config.areas.editor.unknown_error"); this.hass.localize("ui.panel.config.areas.editor.unknown_error");

View File

@ -388,7 +388,7 @@ class HaConfigAreaPage extends LitElement {
try { try {
await deleteAreaRegistryEntry(this.hass!, entry!.area_id); await deleteAreaRegistryEntry(this.hass!, entry!.area_id);
return true; return true;
} catch (err) { } catch (err: any) {
return false; return false;
} }
}, },

View File

@ -310,7 +310,9 @@ export default class HaAutomationActionRow extends LitElement {
} }
if (type !== getType(this.action)) { if (type !== getType(this.action)) {
const elClass = customElements.get(`ha-automation-action-${type}`); const elClass = customElements.get(
`ha-automation-action-${type}`
) as CustomElementConstructor & { defaultConfig: Action };
fireEvent(this, "value-changed", { fireEvent(this, "value-changed", {
value: { value: {

View File

@ -37,8 +37,8 @@ export class HaServiceAction extends LitElement implements ActionElement {
} }
try { try {
assert(this.action, actionStruct); assert(this.action, actionStruct);
} catch (error) { } catch (err: any) {
fireEvent(this, "ui-mode-not-available", error); fireEvent(this, "ui-mode-not-available", err);
return; return;
} }
if (this.action && hasTemplate(this.action)) { if (this.action && hasTemplate(this.action)) {

View File

@ -111,7 +111,11 @@ export default class HaAutomationConditionEditor extends LitElement {
return; return;
} }
const elClass = customElements.get(`ha-automation-condition-${type}`); const elClass = customElements.get(
`ha-automation-condition-${type}`
) as CustomElementConstructor & {
defaultConfig: Omit<Condition, "condition">;
};
if (type !== this.condition.condition) { if (type !== this.condition.condition) {
fireEvent(this, "value-changed", { fireEvent(this, "value-changed", {

View File

@ -378,7 +378,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
} }
this._dirty = false; this._dirty = false;
this._config = config; this._config = config;
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
text: text:
err.status_code === 404 err.status_code === 404

View File

@ -150,9 +150,9 @@ class HaAutomationPicker extends LitElement {
<mwc-icon-button <mwc-icon-button
.automation=${automation} .automation=${automation}
@click=${this._showInfo} @click=${this._showInfo}
.label="${this.hass.localize( .label=${this.hass.localize(
"ui.panel.config.automation.picker.show_info_automation" "ui.panel.config.automation.picker.show_info_automation"
)}" )}
> >
<ha-svg-icon .path=${mdiInformationOutline}></ha-svg-icon> <ha-svg-icon .path=${mdiInformationOutline}></ha-svg-icon>
</mwc-icon-button> </mwc-icon-button>
@ -202,9 +202,9 @@ class HaAutomationPicker extends LitElement {
> >
<mwc-icon-button <mwc-icon-button
.disabled=${!automation.attributes.id} .disabled=${!automation.attributes.id}
.label="${this.hass.localize( .label=${this.hass.localize(
"ui.panel.config.automation.picker.edit_automation" "ui.panel.config.automation.picker.edit_automation"
)}" )}
> >
<ha-svg-icon <ha-svg-icon
.path=${automation.attributes.id ? mdiPencil : mdiPencilOff} .path=${automation.attributes.id ? mdiPencil : mdiPencilOff}
@ -300,7 +300,7 @@ class HaAutomationPicker extends LitElement {
${this.hass.localize("ui.panel.config.automation.picker.introduction")} ${this.hass.localize("ui.panel.config.automation.picker.introduction")}
<p> <p>
<a <a
href="${documentationUrl(this.hass, "/docs/automation/editor/")}" href=${documentationUrl(this.hass, "/docs/automation/editor/")}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >

View File

@ -72,10 +72,7 @@ export class HaManualAutomationEditor extends LitElement {
"ui.panel.config.automation.editor.modes.description", "ui.panel.config.automation.editor.modes.description",
"documentation_link", "documentation_link",
html`<a html`<a
href="${documentationUrl( href=${documentationUrl(this.hass, "/docs/automation/modes/")}
this.hass,
"/docs/automation/modes/"
)}"
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>${this.hass.localize( >${this.hass.localize(
@ -167,7 +164,7 @@ export class HaManualAutomationEditor extends LitElement {
)} )}
</p> </p>
<a <a
href="${documentationUrl(this.hass, "/docs/automation/trigger/")}" href=${documentationUrl(this.hass, "/docs/automation/trigger/")}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >
@ -196,7 +193,7 @@ export class HaManualAutomationEditor extends LitElement {
)} )}
</p> </p>
<a <a
href="${documentationUrl(this.hass, "/docs/scripts/conditions/")}" href=${documentationUrl(this.hass, "/docs/scripts/conditions/")}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >
@ -225,7 +222,7 @@ export class HaManualAutomationEditor extends LitElement {
)} )}
</p> </p>
<a <a
href="${documentationUrl(this.hass, "/docs/automation/action/")}" href=${documentationUrl(this.hass, "/docs/automation/action/")}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >

View File

@ -145,10 +145,10 @@ class DialogThingtalk extends LitElement {
> >
</paper-dialog-scrollable> </paper-dialog-scrollable>
<div class="paper-dialog-buttons"> <div class="paper-dialog-buttons">
<mwc-button class="left" @click="${this._skip}"> <mwc-button class="left" @click=${this._skip}>
${this.hass.localize(`ui.common.skip`)} ${this.hass.localize(`ui.common.skip`)}
</mwc-button> </mwc-button>
<mwc-button @click="${this._generate}" .disabled=${this._submitting}> <mwc-button @click=${this._generate} .disabled=${this._submitting}>
${this._submitting ${this._submitting
? html`<ha-circular-progress ? html`<ha-circular-progress
active active
@ -178,7 +178,7 @@ class DialogThingtalk extends LitElement {
const result = await convertThingTalk(this.hass, this._value); const result = await convertThingTalk(this.hass, this._value);
config = result.config; config = result.config;
placeholders = result.placeholders; placeholders = result.placeholders;
} catch (err) { } catch (err: any) {
this._error = err.message; this._error = err.message;
this._submitting = false; this._submitting = false;
return; return;

View File

@ -127,7 +127,7 @@ export class ThingTalkPlaceholders extends SubscribeMixin(LitElement) {
modal modal
with-backdrop with-backdrop
.opened=${this.opened} .opened=${this.opened}
@opened-changed="${this._openedChanged}" @opened-changed=${this._openedChanged}
> >
<h2> <h2>
${this.hass.localize( ${this.hass.localize(
@ -244,10 +244,10 @@ export class ThingTalkPlaceholders extends SubscribeMixin(LitElement) {
)} )}
</paper-dialog-scrollable> </paper-dialog-scrollable>
<div class="paper-dialog-buttons"> <div class="paper-dialog-buttons">
<mwc-button class="left" @click="${this.skip}"> <mwc-button class="left" @click=${this.skip}>
${this.hass.localize(`ui.common.skip`)} ${this.hass.localize(`ui.common.skip`)}
</mwc-button> </mwc-button>
<mwc-button @click="${this._done}" .disabled=${!this._isDone}> <mwc-button @click=${this._done} .disabled=${!this._isDone}>
${this.hass.localize(`ui.panel.config.automation.thingtalk.create`)} ${this.hass.localize(`ui.panel.config.automation.thingtalk.create`)}
</mwc-button> </mwc-button>
</div> </div>

View File

@ -241,7 +241,11 @@ export default class HaAutomationTriggerRow extends LitElement {
return; return;
} }
const elClass = customElements.get(`ha-automation-trigger-${type}`); const elClass = customElements.get(
`ha-automation-trigger-${type}`
) as CustomElementConstructor & {
defaultConfig: Omit<Trigger, "platform">;
};
if (type !== this.trigger.platform) { if (type !== this.trigger.platform) {
const value = { const value = {

View File

@ -29,8 +29,8 @@ export class HaEventTrigger extends LitElement implements TriggerElement {
"ui.panel.config.automation.editor.triggers.type.event.event_type" "ui.panel.config.automation.editor.triggers.type.event.event_type"
)} )}
name="event_type" name="event_type"
.value="${event_type}" .value=${event_type}
@value-changed="${this._valueChanged}" @value-changed=${this._valueChanged}
></paper-input> ></paper-input>
<ha-yaml-editor <ha-yaml-editor
.label=${this.hass.localize( .label=${this.hass.localize(

View File

@ -35,7 +35,7 @@ export default class HaGeolocationTrigger extends LitElement {
)} )}
name="source" name="source"
.value=${source} .value=${source}
@value-changed="${this._valueChanged}" @value-changed=${this._valueChanged}
></paper-input> ></paper-input>
<ha-entity-picker <ha-entity-picker
.label=${this.hass.localize( .label=${this.hass.localize(

View File

@ -30,7 +30,7 @@ export default class HaHassTrigger extends LitElement {
<paper-radio-group <paper-radio-group
.selected=${event} .selected=${event}
aria-labelledby="eventlabel" aria-labelledby="eventlabel"
@paper-radio-group-changed="${this._radioGroupPicked}" @paper-radio-group-changed=${this._radioGroupPicked}
> >
<paper-radio-button name="start"> <paper-radio-button name="start">
${this.hass.localize( ${this.hass.localize(

View File

@ -43,8 +43,8 @@ export default class HaNumericStateTrigger extends LitElement {
return html` return html`
<ha-entity-picker <ha-entity-picker
.value="${entity_id}" .value=${entity_id}
@value-changed="${this._valueChanged}" @value-changed=${this._valueChanged}
.name=${"entity_id"} .name=${"entity_id"}
.hass=${this.hass} .hass=${this.hass}
allow-custom-entity allow-custom-entity

View File

@ -183,8 +183,8 @@ class DialogImportBlueprint extends LitElement {
return; return;
} }
this._result = await importBlueprint(this.hass, url); this._result = await importBlueprint(this.hass, url);
} catch (e) { } catch (err: any) {
this._error = e.message; this._error = err.message;
} finally { } finally {
this._importing = false; this._importing = false;
} }
@ -206,8 +206,8 @@ class DialogImportBlueprint extends LitElement {
); );
this._params.importedCallback(); this._params.importedCallback();
this.closeDialog(); this.closeDialog();
} catch (e) { } catch (err: any) {
this._error = e.message; this._error = err.message;
} finally { } finally {
this._saving = false; this._saving = false;
} }

View File

@ -244,10 +244,10 @@ class HaBlueprintOverview extends LitElement {
${this.hass.localize("ui.panel.config.blueprint.overview.introduction")} ${this.hass.localize("ui.panel.config.blueprint.overview.introduction")}
<p> <p>
<a <a
href="${documentationUrl( href=${documentationUrl(
this.hass, this.hass,
"/docs/automation/using_blueprints/" "/docs/automation/using_blueprints/"
)}" )}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >

View File

@ -110,7 +110,7 @@ export class CloudAlexaPref extends LitElement {
this._syncing = true; this._syncing = true;
try { try {
await syncCloudAlexaEntities(this.hass!); await syncCloudAlexaEntities(this.hass!);
} catch (err) { } catch (err: any) {
alert( alert(
`${this.hass!.localize( `${this.hass!.localize(
"ui.panel.config.cloud.account.alexa.sync_entities_error" "ui.panel.config.cloud.account.alexa.sync_entities_error"
@ -126,7 +126,7 @@ export class CloudAlexaPref extends LitElement {
try { try {
await updateCloudPref(this.hass!, { alexa_enabled: toggle.checked! }); await updateCloudPref(this.hass!, { alexa_enabled: toggle.checked! });
fireEvent(this, "ha-refresh-cloud-status"); fireEvent(this, "ha-refresh-cloud-status");
} catch (err) { } catch (err: any) {
toggle.checked = !toggle.checked; toggle.checked = !toggle.checked;
} }
} }
@ -138,7 +138,7 @@ export class CloudAlexaPref extends LitElement {
alexa_report_state: toggle.checked!, alexa_report_state: toggle.checked!,
}); });
fireEvent(this, "ha-refresh-cloud-status"); fireEvent(this, "ha-refresh-cloud-status");
} catch (err) { } catch (err: any) {
alert( alert(
`${this.hass!.localize( `${this.hass!.localize(
"ui.panel.config.cloud.account.alexa.state_reporting_error", "ui.panel.config.cloud.account.alexa.state_reporting_error",

View File

@ -35,8 +35,8 @@ export class CloudGooglePref extends LitElement {
<div class="switch"> <div class="switch">
<ha-switch <ha-switch
id="google_enabled" id="google_enabled"
.checked="${google_enabled}" .checked=${google_enabled}
@change="${this._enableToggleChanged}" @change=${this._enableToggleChanged}
></ha-switch> ></ha-switch>
</div> </div>
<div class="card-content"> <div class="card-content">
@ -111,15 +111,15 @@ export class CloudGooglePref extends LitElement {
"ui.panel.config.cloud.account.google.enter_pin_info" "ui.panel.config.cloud.account.google.enter_pin_info"
)} )}
<paper-input <paper-input
label="${this.hass.localize( label=${this.hass.localize(
"ui.panel.config.cloud.account.google.devices_pin" "ui.panel.config.cloud.account.google.devices_pin"
)}" )}
id="google_secure_devices_pin" id="google_secure_devices_pin"
placeholder="${this.hass.localize( placeholder=${this.hass.localize(
"ui.panel.config.cloud.account.google.enter_pin_hint" "ui.panel.config.cloud.account.google.enter_pin_hint"
)}" )}
.value=${google_secure_devices_pin || ""} .value=${google_secure_devices_pin || ""}
@change="${this._pinChanged}" @change=${this._pinChanged}
></paper-input> ></paper-input>
</div> </div>
` `
@ -171,7 +171,7 @@ export class CloudGooglePref extends LitElement {
try { try {
await updateCloudPref(this.hass, { [toggle.id]: toggle.checked! }); await updateCloudPref(this.hass, { [toggle.id]: toggle.checked! });
fireEvent(this, "ha-refresh-cloud-status"); fireEvent(this, "ha-refresh-cloud-status");
} catch (err) { } catch (err: any) {
toggle.checked = !toggle.checked; toggle.checked = !toggle.checked;
} }
} }
@ -183,7 +183,7 @@ export class CloudGooglePref extends LitElement {
google_report_state: toggle.checked!, google_report_state: toggle.checked!,
}); });
fireEvent(this, "ha-refresh-cloud-status"); fireEvent(this, "ha-refresh-cloud-status");
} catch (err) { } catch (err: any) {
alert( alert(
`Unable to ${toggle.checked ? "enable" : "disable"} report state. ${ `Unable to ${toggle.checked ? "enable" : "disable"} report state. ${
err.message err.message
@ -201,7 +201,7 @@ export class CloudGooglePref extends LitElement {
}); });
showSaveSuccessToast(this, this.hass); showSaveSuccessToast(this, this.hass);
fireEvent(this, "ha-refresh-cloud-status"); fireEvent(this, "ha-refresh-cloud-status");
} catch (err) { } catch (err: any) {
alert( alert(
`${this.hass.localize( `${this.hass.localize(
"ui.panel.config.cloud.account.google.enter_pin_error" "ui.panel.config.cloud.account.google.enter_pin_error"

View File

@ -56,8 +56,8 @@ export class CloudRemotePref extends LitElement {
> >
<div class="switch"> <div class="switch">
<ha-switch <ha-switch
.checked="${remote_enabled}" .checked=${remote_enabled}
@change="${this._toggleChanged}" @change=${this._toggleChanged}
></ha-switch> ></ha-switch>
</div> </div>
<div class="card-content"> <div class="card-content">
@ -130,7 +130,7 @@ export class CloudRemotePref extends LitElement {
await disconnectCloudRemote(this.hass); await disconnectCloudRemote(this.hass);
} }
fireEvent(this, "ha-refresh-cloud-status"); fireEvent(this, "ha-refresh-cloud-status");
} catch (err) { } catch (err: any) {
alert(err.message); alert(err.message);
toggle.checked = !toggle.checked; toggle.checked = !toggle.checked;
} }

View File

@ -188,7 +188,7 @@ export class CloudTTSPref extends LitElement {
tts_default_voice: [language, newGender], tts_default_voice: [language, newGender],
}); });
fireEvent(this, "ha-refresh-cloud-status"); fireEvent(this, "ha-refresh-cloud-status");
} catch (err) { } catch (err: any) {
this.savingPreferences = false; this.savingPreferences = false;
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(err); console.error(err);
@ -212,7 +212,7 @@ export class CloudTTSPref extends LitElement {
tts_default_voice: [language, gender], tts_default_voice: [language, gender],
}); });
fireEvent(this, "ha-refresh-cloud-status"); fireEvent(this, "ha-refresh-cloud-status");
} catch (err) { } catch (err: any) {
this.savingPreferences = false; this.savingPreferences = false;
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(err); console.error(err);

View File

@ -98,7 +98,7 @@ export class CloudWebhooks extends LitElement {
` `
: this._cloudHooks![entry.webhook_id] : this._cloudHooks![entry.webhook_id]
? html` ? html`
<mwc-button @click="${this._handleManageButton}"> <mwc-button @click=${this._handleManageButton}>
${this.hass!.localize( ${this.hass!.localize(
"ui.panel.config.cloud.account.webhooks.manage" "ui.panel.config.cloud.account.webhooks.manage"
)} )}
@ -156,7 +156,7 @@ export class CloudWebhooks extends LitElement {
try { try {
updatedWebhook = await createCloudhook(this.hass!, entry.webhook_id); updatedWebhook = await createCloudhook(this.hass!, entry.webhook_id);
} catch (err) { } catch (err: any) {
alert((err as WebhookError).message); alert((err as WebhookError).message);
return; return;
} finally { } finally {
@ -178,7 +178,7 @@ export class CloudWebhooks extends LitElement {
this._progress = [...this._progress, webhookId]; this._progress = [...this._progress, webhookId];
try { try {
await deleteCloudhook(this.hass!, webhookId!); await deleteCloudhook(this.hass!, webhookId!);
} catch (err) { } catch (err: any) {
alert( alert(
`${this.hass!.localize( `${this.hass!.localize(
"ui.panel.config.cloud.account.webhooks.disable_hook_error_msg" "ui.panel.config.cloud.account.webhooks.disable_hook_error_msg"

View File

@ -159,7 +159,7 @@ export class DialogTryTts extends LitElement {
options: { gender }, options: { gender },
}); });
url = result.path; url = result.path;
} catch (err) { } catch (err: any) {
this._loadingExample = false; this._loadingExample = false;
showAlertDialog(this, { showAlertDialog(this, {
text: `Unable to load example. ${err.error || err.body || err}`, text: `Unable to load example. ${err.error || err.body || err}`,

View File

@ -57,7 +57,7 @@ class DialogCloudCertificate extends LitElement {
</div> </div>
<div class="paper-dialog-buttons"> <div class="paper-dialog-buttons">
<mwc-button @click="${this._closeDialog}" <mwc-button @click=${this._closeDialog}
>${this.hass!.localize( >${this.hass!.localize(
"ui.panel.config.cloud.dialog_certificate.close" "ui.panel.config.cloud.dialog_certificate.close"
)}</mwc-button )}</mwc-button

View File

@ -54,10 +54,10 @@ export class DialogManageCloudhook extends LitElement {
)} )}
</p> </p>
<paper-input <paper-input
label="${inputLabel}" label=${inputLabel}
value="${cloudhook.cloudhook_url}" value=${cloudhook.cloudhook_url}
@click="${this._copyClipboard}" @click=${this._copyClipboard}
@blur="${this._restoreLabel}" @blur=${this._restoreLabel}
></paper-input> ></paper-input>
<p> <p>
${cloudhook.managed ${cloudhook.managed
@ -70,7 +70,7 @@ export class DialogManageCloudhook extends LitElement {
${this.hass!.localize( ${this.hass!.localize(
"ui.panel.config.cloud.dialog_cloudhook.info_disable_webhook" "ui.panel.config.cloud.dialog_cloudhook.info_disable_webhook"
)} )}
<button class="link" @click="${this._disableWebhook}"> <button class="link" @click=${this._disableWebhook}>
${this.hass!.localize( ${this.hass!.localize(
"ui.panel.config.cloud.dialog_cloudhook.link_disable_webhook" "ui.panel.config.cloud.dialog_cloudhook.link_disable_webhook"
)}</button )}</button
@ -80,14 +80,14 @@ export class DialogManageCloudhook extends LitElement {
</div> </div>
<div class="paper-dialog-buttons"> <div class="paper-dialog-buttons">
<a href="${docsUrl}" target="_blank" rel="noreferrer"> <a href=${docsUrl} target="_blank" rel="noreferrer">
<mwc-button <mwc-button
>${this.hass!.localize( >${this.hass!.localize(
"ui.panel.config.cloud.dialog_cloudhook.view_documentation" "ui.panel.config.cloud.dialog_cloudhook.view_documentation"
)}</mwc-button )}</mwc-button
> >
</a> </a>
<mwc-button @click="${this._closeDialog}" <mwc-button @click=${this._closeDialog}
>${this.hass!.localize( >${this.hass!.localize(
"ui.panel.config.cloud.dialog_cloudhook.close" "ui.panel.config.cloud.dialog_cloudhook.close"
)}</mwc-button )}</mwc-button
@ -134,7 +134,7 @@ export class DialogManageCloudhook extends LitElement {
paperInput.label = this.hass!.localize( paperInput.label = this.hass!.localize(
"ui.panel.config.cloud.dialog_cloudhook.copied_to_clipboard" "ui.panel.config.cloud.dialog_cloudhook.copied_to_clipboard"
); );
} catch (err) { } catch (err: any) {
// Copying failed. Oh no // Copying failed. Oh no
} }
} }

View File

@ -75,7 +75,7 @@ class ConfigAnalytics extends LitElement {
this._error = undefined; this._error = undefined;
try { try {
this._analyticsDetails = await getAnalyticsDetails(this.hass); this._analyticsDetails = await getAnalyticsDetails(this.hass);
} catch (err) { } catch (err: any) {
this._error = err.message || err; this._error = err.message || err;
} }
} }
@ -87,7 +87,7 @@ class ConfigAnalytics extends LitElement {
this.hass, this.hass,
this._analyticsDetails?.preferences || {} this._analyticsDetails?.preferences || {}
); );
} catch (err) { } catch (err: any) {
this._error = err.message || err; this._error = err.message || err;
} }
} }

View File

@ -279,7 +279,7 @@ class ConfigCoreForm extends LitElement {
unit_system: this._unitSystemValue, unit_system: this._unitSystemValue,
time_zone: this._timeZoneValue, time_zone: this._timeZoneValue,
}); });
} catch (err) { } catch (err: any) {
alert(`Error saving config: ${err.message}`); alert(`Error saving config: ${err.message}`);
} finally { } finally {
this._working = false; this._working = false;

View File

@ -75,7 +75,7 @@ class ConfigNameForm extends LitElement {
await saveCoreConfig(this.hass, { await saveCoreConfig(this.hass, {
location_name: this._nameValue, location_name: this._nameValue,
}); });
} catch (err) { } catch (err: any) {
alert("FAIL"); alert("FAIL");
} finally { } finally {
this._working = false; this._working = false;

View File

@ -87,7 +87,7 @@ class ConfigNetwork extends LitElement {
} }
} }
this._networkConfig = coreNetwork; this._networkConfig = coreNetwork;
} catch (err) { } catch (err: any) {
this._error = err.message || err; this._error = err.message || err;
} }
} }
@ -99,7 +99,7 @@ class ConfigNetwork extends LitElement {
this.hass, this.hass,
this._networkConfig?.configured_adapters || [] this._networkConfig?.configured_adapters || []
); );
} catch (err) { } catch (err: any) {
this._error = err.message || err; this._error = err.message || err;
} }
} }

View File

@ -120,7 +120,7 @@ class ConfigUrlForm extends LitElement {
external_url: this._external_url || null, external_url: this._external_url || null,
internal_url: this._internal_url || null, internal_url: this._internal_url || null,
}); });
} catch (err) { } catch (err: any) {
this._error = err.message || err; this._error = err.message || err;
} finally { } finally {
this._working = false; this._working = false;

View File

@ -3,6 +3,7 @@ import { property } from "lit/decorators";
import "../../../components/ha-card"; import "../../../components/ha-card";
import "../../../layouts/hass-loading-screen"; import "../../../layouts/hass-loading-screen";
import "../../../layouts/hass-tabs-subpage"; import "../../../layouts/hass-tabs-subpage";
import { haStyle } from "../../../resources/styles";
import { HomeAssistant, Route } from "../../../types"; import { HomeAssistant, Route } from "../../../types";
import { documentationUrl } from "../../../util/documentation-url"; import { documentationUrl } from "../../../util/documentation-url";
import "../ha-config-section"; import "../ha-config-section";
@ -23,7 +24,6 @@ class HaConfigCustomize extends LitElement {
protected render(): TemplateResult { protected render(): TemplateResult {
return html` return html`
<style include="ha-style"></style>
<hass-tabs-subpage <hass-tabs-subpage
.hass=${this.hass} .hass=${this.hass}
.narrow=${this.narrow} .narrow=${this.narrow}
@ -75,11 +75,14 @@ class HaConfigCustomize extends LitElement {
} }
static get styles(): CSSResultGroup { static get styles(): CSSResultGroup {
return css` return [
a { haStyle,
color: var(--primary-color); css`
} a {
`; color: var(--primary-color);
}
`,
];
} }
} }
customElements.define("ha-config-customize", HaConfigCustomize); customElements.define("ha-config-customize", HaConfigCustomize);

View File

@ -50,11 +50,11 @@ class DialogMQTTDeviceDebugInfo extends LitElement {
<ha-dialog <ha-dialog
open open
@closed=${this._close} @closed=${this._close}
.heading="${this.hass!.localize( .heading=${this.hass!.localize(
"ui.dialogs.mqtt_device_debug_info.title", "ui.dialogs.mqtt_device_debug_info.title",
"device", "device",
computeDeviceName(this._params.device, this.hass) computeDeviceName(this._params.device, this.hass)
)}" )}
> >
<h4> <h4>
${this.hass!.localize( ${this.hass!.localize(
@ -138,7 +138,7 @@ class DialogMQTTDeviceDebugInfo extends LitElement {
${this._debugInfo!.entities.map( ${this._debugInfo!.entities.map(
(entity) => html` (entity) => html`
<li class="entitylistitem"> <li class="entitylistitem">
'${computeStateName(this.hass.states[entity.entity_id])}' ${computeStateName(this.hass.states[entity.entity_id])}
(<code>${entity.entity_id}</code>) (<code>${entity.entity_id}</code>)
<br />MQTT discovery data: <br />MQTT discovery data:
<ul class="discoverydata"> <ul class="discoverydata">

View File

@ -16,7 +16,7 @@ export class HaDeviceActionsMqtt extends LitElement {
protected render(): TemplateResult { protected render(): TemplateResult {
return html` return html`
<mwc-button @click=${this._showDebugInfo}> MQTT Info </mwc-button> <mwc-button @click=${this._showDebugInfo}> MQTT Info </mwc-button>
<mwc-button class="warning" @click="${this._confirmDeleteEntry}"> <mwc-button class="warning" @click=${this._confirmDeleteEntry}>
${this.hass.localize("ui.panel.config.devices.delete")} ${this.hass.localize("ui.panel.config.devices.delete")}
</mwc-button> </mwc-button>
`; `;

View File

@ -107,7 +107,7 @@ class MQTTMessages extends LitElement {
if (typeof payload === "string") { if (typeof payload === "string") {
try { try {
o = JSON.parse(payload); o = JSON.parse(payload);
} catch (e) { } catch (err: any) {
o = null; o = null;
} }
} }

View File

@ -14,7 +14,7 @@ export class HaDeviceActionsTasmota extends LitElement {
protected render(): TemplateResult { protected render(): TemplateResult {
return html` return html`
<mwc-button class="warning" @click="${this._confirmDeleteEntry}"> <mwc-button class="warning" @click=${this._confirmDeleteEntry}>
${this.hass.localize("ui.panel.config.devices.delete")} ${this.hass.localize("ui.panel.config.devices.delete")}
</mwc-button> </mwc-button>
`; `;

View File

@ -111,7 +111,7 @@ class DialogDeviceRegistryDetail extends LitElement {
</mwc-button> </mwc-button>
<mwc-button <mwc-button
slot="primaryAction" slot="primaryAction"
@click="${this._updateEntry}" @click=${this._updateEntry}
.disabled=${this._submitting} .disabled=${this._submitting}
> >
${this.hass.localize("ui.panel.config.devices.update")} ${this.hass.localize("ui.panel.config.devices.update")}
@ -142,7 +142,7 @@ class DialogDeviceRegistryDetail extends LitElement {
disabled_by: this._disabledBy || null, disabled_by: this._disabledBy || null,
}); });
this.closeDialog(); this.closeDialog();
} catch (err) { } catch (err: any) {
this._error = this._error =
err.message || err.message ||
this.hass.localize("ui.panel.config.devices.unknown_error"); this.hass.localize("ui.panel.config.devices.unknown_error");

View File

@ -687,7 +687,7 @@ export class HaConfigDevicePage extends LitElement {
try { try {
// eslint-disable-next-line no-await-in-loop // eslint-disable-next-line no-await-in-loop
result = await disableConfigEntry(this.hass, cnfg_entry); result = await disableConfigEntry(this.hass, cnfg_entry);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.hass.localize( title: this.hass.localize(
"ui.panel.config.integrations.config_entry.disable_error" "ui.panel.config.integrations.config_entry.disable_error"
@ -710,7 +710,7 @@ export class HaConfigDevicePage extends LitElement {
} }
try { try {
await updateDeviceRegistryEntry(this.hass, this.deviceId, updates); await updateDeviceRegistryEntry(this.hass, this.deviceId, updates);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.hass.localize( title: this.hass.localize(
"ui.panel.config.devices.update_device_error" "ui.panel.config.devices.update_device_error"

View File

@ -419,7 +419,7 @@ export class HaConfigDeviceDashboard extends LitElement {
<ha-svg-icon .path=${mdiFilterVariant}></ha-svg-icon> <ha-svg-icon .path=${mdiFilterVariant}></ha-svg-icon>
</mwc-icon-button> </mwc-icon-button>
<mwc-list-item <mwc-list-item
@request-selected="${this._showDisabledChanged}" @request-selected=${this._showDisabledChanged}
graphic="control" graphic="control"
.selected=${this._showDisabled} .selected=${this._showDisabled}
> >

View File

@ -62,7 +62,7 @@ export class EnergyBatterySettings extends LitElement {
<a <a
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
href="${documentationUrl(this.hass, "/docs/energy/battery/")}" href=${documentationUrl(this.hass, "/docs/energy/battery/")}
>${this.hass.localize( >${this.hass.localize(
"ui.panel.config.energy.battery.learn_more" "ui.panel.config.energy.battery.learn_more"
)}</a )}</a
@ -167,7 +167,7 @@ export class EnergyBatterySettings extends LitElement {
(source) => source !== sourceToDelete (source) => source !== sourceToDelete
), ),
}); });
} catch (err) { } catch (err: any) {
showAlertDialog(this, { title: `Failed to save config: ${err.message}` }); showAlertDialog(this, { title: `Failed to save config: ${err.message}` });
} }
} }

View File

@ -51,10 +51,10 @@ export class EnergyDeviceSettings extends LitElement {
<a <a
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
href="${documentationUrl( href=${documentationUrl(
this.hass, this.hass,
"/docs/energy/individual-devices/" "/docs/energy/individual-devices/"
)}" )}
>${this.hass.localize( >${this.hass.localize(
"ui.panel.config.energy.device_consumption.learn_more" "ui.panel.config.energy.device_consumption.learn_more"
)}</a )}</a
@ -126,7 +126,7 @@ export class EnergyDeviceSettings extends LitElement {
(device) => device !== deviceToDelete (device) => device !== deviceToDelete
), ),
}); });
} catch (err) { } catch (err: any) {
showAlertDialog(this, { title: `Failed to save config: ${err.message}` }); showAlertDialog(this, { title: `Failed to save config: ${err.message}` });
} }
} }

View File

@ -62,7 +62,7 @@ export class EnergyGasSettings extends LitElement {
<a <a
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
href="${documentationUrl(this.hass, "/docs/energy/gas/")}" href=${documentationUrl(this.hass, "/docs/energy/gas/")}
>${this.hass.localize("ui.panel.config.energy.gas.learn_more")}</a >${this.hass.localize("ui.panel.config.energy.gas.learn_more")}</a
> >
</p> </p>
@ -156,7 +156,7 @@ export class EnergyGasSettings extends LitElement {
(source) => source !== sourceToDelete (source) => source !== sourceToDelete
), ),
}); });
} catch (err) { } catch (err: any) {
showAlertDialog(this, { title: `Failed to save config: ${err.message}` }); showAlertDialog(this, { title: `Failed to save config: ${err.message}` });
} }
} }

View File

@ -91,10 +91,10 @@ export class EnergyGridSettings extends LitElement {
<a <a
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
href="${documentationUrl( href=${documentationUrl(
this.hass, this.hass,
"/docs/energy/electricity-grid/" "/docs/energy/electricity-grid/"
)}" )}
>${this.hass.localize( >${this.hass.localize(
"ui.panel.config.energy.grid.learn_more" "ui.panel.config.energy.grid.learn_more"
)}</a )}</a
@ -393,7 +393,7 @@ export class EnergyGridSettings extends LitElement {
try { try {
await this._savePreferences(preferences); await this._savePreferences(preferences);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { title: `Failed to save config: ${err.message}` }); showAlertDialog(this, { title: `Failed to save config: ${err.message}` });
} }
} }
@ -423,7 +423,7 @@ export class EnergyGridSettings extends LitElement {
try { try {
await this._savePreferences(preferences); await this._savePreferences(preferences);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { title: `Failed to save config: ${err.message}` }); showAlertDialog(this, { title: `Failed to save config: ${err.message}` });
} }
} }

View File

@ -65,10 +65,7 @@ export class EnergySolarSettings extends LitElement {
<a <a
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
href="${documentationUrl( href=${documentationUrl(this.hass, "/docs/energy/solar-panels/")}
this.hass,
"/docs/energy/solar-panels/"
)}"
>${this.hass.localize( >${this.hass.localize(
"ui.panel.config.energy.solar.learn_more" "ui.panel.config.energy.solar.learn_more"
)}</a )}</a
@ -175,7 +172,7 @@ export class EnergySolarSettings extends LitElement {
(source) => source !== sourceToDelete (source) => source !== sourceToDelete
), ),
}); });
} catch (err) { } catch (err: any) {
showAlertDialog(this, { title: `Failed to save config: ${err.message}` }); showAlertDialog(this, { title: `Failed to save config: ${err.message}` });
} }
} }

View File

@ -110,8 +110,8 @@ export class DialogEnergyBatterySettings
try { try {
await this._params!.saveCallback(this._source!); await this._params!.saveCallback(this._source!);
this.closeDialog(); this.closeDialog();
} catch (e) { } catch (err: any) {
this._error = e.message; this._error = err.message;
} }
} }

View File

@ -100,8 +100,8 @@ export class DialogEnergyDeviceSettings
try { try {
await this._params!.saveCallback(this._device!); await this._params!.saveCallback(this._device!);
this.closeDialog(); this.closeDialog();
} catch (e) { } catch (err: any) {
this._error = e.message; this._error = err.message;
} }
} }

View File

@ -255,8 +255,8 @@ export class DialogEnergyGasSettings
} }
await this._params!.saveCallback(this._source!); await this._params!.saveCallback(this._source!);
this.closeDialog(); this.closeDialog();
} catch (e) { } catch (err: any) {
this._error = e.message; this._error = err.message;
} }
} }

View File

@ -288,8 +288,8 @@ export class DialogEnergyGridFlowSettings
} }
await this._params!.saveCallback(this._source!); await this._params!.saveCallback(this._source!);
this.closeDialog(); this.closeDialog();
} catch (e) { } catch (err: any) {
this._error = e.message; this._error = err.message;
} }
} }

View File

@ -212,8 +212,8 @@ export class DialogEnergySolarSettings
} }
await this._params!.saveCallback(this._source!); await this._params!.saveCallback(this._source!);
this.closeDialog(); this.closeDialog();
} catch (e) { } catch (err: any) {
this._error = e.message; this._error = err.message;
} }
} }

View File

@ -126,17 +126,17 @@ class HaConfigEnergy extends LitElement {
const energyInfoPromise = await getEnergyInfo(this.hass); const energyInfoPromise = await getEnergyInfo(this.hass);
try { try {
this._preferences = await getEnergyPreferences(this.hass); this._preferences = await getEnergyPreferences(this.hass);
} catch (e) { } catch (err: any) {
if (e.code === "not_found") { if (err.code === "not_found") {
this._preferences = INITIAL_CONFIG; this._preferences = INITIAL_CONFIG;
} else { } else {
this._error = e.message; this._error = err.message;
} }
} }
try { try {
this._validationResult = await validationPromise; this._validationResult = await validationPromise;
} catch (e) { } catch (err: any) {
this._error = e.message; this._error = err.message;
} }
this._info = await energyInfoPromise; this._info = await energyInfoPromise;
} }
@ -146,8 +146,8 @@ class HaConfigEnergy extends LitElement {
this._validationResult = undefined; this._validationResult = undefined;
try { try {
this._validationResult = await getEnergyPreferenceValidation(this.hass); this._validationResult = await getEnergyPreferenceValidation(this.hass);
} catch (e) { } catch (err: any) {
this._error = e.message; this._error = err.message;
} }
this._info = await getEnergyInfo(this.hass); this._info = await getEnergyInfo(this.hass);
} }

View File

@ -162,7 +162,7 @@ export class DialogEntityEditor extends LitElement {
this._params!.entity_id, this._params!.entity_id,
"faq_link", "faq_link",
html`<a html`<a
href="${documentationUrl(this.hass, "/faq/unique_id")}" href=${documentationUrl(this.hass, "/faq/unique_id")}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>${this.hass.localize("ui.dialogs.entity_registry.faq")}</a >${this.hass.localize("ui.dialogs.entity_registry.faq")}</a
@ -174,8 +174,8 @@ export class DialogEntityEditor extends LitElement {
"ui.dialogs.entity_registry.info_customize", "ui.dialogs.entity_registry.info_customize",
"customize_link", "customize_link",
html`<a html`<a
href="${"/config/customize/edit/" + href=${"/config/customize/edit/" +
this._params!.entity_id}" this._params!.entity_id}
rel="noreferrer" rel="noreferrer"
>${this.hass.localize( >${this.hass.localize(
"ui.dialogs.entity_registry.customize_link" "ui.dialogs.entity_registry.customize_link"

View File

@ -203,7 +203,7 @@ export class EntityRegistrySettingsHelper extends LitElement {
} }
await this._registryEditor?.updateEntry(); await this._registryEditor?.updateEntry();
fireEvent(this, "close-dialog"); fireEvent(this, "close-dialog");
} catch (err) { } catch (err: any) {
this._error = err.message || "Unknown error"; this._error = err.message || "Unknown error";
} finally { } finally {
this._submitting = false; this._submitting = false;

View File

@ -237,14 +237,14 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
<div class="buttons"> <div class="buttons">
<mwc-button <mwc-button
class="warning" class="warning"
@click="${this._confirmDeleteEntry}" @click=${this._confirmDeleteEntry}
.disabled=${this._submitting || .disabled=${this._submitting ||
!(stateObj && stateObj.attributes.restored)} !(stateObj && stateObj.attributes.restored)}
> >
${this.hass.localize("ui.dialogs.entity_registry.editor.delete")} ${this.hass.localize("ui.dialogs.entity_registry.editor.delete")}
</mwc-button> </mwc-button>
<mwc-button <mwc-button
@click="${this._updateEntry}" @click=${this._updateEntry}
.disabled=${invalidDomainUpdate || this._submitting} .disabled=${invalidDomainUpdate || this._submitting}
> >
${this.hass.localize("ui.dialogs.entity_registry.editor.update")} ${this.hass.localize("ui.dialogs.entity_registry.editor.update")}
@ -324,7 +324,7 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
}); });
} }
fireEvent(this as HTMLElement, "close-dialog"); fireEvent(this as HTMLElement, "close-dialog");
} catch (err) { } catch (err: any) {
this._error = err.message || "Unknown error"; this._error = err.message || "Unknown error";
} finally { } finally {
this._submitting = false; this._submitting = false;

View File

@ -587,7 +587,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
<ha-svg-icon .path=${mdiFilterVariant}></ha-svg-icon> <ha-svg-icon .path=${mdiFilterVariant}></ha-svg-icon>
</mwc-icon-button> </mwc-icon-button>
<mwc-list-item <mwc-list-item
@request-selected="${this._showDisabledChanged}" @request-selected=${this._showDisabledChanged}
graphic="control" graphic="control"
.selected=${this._showDisabled} .selected=${this._showDisabled}
> >
@ -600,7 +600,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
)} )}
</mwc-list-item> </mwc-list-item>
<mwc-list-item <mwc-list-item
@request-selected="${this._showRestoredChanged}" @request-selected=${this._showRestoredChanged}
graphic="control" graphic="control"
.selected=${this._showUnavailable} .selected=${this._showUnavailable}
> >
@ -613,7 +613,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
)} )}
</mwc-list-item> </mwc-list-item>
<mwc-list-item <mwc-list-item
@request-selected="${this._showReadOnlyChanged}" @request-selected=${this._showReadOnlyChanged}
graphic="control" graphic="control"
.selected=${this._showReadOnly} .selected=${this._showReadOnly}
> >

View File

@ -96,14 +96,14 @@ export class DialogHelperDetail extends LitElement {
</div> </div>
<mwc-button <mwc-button
slot="primaryAction" slot="primaryAction"
@click="${this._createItem}" @click=${this._createItem}
.disabled=${this._submitting} .disabled=${this._submitting}
> >
${this.hass!.localize("ui.panel.config.helpers.dialog.create")} ${this.hass!.localize("ui.panel.config.helpers.dialog.create")}
</mwc-button> </mwc-button>
<mwc-button <mwc-button
slot="secondaryAction" slot="secondaryAction"
@click="${this._goBack}" @click=${this._goBack}
.disabled=${this._submitting} .disabled=${this._submitting}
> >
${this.hass!.localize("ui.common.back")} ${this.hass!.localize("ui.common.back")}
@ -145,7 +145,7 @@ export class DialogHelperDetail extends LitElement {
</div> </div>
`; `;
})} })}
<mwc-button slot="primaryAction" @click="${this.closeDialog}"> <mwc-button slot="primaryAction" @click=${this.closeDialog}>
${this.hass!.localize("ui.common.cancel")} ${this.hass!.localize("ui.common.cancel")}
</mwc-button> </mwc-button>
`} `}
@ -166,7 +166,7 @@ export class DialogHelperDetail extends LitElement {
try { try {
await HELPERS[this._platform](this.hass, this._item); await HELPERS[this._platform](this.hass, this._item);
this.closeDialog(); this.closeDialog();
} catch (err) { } catch (err: any) {
this._error = err.message || "Unknown error"; this._error = err.message || "Unknown error";
} finally { } finally {
this._submitting = false; this._submitting = false;

View File

@ -75,9 +75,9 @@ class HaCounterForm extends LitElement {
.label=${this.hass!.localize( .label=${this.hass!.localize(
"ui.dialogs.helper_settings.generic.name" "ui.dialogs.helper_settings.generic.name"
)} )}
.errorMessage="${this.hass!.localize( .errorMessage=${this.hass!.localize(
"ui.dialogs.helper_settings.required_error_msg" "ui.dialogs.helper_settings.required_error_msg"
)}" )}
.invalid=${nameInvalid} .invalid=${nameInvalid}
dialogInitialFocus dialogInitialFocus
></paper-input> ></paper-input>

View File

@ -53,9 +53,9 @@ class HaInputBooleanForm extends LitElement {
.label=${this.hass!.localize( .label=${this.hass!.localize(
"ui.dialogs.helper_settings.generic.name" "ui.dialogs.helper_settings.generic.name"
)} )}
.errorMessage="${this.hass!.localize( .errorMessage=${this.hass!.localize(
"ui.dialogs.helper_settings.required_error_msg" "ui.dialogs.helper_settings.required_error_msg"
)}" )}
.invalid=${nameInvalid} .invalid=${nameInvalid}
dialogInitialFocus dialogInitialFocus
></paper-input> ></paper-input>

View File

@ -64,9 +64,9 @@ class HaInputDateTimeForm extends LitElement {
.label=${this.hass!.localize( .label=${this.hass!.localize(
"ui.dialogs.helper_settings.generic.name" "ui.dialogs.helper_settings.generic.name"
)} )}
.errorMessage="${this.hass!.localize( .errorMessage=${this.hass!.localize(
"ui.dialogs.helper_settings.required_error_msg" "ui.dialogs.helper_settings.required_error_msg"
)}" )}
.invalid=${nameInvalid} .invalid=${nameInvalid}
dialogInitialFocus dialogInitialFocus
></paper-input> ></paper-input>

View File

@ -79,9 +79,9 @@ class HaInputNumberForm extends LitElement {
.label=${this.hass!.localize( .label=${this.hass!.localize(
"ui.dialogs.helper_settings.generic.name" "ui.dialogs.helper_settings.generic.name"
)} )}
.errorMessage="${this.hass!.localize( .errorMessage=${this.hass!.localize(
"ui.dialogs.helper_settings.required_error_msg" "ui.dialogs.helper_settings.required_error_msg"
)}" )}
.invalid=${nameInvalid} .invalid=${nameInvalid}
dialogInitialFocus dialogInitialFocus
></paper-input> ></paper-input>

View File

@ -65,9 +65,9 @@ class HaInputSelectForm extends LitElement {
.label=${this.hass!.localize( .label=${this.hass!.localize(
"ui.dialogs.helper_settings.generic.name" "ui.dialogs.helper_settings.generic.name"
)} )}
.errorMessage="${this.hass!.localize( .errorMessage=${this.hass!.localize(
"ui.dialogs.helper_settings.required_error_msg" "ui.dialogs.helper_settings.required_error_msg"
)}" )}
.invalid=${nameInvalid} .invalid=${nameInvalid}
dialogInitialFocus dialogInitialFocus
></paper-input> ></paper-input>

View File

@ -70,9 +70,9 @@ class HaInputTextForm extends LitElement {
.label=${this.hass!.localize( .label=${this.hass!.localize(
"ui.dialogs.helper_settings.generic.name" "ui.dialogs.helper_settings.generic.name"
)} )}
.errorMessage="${this.hass!.localize( .errorMessage=${this.hass!.localize(
"ui.dialogs.helper_settings.required_error_msg" "ui.dialogs.helper_settings.required_error_msg"
)}" )}
.invalid=${nameInvalid} .invalid=${nameInvalid}
dialogInitialFocus dialogInitialFocus
></paper-input> ></paper-input>

View File

@ -56,9 +56,9 @@ class HaTimerForm extends LitElement {
.label=${this.hass!.localize( .label=${this.hass!.localize(
"ui.dialogs.helper_settings.generic.name" "ui.dialogs.helper_settings.generic.name"
)} )}
.errorMessage="${this.hass!.localize( .errorMessage=${this.hass!.localize(
"ui.dialogs.helper_settings.required_error_msg" "ui.dialogs.helper_settings.required_error_msg"
)}" )}
.invalid=${nameInvalid} .invalid=${nameInvalid}
dialogInitialFocus dialogInitialFocus
></paper-input> ></paper-input>

View File

@ -37,15 +37,15 @@ class HaConfigInfo extends LitElement {
> >
<div class="about"> <div class="about">
<a <a
href="${documentationUrl(this.hass, "")}" href=${documentationUrl(this.hass, "")}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
><img ><img
src="/static/icons/favicon-192x192.png" src="/static/icons/favicon-192x192.png"
height="192" height="192"
alt="${this.hass.localize( alt=${this.hass.localize(
"ui.panel.config.info.home_assistant_logo" "ui.panel.config.info.home_assistant_logo"
)}" )}
/></a> /></a>
<br /> <br />
<h2>Home Assistant ${hass.connection.haVersion}</h2> <h2>Home Assistant ${hass.connection.haVersion}</h2>
@ -58,7 +58,7 @@ class HaConfigInfo extends LitElement {
</p> </p>
<p class="develop"> <p class="develop">
<a <a
href="${documentationUrl(this.hass, "/developers/credits/")}" href=${documentationUrl(this.hass, "/developers/credits/")}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >
@ -122,8 +122,8 @@ class HaConfigInfo extends LitElement {
${customUiList.map( ${customUiList.map(
(item) => html` (item) => html`
<div> <div>
<a href="${item.url}" target="_blank"> ${item.name}</a <a href=${item.url} target="_blank"> ${item.name}</a>:
>: ${item.version} ${item.version}
</div> </div>
` `
)} )}

View File

@ -82,7 +82,7 @@ export class HaIntegrationCard extends LitElement {
return html` return html`
<ha-card <ha-card
outlined outlined
class="${classMap({ class=${classMap({
single: hasItem, single: hasItem,
group: !hasItem, group: !hasItem,
hasMultiple: this.items.length > 1, hasMultiple: this.items.length > 1,
@ -90,7 +90,7 @@ export class HaIntegrationCard extends LitElement {
"state-not-loaded": hasItem && item!.state === "not_loaded", "state-not-loaded": hasItem && item!.state === "not_loaded",
"state-failed-unload": hasItem && item!.state === "failed_unload", "state-failed-unload": hasItem && item!.state === "failed_unload",
"state-error": hasItem && ERROR_STATES.includes(item!.state), "state-error": hasItem && ERROR_STATES.includes(item!.state),
})}" })}
.configEntry=${item} .configEntry=${item}
> >
<ha-integration-header <ha-integration-header
@ -298,12 +298,12 @@ export class HaIntegrationCard extends LitElement {
> >
<ha-svg-icon .path=${mdiDotsVertical}></ha-svg-icon> <ha-svg-icon .path=${mdiDotsVertical}></ha-svg-icon>
</mwc-icon-button> </mwc-icon-button>
<mwc-list-item @request-selected="${this._handleRename}"> <mwc-list-item @request-selected=${this._handleRename}>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.integrations.config_entry.rename" "ui.panel.config.integrations.config_entry.rename"
)} )}
</mwc-list-item> </mwc-list-item>
<mwc-list-item @request-selected="${this._handleSystemOptions}"> <mwc-list-item @request-selected=${this._handleSystemOptions}>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.integrations.config_entry.system_options" "ui.panel.config.integrations.config_entry.system_options"
)} )}
@ -328,20 +328,20 @@ export class HaIntegrationCard extends LitElement {
item.state === "loaded" && item.state === "loaded" &&
item.supports_unload && item.supports_unload &&
item.source !== "system" item.source !== "system"
? html`<mwc-list-item @request-selected="${this._handleReload}"> ? html`<mwc-list-item @request-selected=${this._handleReload}>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.integrations.config_entry.reload" "ui.panel.config.integrations.config_entry.reload"
)} )}
</mwc-list-item>` </mwc-list-item>`
: ""} : ""}
${item.disabled_by === "user" ${item.disabled_by === "user"
? html`<mwc-list-item @request-selected="${this._handleEnable}"> ? html`<mwc-list-item @request-selected=${this._handleEnable}>
${this.hass.localize("ui.common.enable")} ${this.hass.localize("ui.common.enable")}
</mwc-list-item>` </mwc-list-item>`
: item.source !== "system" : item.source !== "system"
? html`<mwc-list-item ? html`<mwc-list-item
class="warning" class="warning"
@request-selected="${this._handleDisable}" @request-selected=${this._handleDisable}
> >
${this.hass.localize("ui.common.disable")} ${this.hass.localize("ui.common.disable")}
</mwc-list-item>` </mwc-list-item>`
@ -349,7 +349,7 @@ export class HaIntegrationCard extends LitElement {
${item.source !== "system" ${item.source !== "system"
? html`<mwc-list-item ? html`<mwc-list-item
class="warning" class="warning"
@request-selected="${this._handleDelete}" @request-selected=${this._handleDelete}
> >
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.integrations.config_entry.delete" "ui.panel.config.integrations.config_entry.delete"
@ -495,7 +495,7 @@ export class HaIntegrationCard extends LitElement {
let result: DisableConfigEntryResult; let result: DisableConfigEntryResult;
try { try {
result = await disableConfigEntry(this.hass, entryId); result = await disableConfigEntry(this.hass, entryId);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.hass.localize( title: this.hass.localize(
"ui.panel.config.integrations.config_entry.disable_error" "ui.panel.config.integrations.config_entry.disable_error"
@ -522,7 +522,7 @@ export class HaIntegrationCard extends LitElement {
let result: DisableConfigEntryResult; let result: DisableConfigEntryResult;
try { try {
result = await enableConfigEntry(this.hass, entryId); result = await enableConfigEntry(this.hass, entryId);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.hass.localize( title: this.hass.localize(
"ui.panel.config.integrations.config_entry.disable_error" "ui.panel.config.integrations.config_entry.disable_error"

View File

@ -45,13 +45,13 @@ class HaPanelDevMqtt extends LitElement {
</div> </div>
</ha-card> </ha-card>
<ha-card <ha-card
header="${this.hass.localize( header=${this.hass.localize(
"ui.panel.config.mqtt.description_publish" "ui.panel.config.mqtt.description_publish"
)}" )}
> >
<div class="card-content"> <div class="card-content">
<paper-input <paper-input
label="${this.hass.localize("ui.panel.config.mqtt.topic")}" label=${this.hass.localize("ui.panel.config.mqtt.topic")}
.value=${this.topic} .value=${this.topic}
@value-changed=${this._handleTopic} @value-changed=${this._handleTopic}
></paper-input> ></paper-input>
@ -59,7 +59,7 @@ class HaPanelDevMqtt extends LitElement {
<p>${this.hass.localize("ui.panel.config.mqtt.payload")}</p> <p>${this.hass.localize("ui.panel.config.mqtt.payload")}</p>
<ha-code-editor <ha-code-editor
mode="jinja2" mode="jinja2"
.value="${this.payload}" .value=${this.payload}
@value-changed=${this._handlePayload} @value-changed=${this._handlePayload}
></ha-code-editor> ></ha-code-editor>
</div> </div>

View File

@ -35,9 +35,7 @@ class MqttSubscribeCard extends LitElement {
protected render(): TemplateResult { protected render(): TemplateResult {
return html` return html`
<ha-card <ha-card
header="${this.hass.localize( header=${this.hass.localize("ui.panel.config.mqtt.description_listen")}
"ui.panel.config.mqtt.description_listen"
)}"
> >
<form> <form>
<paper-input <paper-input
@ -107,7 +105,7 @@ class MqttSubscribeCard extends LitElement {
let payload: string; let payload: string;
try { try {
payload = JSON.stringify(JSON.parse(message.payload), null, 4); payload = JSON.stringify(JSON.parse(message.payload), null, 4);
} catch (e) { } catch (err: any) {
payload = message.payload; payload = message.payload;
} }
this._messages = [ this._messages = [

View File

@ -79,7 +79,7 @@ class DialogOZWRefreshNode extends LitElement {
return html` return html`
<ha-dialog <ha-dialog
open open
@closed="${this._close}" @closed=${this._close}
.heading=${createCloseHeading( .heading=${createCloseHeading(
this.hass, this.hass,
this.hass.localize("ui.panel.config.ozw.refresh_node.title") this.hass.localize("ui.panel.config.ozw.refresh_node.title")

View File

@ -113,7 +113,7 @@ class OZWNodeConfig extends LitElement {
${this._node.node_query_stage} ${this._node.node_query_stage}
${this._metadata?.metadata.ProductManualURL ${this._metadata?.metadata.ProductManualURL
? html` <a ? html` <a
href="${this._metadata.metadata.ProductManualURL}" href=${this._metadata.metadata.ProductManualURL}
> >
<p> <p>
${this.hass.localize( ${this.hass.localize(
@ -136,9 +136,9 @@ class OZWNodeConfig extends LitElement {
? html` ? html`
<ha-card <ha-card
class="content" class="content"
header="${this.hass.localize( header=${this.hass.localize(
"ui.panel.config.ozw.common.wakeup_instructions" "ui.panel.config.ozw.common.wakeup_instructions"
)}" )}
> >
<div class="card-content"> <div class="card-content">
<span class="secondary"> <span class="secondary">
@ -199,7 +199,7 @@ class OZWNodeConfig extends LitElement {
metadataProm, metadataProm,
configProm, configProm,
]); ]);
} catch (err) { } catch (err: any) {
if (err.code === ERR_NOT_FOUND) { if (err.code === ERR_NOT_FOUND) {
this._error = ERR_NOT_FOUND; this._error = ERR_NOT_FOUND;
return; return;

View File

@ -90,7 +90,7 @@ class OZWNodeDashboard extends LitElement {
Query Stage: ${this._node.node_query_stage} Query Stage: ${this._node.node_query_stage}
${this._metadata?.metadata.ProductManualURL ${this._metadata?.metadata.ProductManualURL
? html` <a ? html` <a
href="${this._metadata.metadata.ProductManualURL}" href=${this._metadata.metadata.ProductManualURL}
> >
<p>Product Manual</p> <p>Product Manual</p>
</a>` </a>`
@ -167,7 +167,7 @@ class OZWNodeDashboard extends LitElement {
this.ozwInstance, this.ozwInstance,
this.nodeId this.nodeId
); );
} catch (err) { } catch (err: any) {
if (err.code === ERR_NOT_FOUND) { if (err.code === ERR_NOT_FOUND) {
this._not_found = true; this._not_found = true;
return; return;

View File

@ -61,7 +61,7 @@ class DialogZHACluster extends LitElement {
<ha-dialog <ha-dialog
open open
hideActions hideActions
@closed="${this._close}" @closed=${this._close}
.heading=${createCloseHeading( .heading=${createCloseHeading(
this.hass, this.hass,
this.hass.localize("ui.panel.config.zha.clusters.header") this.hass.localize("ui.panel.config.zha.clusters.header")
@ -69,20 +69,20 @@ class DialogZHACluster extends LitElement {
> >
<zha-clusters <zha-clusters
.hass=${this.hass} .hass=${this.hass}
.selectedDevice="${this._device}" .selectedDevice=${this._device}
@zha-cluster-selected="${this._onClusterSelected}" @zha-cluster-selected=${this._onClusterSelected}
></zha-clusters> ></zha-clusters>
${this._selectedCluster ${this._selectedCluster
? html` ? html`
<zha-cluster-attributes <zha-cluster-attributes
.hass=${this.hass} .hass=${this.hass}
.selectedNode="${this._device}" .selectedNode=${this._device}
.selectedCluster="${this._selectedCluster}" .selectedCluster=${this._selectedCluster}
></zha-cluster-attributes> ></zha-cluster-attributes>
<zha-cluster-commands <zha-cluster-commands
.hass=${this.hass} .hass=${this.hass}
.selectedNode="${this._device}" .selectedNode=${this._device}
.selectedCluster="${this._selectedCluster}" .selectedCluster=${this._selectedCluster}
></zha-cluster-commands> ></zha-cluster-commands>
` `
: ""} : ""}
@ -90,8 +90,8 @@ class DialogZHACluster extends LitElement {
? html` ? html`
<zha-device-binding-control <zha-device-binding-control
.hass=${this.hass} .hass=${this.hass}
.selectedDevice="${this._device}" .selectedDevice=${this._device}
.bindableDevices="${this._bindableDevices}" .bindableDevices=${this._bindableDevices}
></zha-device-binding-control> ></zha-device-binding-control>
` `
: ""} : ""}
@ -99,8 +99,8 @@ class DialogZHACluster extends LitElement {
? html` ? html`
<zha-group-binding-control <zha-group-binding-control
.hass=${this.hass} .hass=${this.hass}
.selectedDevice="${this._device}" .selectedDevice=${this._device}
.groups="${this._groups}" .groups=${this._groups}
></zha-group-binding-control> ></zha-group-binding-control>
` `
: ""} : ""}

View File

@ -36,7 +36,7 @@ class DialogZHADeviceZigbeeInfo extends LitElement {
<ha-dialog <ha-dialog
open open
hideActions hideActions
@closed="${this._close}" @closed=${this._close}
.heading=${createCloseHeading( .heading=${createCloseHeading(
this.hass, this.hass,
this.hass.localize(`ui.dialogs.zha_device_info.device_signature`) this.hass.localize(`ui.dialogs.zha_device_info.device_signature`)

View File

@ -66,7 +66,7 @@ class DialogZHAReconfigureDevice extends LitElement {
return html` return html`
<ha-dialog <ha-dialog
open open
@closed="${this.closeDialog}" @closed=${this.closeDialog}
.heading=${createCloseHeading( .heading=${createCloseHeading(
this.hass, this.hass,
this.hass.localize(`ui.dialogs.zha_reconfigure_device.heading`) + this.hass.localize(`ui.dialogs.zha_reconfigure_device.heading`) +

View File

@ -152,7 +152,7 @@ class ZHAAddDevicesPage extends LitElement {
readonly readonly
max-rows="10" max-rows="10"
class="log" class="log"
value="${this._formattedEvents}" value=${this._formattedEvents}
> >
</paper-textarea>` </paper-textarea>`
: ""} : ""}

View File

@ -70,11 +70,11 @@ export class ZHAAddGroupPage extends LitElement {
</p> </p>
<paper-input <paper-input
type="string" type="string"
.value="${this._groupName}" .value=${this._groupName}
@value-changed=${this._handleNameChange} @value-changed=${this._handleNameChange}
placeholder="${this.hass!.localize( placeholder=${this.hass!.localize(
"ui.panel.config.zha.groups.group_name_placeholder" "ui.panel.config.zha.groups.group_name_placeholder"
)}" )}
></paper-input> ></paper-input>
<div class="header"> <div class="header">
@ -92,10 +92,10 @@ export class ZHAAddGroupPage extends LitElement {
<div class="paper-dialog-buttons"> <div class="paper-dialog-buttons">
<mwc-button <mwc-button
.disabled="${!this._groupName || .disabled=${!this._groupName ||
this._groupName === "" || this._groupName === "" ||
this._processingAdd}" this._processingAdd}
@click="${this._createGroup}" @click=${this._createGroup}
class="button" class="button"
> >
${this._processingAdd ${this._processingAdd

View File

@ -68,7 +68,7 @@ export class ZHAClusterAttributes extends LitElement {
protected render(): TemplateResult { protected render(): TemplateResult {
return html` return html`
<ha-config-section .isWide="${this.isWide}"> <ha-config-section .isWide=${this.isWide}>
<div class="header" slot="header"> <div class="header" slot="header">
<span> <span>
${this.hass!.localize( ${this.hass!.localize(
@ -77,7 +77,7 @@ export class ZHAClusterAttributes extends LitElement {
</span> </span>
<ha-icon-button <ha-icon-button
class="toggle-help-icon" class="toggle-help-icon"
@click="${this._onHelpTap}" @click=${this._onHelpTap}
icon="hass:help-circle" icon="hass:help-circle"
> >
</ha-icon-button> </ha-icon-button>
@ -91,15 +91,15 @@ export class ZHAClusterAttributes extends LitElement {
<ha-card class="content"> <ha-card class="content">
<div class="attribute-picker"> <div class="attribute-picker">
<paper-dropdown-menu <paper-dropdown-menu
label="${this.hass!.localize( label=${this.hass!.localize(
"ui.panel.config.zha.cluster_attributes.attributes_of_cluster" "ui.panel.config.zha.cluster_attributes.attributes_of_cluster"
)}" )}
class="menu" class="menu"
> >
<paper-listbox <paper-listbox
slot="dropdown-content" slot="dropdown-content"
.selected="${this._selectedAttributeIndex}" .selected=${this._selectedAttributeIndex}
@iron-select="${this._selectedAttributeChanged}" @iron-select=${this._selectedAttributeChanged}
> >
${this._attributes.map( ${this._attributes.map(
(entry) => html` (entry) => html`
@ -135,30 +135,26 @@ export class ZHAClusterAttributes extends LitElement {
return html` return html`
<div class="input-text"> <div class="input-text">
<paper-input <paper-input
label="${this.hass!.localize("ui.panel.config.zha.common.value")}" label=${this.hass!.localize("ui.panel.config.zha.common.value")}
type="string" type="string"
.value="${this._attributeValue}" .value=${this._attributeValue}
@value-changed="${this._onAttributeValueChanged}" @value-changed=${this._onAttributeValueChanged}
placeholder="${this.hass!.localize( placeholder=${this.hass!.localize("ui.panel.config.zha.common.value")}
"ui.panel.config.zha.common.value"
)}"
></paper-input> ></paper-input>
</div> </div>
<div class="input-text"> <div class="input-text">
<paper-input <paper-input
label="${this.hass!.localize( label=${this.hass!.localize(
"ui.panel.config.zha.common.manufacturer_code_override" "ui.panel.config.zha.common.manufacturer_code_override"
)}" )}
type="number" type="number"
.value="${this._manufacturerCodeOverride}" .value=${this._manufacturerCodeOverride}
@value-changed="${this._onManufacturerCodeOverrideChanged}" @value-changed=${this._onManufacturerCodeOverrideChanged}
placeholder="${this.hass!.localize( placeholder=${this.hass!.localize("ui.panel.config.zha.common.value")}
"ui.panel.config.zha.common.value"
)}"
></paper-input> ></paper-input>
</div> </div>
<div class="card-actions"> <div class="card-actions">
<mwc-button @click="${this._onGetZigbeeAttributeClick}"> <mwc-button @click=${this._onGetZigbeeAttributeClick}>
${this.hass!.localize( ${this.hass!.localize(
"ui.panel.config.zha.cluster_attributes.get_zigbee_attribute" "ui.panel.config.zha.cluster_attributes.get_zigbee_attribute"
)} )}
@ -176,7 +172,7 @@ export class ZHAClusterAttributes extends LitElement {
.hass=${this.hass} .hass=${this.hass}
domain="zha" domain="zha"
service="set_zigbee_cluster_attribute" service="set_zigbee_cluster_attribute"
.serviceData="${this._setAttributeServiceData}" .serviceData=${this._setAttributeServiceData}
> >
${this.hass!.localize( ${this.hass!.localize(
"ui.panel.config.zha.cluster_attributes.set_zigbee_attribute" "ui.panel.config.zha.cluster_attributes.set_zigbee_attribute"

View File

@ -62,7 +62,7 @@ export class ZHAClusterCommands extends LitElement {
protected render(): TemplateResult { protected render(): TemplateResult {
return html` return html`
<ha-config-section .isWide="${this.isWide}"> <ha-config-section .isWide=${this.isWide}>
<div class="header" slot="header"> <div class="header" slot="header">
<span> <span>
${this.hass!.localize( ${this.hass!.localize(
@ -71,7 +71,7 @@ export class ZHAClusterCommands extends LitElement {
</span> </span>
<ha-icon-button <ha-icon-button
class="toggle-help-icon" class="toggle-help-icon"
@click="${this._onHelpTap}" @click=${this._onHelpTap}
icon="hass:help-circle" icon="hass:help-circle"
> >
</ha-icon-button> </ha-icon-button>
@ -85,15 +85,15 @@ export class ZHAClusterCommands extends LitElement {
<ha-card class="content"> <ha-card class="content">
<div class="command-picker"> <div class="command-picker">
<paper-dropdown-menu <paper-dropdown-menu
label="${this.hass!.localize( label=${this.hass!.localize(
"ui.panel.config.zha.cluster_commands.commands_of_cluster" "ui.panel.config.zha.cluster_commands.commands_of_cluster"
)}" )}
class="menu" class="menu"
> >
<paper-listbox <paper-listbox
slot="dropdown-content" slot="dropdown-content"
.selected="${this._selectedCommandIndex}" .selected=${this._selectedCommandIndex}
@iron-select="${this._selectedCommandChanged}" @iron-select=${this._selectedCommandChanged}
> >
${this._commands.map( ${this._commands.map(
(entry) => html` (entry) => html`
@ -121,15 +121,15 @@ export class ZHAClusterCommands extends LitElement {
? html` ? html`
<div class="input-text"> <div class="input-text">
<paper-input <paper-input
label="${this.hass!.localize( label=${this.hass!.localize(
"ui.panel.config.zha.common.manufacturer_code_override" "ui.panel.config.zha.common.manufacturer_code_override"
)}" )}
type="number" type="number"
.value="${this._manufacturerCodeOverride}" .value=${this._manufacturerCodeOverride}
@value-changed="${this._onManufacturerCodeOverrideChanged}" @value-changed=${this._onManufacturerCodeOverrideChanged}
placeholder="${this.hass!.localize( placeholder=${this.hass!.localize(
"ui.panel.config.zha.common.value" "ui.panel.config.zha.common.value"
)}" )}
></paper-input> ></paper-input>
</div> </div>
<div class="card-actions"> <div class="card-actions">
@ -137,7 +137,7 @@ export class ZHAClusterCommands extends LitElement {
.hass=${this.hass} .hass=${this.hass}
domain="zha" domain="zha"
service="issue_zigbee_cluster_command" service="issue_zigbee_cluster_command"
.serviceData="${this._issueClusterCommandServiceData}" .serviceData=${this._issueClusterCommandServiceData}
> >
${this.hass!.localize( ${this.hass!.localize(
"ui.panel.config.zha.cluster_commands.issue_zigbee_command" "ui.panel.config.zha.cluster_commands.issue_zigbee_command"

View File

@ -62,11 +62,11 @@ export class ZHAClusters extends LitElement {
protected render(): TemplateResult { protected render(): TemplateResult {
return html` return html`
<ha-config-section .isWide="${this.isWide}"> <ha-config-section .isWide=${this.isWide}>
<div class="header" slot="header"> <div class="header" slot="header">
<ha-icon-button <ha-icon-button
class="toggle-help-icon" class="toggle-help-icon"
@click="${this._onHelpTap}" @click=${this._onHelpTap}
icon="hass:help-circle" icon="hass:help-circle"
> >
</ha-icon-button> </ha-icon-button>
@ -85,8 +85,8 @@ export class ZHAClusters extends LitElement {
> >
<paper-listbox <paper-listbox
slot="dropdown-content" slot="dropdown-content"
.selected="${this._selectedClusterIndex}" .selected=${this._selectedClusterIndex}
@iron-select="${this._selectedClusterChanged}" @iron-select=${this._selectedClusterChanged}
> >
${this._clusters.map( ${this._clusters.map(
(entry) => html` (entry) => html`

View File

@ -84,7 +84,7 @@ class ZHAConfigDashboard extends LitElement {
${this.configEntryId ${this.configEntryId
? html`<div class="card-actions"> ? html`<div class="card-actions">
<a <a
href="${`/config/devices/dashboard?historyBack=1&config_entry=${this.configEntryId}`}" href=${`/config/devices/dashboard?historyBack=1&config_entry=${this.configEntryId}`}
> >
<mwc-button <mwc-button
>${this.hass.localize( >${this.hass.localize(
@ -93,7 +93,7 @@ class ZHAConfigDashboard extends LitElement {
> >
</a> </a>
<a <a
href="${`/config/entities/dashboard?historyBack=1&config_entry=${this.configEntryId}`}" href=${`/config/entities/dashboard?historyBack=1&config_entry=${this.configEntryId}`}
> >
<mwc-button <mwc-button
>${this.hass.localize( >${this.hass.localize(

View File

@ -46,12 +46,12 @@ export class ZHADeviceBindingControl extends LitElement {
protected render(): TemplateResult { protected render(): TemplateResult {
return html` return html`
<ha-config-section .isWide="${this.isWide}"> <ha-config-section .isWide=${this.isWide}>
<div class="header" slot="header"> <div class="header" slot="header">
<span>Device Binding</span> <span>Device Binding</span>
<ha-icon-button <ha-icon-button
class="toggle-help-icon" class="toggle-help-icon"
@click="${this._onHelpTap}" @click=${this._onHelpTap}
icon="hass:help-circle" icon="hass:help-circle"
> >
</ha-icon-button> </ha-icon-button>
@ -63,8 +63,8 @@ export class ZHADeviceBindingControl extends LitElement {
<paper-dropdown-menu label="Bindable Devices" class="menu"> <paper-dropdown-menu label="Bindable Devices" class="menu">
<paper-listbox <paper-listbox
slot="dropdown-content" slot="dropdown-content"
.selected="${this._bindTargetIndex}" .selected=${this._bindTargetIndex}
@iron-select="${this._bindTargetIndexChanged}" @iron-select=${this._bindTargetIndexChanged}
> >
${this.bindableDevices.map( ${this.bindableDevices.map(
(device) => html` (device) => html`
@ -87,16 +87,16 @@ export class ZHADeviceBindingControl extends LitElement {
: ""} : ""}
<div class="card-actions"> <div class="card-actions">
<mwc-button <mwc-button
@click="${this._onBindDevicesClick}" @click=${this._onBindDevicesClick}
.disabled="${!(this._deviceToBind && this.selectedDevice)}" .disabled=${!(this._deviceToBind && this.selectedDevice)}
>Bind</mwc-button >Bind</mwc-button
> >
${this._showHelp ${this._showHelp
? html` <div class="helpText">Bind devices.</div> ` ? html` <div class="helpText">Bind devices.</div> `
: ""} : ""}
<mwc-button <mwc-button
@click="${this._onUnbindDevicesClick}" @click=${this._onUnbindDevicesClick}
.disabled="${!(this._deviceToBind && this.selectedDevice)}" .disabled=${!(this._deviceToBind && this.selectedDevice)}
>Unbind</mwc-button >Unbind</mwc-button
> >
${this._showHelp ${this._showHelp

View File

@ -91,9 +91,9 @@ class ZHADeviceCard extends SubscribeMixin(LitElement) {
${entities.map( ${entities.map(
(entity) => html` (entity) => html`
<state-badge <state-badge
@click="${this._openMoreInfo}" @click=${this._openMoreInfo}
.title=${entity.stateName!} .title=${entity.stateName!}
.stateObj="${this.hass!.states[entity.entity_id]}" .stateObj=${this.hass!.states[entity.entity_id]}
slot="item-icon" slot="item-icon"
></state-badge> ></state-badge>
` `
@ -186,7 +186,7 @@ class ZHADeviceCard extends SubscribeMixin(LitElement) {
area_id: area, area_id: area,
}); });
this.device!.area_id = area; this.device!.area_id = area;
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.panel.config.integrations.config_flow.error_saving_area", "ui.panel.config.integrations.config_flow.error_saving_area",

View File

@ -68,7 +68,7 @@ export class ZHADeviceEndpointDataTable extends LitElement {
direction: "asc", direction: "asc",
grows: true, grows: true,
template: (name, device: any) => html` template: (name, device: any) => html`
<a href="${`/config/devices/device/${device.dev_id}`}"> <a href=${`/config/devices/device/${device.dev_id}`}>
${name} ${name}
</a> </a>
`, `,
@ -87,7 +87,7 @@ export class ZHADeviceEndpointDataTable extends LitElement {
direction: "asc", direction: "asc",
grows: true, grows: true,
template: (name, device: any) => html` template: (name, device: any) => html`
<a href="${`/config/devices/device/${device.dev_id}`}"> <a href=${`/config/devices/device/${device.dev_id}`}>
${name} ${name}
</a> </a>
`, `,

View File

@ -71,7 +71,7 @@ export class ZHAGroupBindingControl extends LitElement {
protected render(): TemplateResult { protected render(): TemplateResult {
return html` return html`
<ha-config-section .isWide="${this.isWide}"> <ha-config-section .isWide=${this.isWide}>
<div class="sectionHeader" slot="header"> <div class="sectionHeader" slot="header">
<span <span
>${this.hass!.localize( >${this.hass!.localize(
@ -80,7 +80,7 @@ export class ZHAGroupBindingControl extends LitElement {
> >
<ha-icon-button <ha-icon-button
class="toggle-help-icon" class="toggle-help-icon"
@click="${this._onHelpTap}" @click=${this._onHelpTap}
icon="hass:help-circle" icon="hass:help-circle"
> >
</ha-icon-button> </ha-icon-button>
@ -101,8 +101,8 @@ export class ZHAGroupBindingControl extends LitElement {
> >
<paper-listbox <paper-listbox
slot="dropdown-content" slot="dropdown-content"
.selected="${this._bindTargetIndex}" .selected=${this._bindTargetIndex}
@iron-select="${this._bindTargetIndexChanged}" @iron-select=${this._bindTargetIndexChanged}
> >
${this.groups.map( ${this.groups.map(
(group) => html` <paper-item>${group.name}</paper-item> ` (group) => html` <paper-item>${group.name}</paper-item> `
@ -139,8 +139,8 @@ export class ZHAGroupBindingControl extends LitElement {
: ""} : ""}
<div class="card-actions"> <div class="card-actions">
<mwc-button <mwc-button
@click="${this._onBindGroupClick}" @click=${this._onBindGroupClick}
.disabled="${!this._canBind}" .disabled=${!this._canBind}
>${this.hass!.localize( >${this.hass!.localize(
"ui.panel.config.zha.group_binding.bind_button_label" "ui.panel.config.zha.group_binding.bind_button_label"
)}</mwc-button )}</mwc-button
@ -155,8 +155,8 @@ export class ZHAGroupBindingControl extends LitElement {
` `
: ""} : ""}
<mwc-button <mwc-button
@click="${this._onUnbindGroupClick}" @click=${this._onUnbindGroupClick}
.disabled="${!this._canBind}" .disabled=${!this._canBind}
>${this.hass!.localize( >${this.hass!.localize(
"ui.panel.config.zha.group_binding.unbind_button_label" "ui.panel.config.zha.group_binding.unbind_button_label"
)}</mwc-button )}</mwc-button

View File

@ -155,13 +155,13 @@ export class ZHAGroupPage extends LitElement {
<div class="paper-dialog-buttons"> <div class="paper-dialog-buttons">
<mwc-button <mwc-button
.disabled="${!this._selectedDevicesToRemove.length || .disabled=${!this._selectedDevicesToRemove.length ||
this._processingRemove}" this._processingRemove}
@click="${this._removeMembersFromGroup}" @click=${this._removeMembersFromGroup}
class="button" class="button"
> >
<ha-circular-progress <ha-circular-progress
?active="${this._processingRemove}" ?active=${this._processingRemove}
alt=${this.hass.localize( alt=${this.hass.localize(
"ui.panel.config.zha.groups.removing_members" "ui.panel.config.zha.groups.removing_members"
)} )}
@ -190,9 +190,9 @@ export class ZHAGroupPage extends LitElement {
<div class="paper-dialog-buttons"> <div class="paper-dialog-buttons">
<mwc-button <mwc-button
.disabled="${!this._selectedDevicesToAdd.length || .disabled=${!this._selectedDevicesToAdd.length ||
this._processingAdd}" this._processingAdd}
@click="${this._addMembersToGroup}" @click=${this._addMembersToGroup}
class="button" class="button"
> >
${this._processingAdd ${this._processingAdd

View File

@ -453,7 +453,7 @@ export class ZwaveMigration extends LitElement {
this._zwaveJsEntryId!, this._zwaveJsEntryId!,
true true
); );
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: "Failed to get migration data!", title: "Failed to get migration data!",
text: text:

View File

@ -45,7 +45,7 @@ export class ZwaveNetwork extends LitElement {
protected render(): TemplateResult { protected render(): TemplateResult {
return html` return html`
<ha-config-section .isWide="${this.isWide}"> <ha-config-section .isWide=${this.isWide}>
<div class="sectionHeader" slot="header"> <div class="sectionHeader" slot="header">
<span> <span>
${this.hass!.localize( ${this.hass!.localize(
@ -54,7 +54,7 @@ export class ZwaveNetwork extends LitElement {
</span> </span>
<ha-icon-button <ha-icon-button
class="toggle-help-icon" class="toggle-help-icon"
@click="${this._onHelpTap}" @click=${this._onHelpTap}
icon="hass:help-circle" icon="hass:help-circle"
></ha-icon-button> ></ha-icon-button>
</div> </div>
@ -64,10 +64,7 @@ export class ZwaveNetwork extends LitElement {
)} )}
<p> <p>
<a <a
href="${documentationUrl( href=${documentationUrl(this.hass, "/docs/z-wave/control-panel/")}
this.hass,
"/docs/z-wave/control-panel/"
)}"
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >
@ -217,14 +214,14 @@ export class ZwaveNetwork extends LitElement {
<ha-call-service-button <ha-call-service-button
.hass=${this.hass} .hass=${this.hass}
domain="zwave" domain="zwave"
service="${service}" service=${service}
> >
${this.hass!.localize("ui.panel.config.zwave.services." + service)} ${this.hass!.localize("ui.panel.config.zwave.services." + service)}
</ha-call-service-button> </ha-call-service-button>
<ha-service-description <ha-service-description
.hass=${this.hass} .hass=${this.hass}
domain="zwave" domain="zwave"
service="${service}" service=${service}
?hidden=${!this._showHelp} ?hidden=${!this._showHelp}
> >
</ha-service-description> </ha-service-description>

View File

@ -52,9 +52,9 @@ export class ZwaveNodeConfig extends LitElement {
? html` ? html`
<div class="card-actions"> <div class="card-actions">
<paper-input <paper-input
.floatLabel="${this.hass!.localize( .floatLabel=${this.hass!.localize(
"ui.panel.config.zwave.common.wakeup_interval" "ui.panel.config.zwave.common.wakeup_interval"
)}" )}
type="number" type="number"
.value=${this._wakeupInput !== -1 .value=${this._wakeupInput !== -1
? this._wakeupInput ? this._wakeupInput

View File

@ -89,7 +89,7 @@ class DialogZWaveJSAddNode extends LitElement {
return html` return html`
<ha-dialog <ha-dialog
open open
@closed="${this.closeDialog}" @closed=${this.closeDialog}
.heading=${createCloseHeading( .heading=${createCloseHeading(
this.hass, this.hass,
this.hass.localize("ui.panel.config.zwave_js.add_node.title") this.hass.localize("ui.panel.config.zwave_js.add_node.title")
@ -363,7 +363,7 @@ class DialogZWaveJSAddNode extends LitElement {
again by excluding the device and adding it again. again by excluding the device and adding it again.
</ha-alert>` </ha-alert>`
: ""} : ""}
<a href="${`/config/devices/device/${this._device!.id}`}"> <a href=${`/config/devices/device/${this._device!.id}`}>
<mwc-button> <mwc-button>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.zwave_js.add_node.view_device" "ui.panel.config.zwave_js.add_node.view_device"
@ -432,7 +432,7 @@ class DialogZWaveJSAddNode extends LitElement {
this._entryId!, this._entryId!,
this._pinInput!.value as string this._pinInput!.value as string
); );
} catch (err) { } catch (err: any) {
this._error = err.message; this._error = err.message;
this._status = "validate_dsk_enter_pin"; this._status = "validate_dsk_enter_pin";
} }
@ -447,7 +447,7 @@ class DialogZWaveJSAddNode extends LitElement {
this._entryId!, this._entryId!,
this._securityClasses this._securityClasses
); );
} catch (err) { } catch (err: any) {
this._error = err.message; this._error = err.message;
this._status = "grant_security_classes"; this._status = "grant_security_classes";
} }

View File

@ -225,8 +225,8 @@ class DialogZWaveJSHealNode extends LitElement {
this._status = (await healNode(this.hass, this.entry_id!, this.node_id!)) this._status = (await healNode(this.hass, this.entry_id!, this.node_id!))
? "finished" ? "finished"
: "failed"; : "failed";
} catch (error) { } catch (err: any) {
this._error = error.message; this._error = err.message;
this._status = "failed"; this._status = "failed";
} }
} }

View File

@ -63,7 +63,7 @@ class DialogZWaveJSRemoveFailedNode extends LitElement {
return html` return html`
<ha-dialog <ha-dialog
open open
@closed="${this.closeDialog}" @closed=${this.closeDialog}
.heading=${createCloseHeading( .heading=${createCloseHeading(
this.hass, this.hass,
this.hass.localize( this.hass.localize(

View File

@ -48,7 +48,7 @@ class DialogZWaveJSRemoveNode extends LitElement {
return html` return html`
<ha-dialog <ha-dialog
open open
@closed="${this.closeDialog}" @closed=${this.closeDialog}
.heading=${createCloseHeading( .heading=${createCloseHeading(
this.hass, this.hass,
this.hass.localize("ui.panel.config.zwave_js.remove_node.title") this.hass.localize("ui.panel.config.zwave_js.remove_node.title")

View File

@ -154,14 +154,14 @@ class ZWaveJSConfigDashboard extends LitElement {
</div> </div>
<div class="card-actions"> <div class="card-actions">
<a <a
href="${`/config/devices/dashboard?historyBack=1&config_entry=${this.configEntryId}`}" href=${`/config/devices/dashboard?historyBack=1&config_entry=${this.configEntryId}`}
> >
<mwc-button> <mwc-button>
${this.hass.localize("ui.panel.config.devices.caption")} ${this.hass.localize("ui.panel.config.devices.caption")}
</mwc-button> </mwc-button>
</a> </a>
<a <a
href="${`/config/entities/dashboard?historyBack=1&config_entry=${this.configEntryId}`}" href=${`/config/entities/dashboard?historyBack=1&config_entry=${this.configEntryId}`}
> >
<mwc-button> <mwc-button>
${this.hass.localize( ${this.hass.localize(
@ -422,7 +422,7 @@ class ZWaveJSConfigDashboard extends LitElement {
this.hass, this.hass,
`/api/zwave_js/dump/${this.configEntryId}` `/api/zwave_js/dump/${this.configEntryId}`
); );
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: "Error", title: "Error",
text: err.error || err.body || err, text: err.error || err.body || err,

View File

@ -168,8 +168,8 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
"device_database", "device_database",
html`<a html`<a
rel="noreferrer noopener" rel="noreferrer noopener"
href="${this._nodeMetadata?.device_database_url || href=${this._nodeMetadata?.device_database_url ||
"https://devices.zwave-js.io"}" "https://devices.zwave-js.io"}
target="_blank" target="_blank"
>${this.hass.localize( >${this.hass.localize(
"ui.panel.config.zwave_js.node_config.zwave_js_device_database" "ui.panel.config.zwave_js.node_config.zwave_js_device_database"
@ -389,8 +389,8 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
this._config![target.key].value = value; this._config![target.key].value = value;
this.setResult(target.key, result.status); this.setResult(target.key, result.status);
} catch (error) { } catch (err: any) {
this.setError(target.key, error.message); this.setError(target.key, err.message);
} }
} }

View File

@ -68,7 +68,7 @@ class DialogSystemLogDetail extends LitElement {
!this._manifest.documentation.includes("www.home-assistant.io")); !this._manifest.documentation.includes("www.home-assistant.io"));
return html` return html`
<ha-dialog open @closed=${this.closeDialog} hideActions heading=${true}> <ha-dialog open @closed=${this.closeDialog} hideActions .heading=${true}>
<ha-header-bar slot="heading"> <ha-header-bar slot="heading">
<mwc-icon-button slot="navigationIcon" dialogAction="cancel"> <mwc-icon-button slot="navigationIcon" dialogAction="cancel">
<ha-svg-icon .path=${mdiClose}></ha-svg-icon> <ha-svg-icon .path=${mdiClose}></ha-svg-icon>
@ -77,7 +77,7 @@ class DialogSystemLogDetail extends LitElement {
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.logs.details", "ui.panel.config.logs.details",
"level", "level",
html`<span class="${item.level.toLowerCase()}" html`<span class=${item.level.toLowerCase()}
>${this.hass.localize( >${this.hass.localize(
"ui.panel.config.logs.level." + item.level.toLowerCase() "ui.panel.config.logs.level." + item.level.toLowerCase()
)}</span )}</span
@ -163,7 +163,7 @@ class DialogSystemLogDetail extends LitElement {
private async _fetchManifest(integration: string) { private async _fetchManifest(integration: string) {
try { try {
this._manifest = await fetchIntegrationManifest(this.hass, integration); this._manifest = await fetchIntegrationManifest(this.hass, integration);
} catch (err) { } catch (err: any) {
// Ignore if loading manifest fails. Probably bad JSON in manifest // Ignore if loading manifest fails. Probably bad JSON in manifest
} }
} }

View File

@ -62,7 +62,7 @@ export class SystemLogCard extends LitElement {
this.hass!.locale this.hass!.locale
)} )}
${html`(<span class="${item.level.toLowerCase()}" ${html`(<span class=${item.level.toLowerCase()}
>${this.hass.localize( >${this.hass.localize(
"ui.panel.config.logs.level." + "ui.panel.config.logs.level." +
item.level.toLowerCase() item.level.toLowerCase()

View File

@ -74,7 +74,7 @@ export class DialogLovelaceDashboardDetail extends LitElement {
return html` return html`
<ha-dialog <ha-dialog
open open
@closed="${this._close}" @closed=${this._close}
scrimClickAction scrimClickAction
escapeKeyAction escapeKeyAction
.heading=${createCloseHeading( .heading=${createCloseHeading(
@ -205,7 +205,7 @@ export class DialogLovelaceDashboardDetail extends LitElement {
: ""} : ""}
<mwc-button <mwc-button
slot="primaryAction" slot="primaryAction"
@click="${this._updateDashboard}" @click=${this._updateDashboard}
.disabled=${urlInvalid || titleInvalid || this._submitting} .disabled=${urlInvalid || titleInvalid || this._submitting}
> >
${this._params.urlPath ${this._params.urlPath
@ -293,7 +293,7 @@ export class DialogLovelaceDashboardDetail extends LitElement {
); );
} }
this._close(); this._close();
} catch (err) { } catch (err: any) {
this._error = err?.message || "Unknown error"; this._error = err?.message || "Unknown error";
} finally { } finally {
this._submitting = false; this._submitting = false;

View File

@ -298,7 +298,7 @@ export class HaConfigLovelaceDashboards extends LitElement {
(res) => res !== dashboard (res) => res !== dashboard
); );
return true; return true;
} catch (err) { } catch (err: any) {
return false; return false;
} }
}, },

View File

@ -151,7 +151,7 @@ export class DialogLovelaceResourceDetail extends LitElement {
<mwc-button <mwc-button
slot="secondaryAction" slot="secondaryAction"
class="warning" class="warning"
@click="${this._deleteResource}" @click=${this._deleteResource}
.disabled=${this._submitting} .disabled=${this._submitting}
> >
${this.hass!.localize( ${this.hass!.localize(
@ -162,7 +162,7 @@ export class DialogLovelaceResourceDetail extends LitElement {
: html``} : html``}
<mwc-button <mwc-button
slot="primaryAction" slot="primaryAction"
@click="${this._updateResource}" @click=${this._updateResource}
.disabled=${urlInvalid || !this._type || this._submitting} .disabled=${urlInvalid || !this._type || this._submitting}
> >
${this._params.resource ${this._params.resource
@ -206,7 +206,7 @@ export class DialogLovelaceResourceDetail extends LitElement {
await this._params!.createResource(values); await this._params!.createResource(values);
} }
this._params = undefined; this._params = undefined;
} catch (err) { } catch (err: any) {
this._error = err?.message || "Unknown error"; this._error = err?.message || "Unknown error";
} finally { } finally {
this._submitting = false; this._submitting = false;

View File

@ -185,7 +185,7 @@ export class HaConfigLovelaceRescources extends LitElement {
confirm: () => location.reload(), confirm: () => location.reload(),
}); });
return true; return true;
} catch (err) { } catch (err: any) {
return false; return false;
} }
}, },

View File

@ -120,12 +120,10 @@ class DialogPersonDetail extends LitElement {
dialogInitialFocus dialogInitialFocus
.value=${this._name} .value=${this._name}
@value-changed=${this._nameChanged} @value-changed=${this._nameChanged}
label="${this.hass!.localize( label=${this.hass!.localize("ui.panel.config.person.detail.name")}
"ui.panel.config.person.detail.name" error-message=${this.hass!.localize(
)}"
error-message="${this.hass!.localize(
"ui.panel.config.person.detail.name_error_msg" "ui.panel.config.person.detail.name_error_msg"
)}" )}
required required
auto-validate auto-validate
></paper-input> ></paper-input>
@ -198,10 +196,10 @@ class DialogPersonDetail extends LitElement {
<ul> <ul>
<li> <li>
<a <a
href="${documentationUrl( href=${documentationUrl(
this.hass, this.hass,
"/integrations/#presence-detection" "/integrations/#presence-detection"
)}" )}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>${this.hass!.localize( >${this.hass!.localize(
@ -211,7 +209,7 @@ class DialogPersonDetail extends LitElement {
</li> </li>
<li> <li>
<a <a
@click="${this._closeDialog}" @click=${this._closeDialog}
href="/config/integrations" href="/config/integrations"
> >
${this.hass!.localize( ${this.hass!.localize(
@ -228,7 +226,7 @@ class DialogPersonDetail extends LitElement {
<mwc-button <mwc-button
slot="secondaryAction" slot="secondaryAction"
class="warning" class="warning"
@click="${this._deleteEntry}" @click=${this._deleteEntry}
.disabled=${(this._user && this._user.is_owner) || .disabled=${(this._user && this._user.is_owner) ||
this._submitting} this._submitting}
> >
@ -248,7 +246,7 @@ class DialogPersonDetail extends LitElement {
: html``} : html``}
<mwc-button <mwc-button
slot="primaryAction" slot="primaryAction"
@click="${this._updateEntry}" @click=${this._updateEntry}
.disabled=${nameInvalid || this._submitting} .disabled=${nameInvalid || this._submitting}
> >
${this._params.entry ${this._params.entry
@ -398,7 +396,7 @@ class DialogPersonDetail extends LitElement {
this._personExists = true; this._personExists = true;
} }
this._params = undefined; this._params = undefined;
} catch (err) { } catch (err: any) {
this._error = err ? err.message : "Unknown error"; this._error = err ? err.message : "Unknown error";
} finally { } finally {
this._submitting = false; this._submitting = false;

View File

@ -248,7 +248,7 @@ class HaConfigPerson extends LitElement {
(ent) => ent !== entry (ent) => ent !== entry
); );
return true; return true;
} catch (err) { } catch (err: any) {
return false; return false;
} }
}, },

View File

@ -74,9 +74,9 @@ class HaSceneDashboard extends LitElement {
html` html`
<mwc-icon-button <mwc-icon-button
.scene=${scene} .scene=${scene}
title="${this.hass.localize( title=${this.hass.localize(
"ui.panel.config.scene.picker.activate_scene" "ui.panel.config.scene.picker.activate_scene"
)}" )}
@click=${(ev: Event) => this._activateScene(ev)} @click=${(ev: Event) => this._activateScene(ev)}
> >
<ha-svg-icon .path=${mdiPlay}></ha-svg-icon> <ha-svg-icon .path=${mdiPlay}></ha-svg-icon>
@ -102,9 +102,9 @@ class HaSceneDashboard extends LitElement {
<mwc-icon-button <mwc-icon-button
.scene=${scene} .scene=${scene}
@click=${this._showInfo} @click=${this._showInfo}
title="${this.hass.localize( title=${this.hass.localize(
"ui.panel.config.scene.picker.show_info_scene" "ui.panel.config.scene.picker.show_info_scene"
)}" )}
> >
<ha-svg-icon .path=${mdiInformationOutline}></ha-svg-icon> <ha-svg-icon .path=${mdiInformationOutline}></ha-svg-icon>
</mwc-icon-button> </mwc-icon-button>
@ -123,9 +123,9 @@ class HaSceneDashboard extends LitElement {
> >
<mwc-icon-button <mwc-icon-button
.disabled=${!scene.attributes.id} .disabled=${!scene.attributes.id}
title="${this.hass.localize( title=${this.hass.localize(
"ui.panel.config.scene.picker.edit_scene" "ui.panel.config.scene.picker.edit_scene"
)}" )}
> >
<ha-svg-icon <ha-svg-icon
.path=${scene.attributes.id ? mdiPencil : mdiPencilOff} .path=${scene.attributes.id ? mdiPencil : mdiPencilOff}
@ -234,7 +234,7 @@ class HaSceneDashboard extends LitElement {
${this.hass.localize("ui.panel.config.scene.picker.introduction")} ${this.hass.localize("ui.panel.config.scene.picker.introduction")}
<p> <p>
<a <a
href="${documentationUrl(this.hass, "/docs/scene/editor/")}" href=${documentationUrl(this.hass, "/docs/scene/editor/")}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >

View File

@ -254,9 +254,9 @@ export class HaSceneEditor extends SubscribeMixin(
${this.narrow ? html` <span slot="header">${name}</span> ` : ""} ${this.narrow ? html` <span slot="header">${name}</span> ` : ""}
<div <div
id="root" id="root"
class="${classMap({ class=${classMap({
rtl: computeRTL(this.hass), rtl: computeRTL(this.hass),
})}" })}
> >
${this._config ${this._config
? html` ? html`
@ -312,9 +312,9 @@ export class HaSceneEditor extends SubscribeMixin(
${device.name} ${device.name}
<ha-icon-button <ha-icon-button
icon="hass:delete" icon="hass:delete"
title="${this.hass.localize( title=${this.hass.localize(
"ui.panel.config.scene.editor.devices.delete" "ui.panel.config.scene.editor.devices.delete"
)}" )}
.device=${device.id} .device=${device.id}
@click=${this._deleteDevice} @click=${this._deleteDevice}
></ha-icon-button> ></ha-icon-button>
@ -404,9 +404,9 @@ export class HaSceneEditor extends SubscribeMixin(
<ha-icon-button <ha-icon-button
icon="hass:delete" icon="hass:delete"
.entityId=${entityId} .entityId=${entityId}
.title="${this.hass.localize( .title=${this.hass.localize(
"ui.panel.config.scene.editor.entities.delete" "ui.panel.config.scene.editor.entities.delete"
)}" )}
@click=${this._deleteEntity} @click=${this._deleteEntity}
></ha-icon-button> ></ha-icon-button>
</paper-icon-item> </paper-icon-item>
@ -554,7 +554,7 @@ export class HaSceneEditor extends SubscribeMixin(
let config: SceneConfig; let config: SceneConfig;
try { try {
config = await getSceneConfig(this.hass, this.sceneId!); config = await getSceneConfig(this.hass, this.sceneId!);
} catch (err) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
text: text:
err.status_code === 404 err.status_code === 404
@ -798,7 +798,7 @@ export class HaSceneEditor extends SubscribeMixin(
if (!this.sceneId) { if (!this.sceneId) {
navigate(`/config/scene/edit/${id}`, { replace: true }); navigate(`/config/scene/edit/${id}`, { replace: true });
} }
} catch (err) { } catch (err: any) {
this._errors = err.body.message || err.message; this._errors = err.body.message || err.message;
showToast(this, { showToast(this, {
message: err.body.message || err.message, message: err.body.message || err.message,

View File

@ -242,10 +242,10 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
"ui.panel.config.script.editor.modes.description", "ui.panel.config.script.editor.modes.description",
"documentation_link", "documentation_link",
html`<a html`<a
href="${documentationUrl( href=${documentationUrl(
this.hass, this.hass,
"/integrations/script/#script-modes" "/integrations/script/#script-modes"
)}" )}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>${this.hass.localize( >${this.hass.localize(
@ -309,9 +309,9 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
</a> </a>
<mwc-button <mwc-button
@click=${this._runScript} @click=${this._runScript}
title="${this.hass.localize( title=${this.hass.localize(
"ui.panel.config.script.picker.run_script" "ui.panel.config.script.picker.run_script"
)}" )}
?disabled=${this._dirty} ?disabled=${this._dirty}
> >
${this.hass.localize( ${this.hass.localize(
@ -337,10 +337,10 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
)} )}
</p> </p>
<a <a
href="${documentationUrl( href=${documentationUrl(
this.hass, this.hass,
"/docs/scripts/" "/docs/scripts/"
)}" )}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >
@ -370,9 +370,9 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
> >
<mwc-button <mwc-button
@click=${this._runScript} @click=${this._runScript}
title="${this.hass.localize( title=${this.hass.localize(
"ui.panel.config.script.picker.run_script" "ui.panel.config.script.picker.run_script"
)}" )}
?disabled=${this._dirty} ?disabled=${this._dirty}
> >
${this.hass.localize( ${this.hass.localize(

Some files were not shown because too many files have changed in this diff Show More