mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Update ts-eslint (#23723)
* Update ts-eslint * Remove comments * Remove unused ts-ignore * Add undefined generic type instead of unknown * Remove unused undefined type * Fix type issues * Use undefined instead of void for subscribed return type
This commit is contained in:
parent
922cd72be4
commit
abe8899f9b
@ -9,7 +9,7 @@ export default [
|
|||||||
"import/extensions": "off",
|
"import/extensions": "off",
|
||||||
"import/no-dynamic-require": "off",
|
"import/no-dynamic-require": "off",
|
||||||
"global-require": "off",
|
"global-require": "off",
|
||||||
"@typescript-eslint/no-var-requires": "off",
|
"@typescript-eslint/no-require-imports": "off",
|
||||||
"prefer-arrow-callback": "off",
|
"prefer-arrow-callback": "off",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -203,7 +203,7 @@ class HcCast extends LitElement {
|
|||||||
}
|
}
|
||||||
this.connection.close();
|
this.connection.close();
|
||||||
location.reload();
|
location.reload();
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
alert("Unable to log out!");
|
alert("Unable to log out!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ export class HcConnect extends LitElement {
|
|||||||
let url: URL;
|
let url: URL;
|
||||||
try {
|
try {
|
||||||
url = new URL(value);
|
url = new URL(value);
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
this.error = "Invalid URL";
|
this.error = "Invalid URL";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -288,7 +288,7 @@ export class HcConnect extends LitElement {
|
|||||||
try {
|
try {
|
||||||
saveTokens(null);
|
saveTokens(null);
|
||||||
location.reload();
|
location.reload();
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
alert("Unable to log out!");
|
alert("Unable to log out!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ customElements.whenDefined("hui-root").then(() => {
|
|||||||
const index = (ev as CustomEvent).detail.index;
|
const index = (ev as CustomEvent).detail.index;
|
||||||
try {
|
try {
|
||||||
await setDemoConfig(this.hass, this.lovelace!, index);
|
await setDemoConfig(this.hass, this.lovelace!, index);
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
setDemoConfig(this.hass, this.lovelace!, selectedDemoConfigIndex);
|
setDemoConfig(this.hass, this.lovelace!, selectedDemoConfigIndex);
|
||||||
alert("Failed to switch config :-(");
|
alert("Failed to switch config :-(");
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
|||||||
const generateMeanStatistics = (
|
const generateMeanStatistics = (
|
||||||
start: Date,
|
start: Date,
|
||||||
end: Date,
|
end: Date,
|
||||||
// eslint-disable-next-line @typescript-eslint/default-param-last
|
// eslint-disable-next-line default-param-last
|
||||||
period: "5minute" | "hour" | "day" | "month" = "hour",
|
period: "5minute" | "hour" | "day" | "month" = "hour",
|
||||||
initValue: number,
|
initValue: number,
|
||||||
maxDiff: number
|
maxDiff: number
|
||||||
@ -52,7 +52,7 @@ const generateMeanStatistics = (
|
|||||||
const generateSumStatistics = (
|
const generateSumStatistics = (
|
||||||
start: Date,
|
start: Date,
|
||||||
end: Date,
|
end: Date,
|
||||||
// eslint-disable-next-line @typescript-eslint/default-param-last
|
// eslint-disable-next-line default-param-last
|
||||||
period: "5minute" | "hour" | "day" | "month" = "hour",
|
period: "5minute" | "hour" | "day" | "month" = "hour",
|
||||||
initValue: number,
|
initValue: number,
|
||||||
maxDiff: number
|
maxDiff: number
|
||||||
@ -89,7 +89,7 @@ const generateSumStatistics = (
|
|||||||
const generateCurvedStatistics = (
|
const generateCurvedStatistics = (
|
||||||
start: Date,
|
start: Date,
|
||||||
end: Date,
|
end: Date,
|
||||||
// eslint-disable-next-line @typescript-eslint/default-param-last
|
// eslint-disable-next-line default-param-last
|
||||||
_period: "5minute" | "hour" | "day" | "month" = "hour",
|
_period: "5minute" | "hour" | "day" | "month" = "hour",
|
||||||
initValue: number,
|
initValue: number,
|
||||||
maxDiff: number,
|
maxDiff: number,
|
||||||
|
@ -18,8 +18,8 @@ const compat = new FlatCompat({
|
|||||||
export default [
|
export default [
|
||||||
...compat.extends(
|
...compat.extends(
|
||||||
"airbnb-base",
|
"airbnb-base",
|
||||||
"airbnb-typescript/base",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
"plugin:@typescript-eslint/recommended",
|
||||||
|
"plugin:@typescript-eslint/strict",
|
||||||
"plugin:wc/recommended",
|
"plugin:wc/recommended",
|
||||||
"plugin:lit/all",
|
"plugin:lit/all",
|
||||||
"plugin:lit-a11y/recommended",
|
"plugin:lit-a11y/recommended",
|
||||||
@ -50,8 +50,6 @@ export default [
|
|||||||
ecmaFeatures: {
|
ecmaFeatures: {
|
||||||
modules: true,
|
modules: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
project: "./tsconfig.json",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -148,15 +146,15 @@ export default [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
"@typescript-eslint/no-unused-vars": "off",
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
|
||||||
"unused-imports/no-unused-vars": [
|
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
vars: "all",
|
args: "all",
|
||||||
varsIgnorePattern: "^_",
|
|
||||||
args: "after-used",
|
|
||||||
argsIgnorePattern: "^_",
|
argsIgnorePattern: "^_",
|
||||||
|
caughtErrors: "all",
|
||||||
|
caughtErrorsIgnorePattern: "^_",
|
||||||
|
destructuredArrayIgnorePattern: "^_",
|
||||||
|
varsIgnorePattern: "^_",
|
||||||
ignoreRestSiblings: true,
|
ignoreRestSiblings: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -174,6 +172,16 @@ export default [
|
|||||||
"lit-a11y/role-has-required-aria-attrs": "error",
|
"lit-a11y/role-has-required-aria-attrs": "error",
|
||||||
"@typescript-eslint/consistent-type-imports": "error",
|
"@typescript-eslint/consistent-type-imports": "error",
|
||||||
"@typescript-eslint/no-import-type-side-effects": "error",
|
"@typescript-eslint/no-import-type-side-effects": "error",
|
||||||
|
camelcase: "off",
|
||||||
|
"@typescript-eslint/no-dynamic-delete": "off",
|
||||||
|
"@typescript-eslint/no-empty-object-type": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
allowInterfaces: "always",
|
||||||
|
allowObjectTypes: "always",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"no-use-before-define": "off",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -15,7 +15,7 @@ import type { LocalizeFunc } from "../../../src/common/translations/localize";
|
|||||||
declare global {
|
declare global {
|
||||||
interface HASSDomEvents {
|
interface HASSDomEvents {
|
||||||
"backup-uploaded": { backup: HassioBackup };
|
"backup-uploaded": { backup: HassioBackup };
|
||||||
"backup-cleared": void;
|
"backup-cleared": undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ export class DialogHassioBackupUpload
|
|||||||
await this.updateComplete;
|
await this.updateComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
if (this._dialogParams && !this._dialogParams.onboarding) {
|
if (this._dialogParams && !this._dialogParams.onboarding) {
|
||||||
if (this._dialogParams.reloadBackup) {
|
if (this._dialogParams.reloadBackup) {
|
||||||
this._dialogParams.reloadBackup();
|
this._dialogParams.reloadBackup();
|
||||||
@ -36,6 +36,7 @@ export class DialogHassioBackupUpload
|
|||||||
}
|
}
|
||||||
this._dialogParams = undefined;
|
this._dialogParams = undefined;
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
|
@ -77,8 +77,9 @@ class HassioBackupDialog
|
|||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._dialog?.close();
|
this._dialog?.close();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _localize(key: BackupOrRestoreKey) {
|
private _localize(key: BackupOrRestoreKey) {
|
||||||
|
@ -82,10 +82,11 @@ export class DialogHassioNetwork
|
|||||||
await this.updateComplete;
|
await this.updateComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
this._processing = false;
|
this._processing = false;
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
|
@ -92,7 +92,7 @@ class HassioMyRedirect extends LitElement {
|
|||||||
let url: string;
|
let url: string;
|
||||||
try {
|
try {
|
||||||
url = this._createRedirectUrl(redirect);
|
url = this._createRedirectUrl(redirect);
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
this._error = this.supervisor.localize("my.error");
|
this._error = this.supervisor.localize("my.error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ class HassioIngressView extends LitElement {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
addon = await fetchHassioAddonInfo(this.hass, addonSlug);
|
addon = await fetchHassioAddonInfo(this.hass, addonSlug);
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
await this.updateComplete;
|
await this.updateComplete;
|
||||||
await showAlertDialog(this, {
|
await showAlertDialog(this, {
|
||||||
text:
|
text:
|
||||||
@ -219,7 +219,7 @@ class HassioIngressView extends LitElement {
|
|||||||
});
|
});
|
||||||
this._fetchData(addonSlug);
|
this._fetchData(addonSlug);
|
||||||
return;
|
return;
|
||||||
} catch (e) {
|
} catch (_err) {
|
||||||
await showAlertDialog(this, {
|
await showAlertDialog(this, {
|
||||||
text:
|
text:
|
||||||
this.supervisor.localize("ingress.error_starting_addon") ||
|
this.supervisor.localize("ingress.error_starting_addon") ||
|
||||||
@ -264,7 +264,7 @@ class HassioIngressView extends LitElement {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
session = await createSessionPromise;
|
session = await createSessionPromise;
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
if (this._sessionKeepAlive) {
|
if (this._sessionKeepAlive) {
|
||||||
clearInterval(this._sessionKeepAlive);
|
clearInterval(this._sessionKeepAlive);
|
||||||
}
|
}
|
||||||
@ -285,7 +285,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: any) {
|
} catch (_err: any) {
|
||||||
session = await createHassioSession(this.hass);
|
session = await createHassioSession(this.hass);
|
||||||
}
|
}
|
||||||
}, 60000);
|
}, 60000);
|
||||||
|
@ -33,7 +33,7 @@ class HassioCoreInfo extends LitElement {
|
|||||||
|
|
||||||
@state() private _metrics?: HassioStats;
|
@state() private _metrics?: HassioStats;
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult | undefined {
|
||||||
const metrics = [
|
const metrics = [
|
||||||
{
|
{
|
||||||
description: this.supervisor.localize("system.core.cpu_usage"),
|
description: this.supervisor.localize("system.core.cpu_usage"),
|
||||||
|
@ -49,7 +49,7 @@ class HassioHostInfo extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public supervisor!: Supervisor;
|
@property({ attribute: false }) public supervisor!: Supervisor;
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult | undefined {
|
||||||
const primaryIpAddress = this.supervisor.host.features.includes("network")
|
const primaryIpAddress = this.supervisor.host.features.includes("network")
|
||||||
? this._primaryIpAddress(this.supervisor.network!)
|
? this._primaryIpAddress(this.supervisor.network!)
|
||||||
: "";
|
: "";
|
||||||
|
@ -44,7 +44,7 @@ class HassioSupervisorInfo extends LitElement {
|
|||||||
|
|
||||||
@state() private _metrics?: HassioStats;
|
@state() private _metrics?: HassioStats;
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult | undefined {
|
||||||
const metrics = [
|
const metrics = [
|
||||||
{
|
{
|
||||||
description: this.supervisor.localize("system.supervisor.cpu_usage"),
|
description: this.supervisor.localize("system.supervisor.cpu_usage"),
|
||||||
|
@ -65,7 +65,7 @@ class HassioSupervisorLog extends LitElement {
|
|||||||
await this._loadData();
|
await this._loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult | undefined {
|
||||||
return html`
|
return html`
|
||||||
<ha-card outlined>
|
<ha-card outlined>
|
||||||
${this._error
|
${this._error
|
||||||
|
@ -23,7 +23,7 @@ class HassioSystem extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public route!: Route;
|
@property({ attribute: false }) public route!: Route;
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult | undefined {
|
||||||
return html`
|
return html`
|
||||||
<hass-tabs-subpage
|
<hass-tabs-subpage
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
@ -230,7 +230,7 @@ class LandingPageLogs extends LitElement {
|
|||||||
this._startLogStream();
|
this._startLogStream();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (_err) {
|
||||||
// ignore and continue with observer logs
|
// ignore and continue with observer logs
|
||||||
}
|
}
|
||||||
this._loadObserverLogs();
|
this._loadObserverLogs();
|
||||||
|
@ -126,7 +126,7 @@ class HaLandingPage extends LandingPageBaseElement {
|
|||||||
"selectedLanguage",
|
"selectedLanguage",
|
||||||
JSON.stringify(language)
|
JSON.stringify(language)
|
||||||
);
|
);
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,8 +184,8 @@
|
|||||||
"@types/tar": "6.1.13",
|
"@types/tar": "6.1.13",
|
||||||
"@types/ua-parser-js": "0.7.39",
|
"@types/ua-parser-js": "0.7.39",
|
||||||
"@types/webspeechapi": "0.0.29",
|
"@types/webspeechapi": "0.0.29",
|
||||||
"@typescript-eslint/eslint-plugin": "7.18.0",
|
"@typescript-eslint/eslint-plugin": "8.19.1",
|
||||||
"@typescript-eslint/parser": "7.18.0",
|
"@typescript-eslint/parser": "8.19.1",
|
||||||
"@vitest/coverage-v8": "2.1.8",
|
"@vitest/coverage-v8": "2.1.8",
|
||||||
"babel-loader": "9.2.1",
|
"babel-loader": "9.2.1",
|
||||||
"babel-plugin-template-html-minifier": "4.1.0",
|
"babel-plugin-template-html-minifier": "4.1.0",
|
||||||
@ -193,7 +193,6 @@
|
|||||||
"del": "8.0.0",
|
"del": "8.0.0",
|
||||||
"eslint": "9.18.0",
|
"eslint": "9.18.0",
|
||||||
"eslint-config-airbnb-base": "15.0.0",
|
"eslint-config-airbnb-base": "15.0.0",
|
||||||
"eslint-config-airbnb-typescript": "18.0.0",
|
|
||||||
"eslint-config-prettier": "9.1.0",
|
"eslint-config-prettier": "9.1.0",
|
||||||
"eslint-import-resolver-webpack": "0.13.10",
|
"eslint-import-resolver-webpack": "0.13.10",
|
||||||
"eslint-plugin-import": "2.31.0",
|
"eslint-plugin-import": "2.31.0",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
// Needs to remain CommonJS until eslint-import-resolver-webpack supports ES modules
|
// Needs to remain CommonJS until eslint-import-resolver-webpack supports ES modules
|
||||||
const rspack = require("./build-scripts/rspack.cjs");
|
const rspack = require("./build-scripts/rspack.cjs");
|
||||||
const env = require("./build-scripts/env.cjs");
|
const env = require("./build-scripts/env.cjs");
|
||||||
|
@ -232,7 +232,7 @@ export class HaAuthorize extends litLocalizeLiteMixin(LitElement) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
url = new URL(this.redirectUri);
|
url = new URL(this.redirectUri);
|
||||||
} catch (err) {
|
} catch (_err) {
|
||||||
this._error = "Invalid redirect URI";
|
this._error = "Invalid redirect URI";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -328,7 +328,7 @@ export class HaAuthorize extends litLocalizeLiteMixin(LitElement) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
window.localStorage.setItem("selectedLanguage", JSON.stringify(language));
|
window.localStorage.setItem("selectedLanguage", JSON.stringify(language));
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,9 @@ type NonNullUndefined<T> = T extends undefined
|
|||||||
*/
|
*/
|
||||||
export function ensureArray(value: undefined): undefined;
|
export function ensureArray(value: undefined): undefined;
|
||||||
export function ensureArray(value: null): null;
|
export function ensureArray(value: null): null;
|
||||||
export function ensureArray<T>(value: T | T[]): NonNullUndefined<T>[];
|
export function ensureArray<T>(
|
||||||
export function ensureArray<T>(value: T | readonly T[]): NonNullUndefined<T>[];
|
value: T | T[] | readonly T[]
|
||||||
|
): NonNullUndefined<T>[];
|
||||||
export function ensureArray(value) {
|
export function ensureArray(value) {
|
||||||
if (value === undefined || value === null || Array.isArray(value)) {
|
if (value === undefined || value === null || Array.isArray(value)) {
|
||||||
return value;
|
return value;
|
||||||
|
@ -66,7 +66,7 @@ export function loadTokens() {
|
|||||||
} else {
|
} else {
|
||||||
tokenCache.tokens = null;
|
tokenCache.tokens = null;
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
tokenCache.tokens = null;
|
tokenCache.tokens = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ class StorageClass {
|
|||||||
} else {
|
} else {
|
||||||
this.storage.setItem(storageKey, JSON.stringify(value));
|
this.storage.setItem(storageKey, JSON.stringify(value));
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
// Safari in private mode doesn't allow localstorage
|
// Safari in private mode doesn't allow localstorage
|
||||||
} finally {
|
} finally {
|
||||||
if (this._listeners[storageKey]) {
|
if (this._listeners[storageKey]) {
|
||||||
|
@ -186,7 +186,7 @@ const processTheme = (
|
|||||||
const prefixedRgbKey = `--${rgbKey}`;
|
const prefixedRgbKey = `--${rgbKey}`;
|
||||||
styles[prefixedRgbKey] = rgbValue;
|
styles[prefixedRgbKey] = rgbValue;
|
||||||
keys[prefixedRgbKey] = "";
|
keys[prefixedRgbKey] = "";
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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: any) {
|
} catch (_err: any) {
|
||||||
// Ignore the error
|
// Ignore the error
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -19,7 +19,7 @@ const SECS_PER_HOUR = SECS_PER_MIN * 60;
|
|||||||
// Adapted from https://github.com/formatjs/formatjs/blob/186cef62f980ec66252ee232f438a42d0b51b9f9/packages/intl-utils/src/diff.ts
|
// Adapted from https://github.com/formatjs/formatjs/blob/186cef62f980ec66252ee232f438a42d0b51b9f9/packages/intl-utils/src/diff.ts
|
||||||
export function selectUnit(
|
export function selectUnit(
|
||||||
from: Date | number,
|
from: Date | number,
|
||||||
// eslint-disable-next-line @typescript-eslint/default-param-last
|
// eslint-disable-next-line default-param-last
|
||||||
to: Date | number = Date.now(),
|
to: Date | number = Date.now(),
|
||||||
locale: FrontendLocaleData,
|
locale: FrontendLocaleData,
|
||||||
thresholds: Partial<Thresholds> = {}
|
thresholds: Partial<Thresholds> = {}
|
||||||
|
@ -61,7 +61,7 @@ class HaCallServiceButton extends LitElement {
|
|||||||
this.progress = false;
|
this.progress = false;
|
||||||
progressElement.actionSuccess();
|
progressElement.actionSuccess();
|
||||||
eventData.success = true;
|
eventData.success = true;
|
||||||
} catch (e) {
|
} catch (_err) {
|
||||||
this.progress = false;
|
this.progress = false;
|
||||||
progressElement.actionError();
|
progressElement.actionError();
|
||||||
eventData.success = false;
|
eventData.success = false;
|
||||||
|
@ -301,7 +301,7 @@ export class StateHistoryChartLine extends LitElement {
|
|||||||
prevValues = datavalues;
|
prevValues = datavalues;
|
||||||
};
|
};
|
||||||
|
|
||||||
const addDataSet = (nameY: string, fill = false, color?: string) => {
|
const addDataSet = (nameY: string, color?: string, fill = false) => {
|
||||||
if (!color) {
|
if (!color) {
|
||||||
color = getGraphColorByIndex(colorIndex, computedStyles);
|
color = getGraphColorByIndex(colorIndex, computedStyles);
|
||||||
colorIndex++;
|
colorIndex++;
|
||||||
@ -359,8 +359,8 @@ export class StateHistoryChartLine extends LitElement {
|
|||||||
if (hasHeat) {
|
if (hasHeat) {
|
||||||
addDataSet(
|
addDataSet(
|
||||||
`${this.hass.localize("ui.card.climate.heating", { name: name })}`,
|
`${this.hass.localize("ui.card.climate.heating", { name: name })}`,
|
||||||
true,
|
computedStyles.getPropertyValue("--state-climate-heat-color"),
|
||||||
computedStyles.getPropertyValue("--state-climate-heat-color")
|
true
|
||||||
);
|
);
|
||||||
// The "heating" series uses steppedArea to shade the area below the current
|
// The "heating" series uses steppedArea to shade the area below the current
|
||||||
// temperature when the thermostat is calling for heat.
|
// temperature when the thermostat is calling for heat.
|
||||||
@ -368,8 +368,8 @@ export class StateHistoryChartLine extends LitElement {
|
|||||||
if (hasCool) {
|
if (hasCool) {
|
||||||
addDataSet(
|
addDataSet(
|
||||||
`${this.hass.localize("ui.card.climate.cooling", { name: name })}`,
|
`${this.hass.localize("ui.card.climate.cooling", { name: name })}`,
|
||||||
true,
|
computedStyles.getPropertyValue("--state-climate-cool-color"),
|
||||||
computedStyles.getPropertyValue("--state-climate-cool-color")
|
true
|
||||||
);
|
);
|
||||||
// The "cooling" series uses steppedArea to shade the area below the current
|
// The "cooling" series uses steppedArea to shade the area below the current
|
||||||
// temperature when the thermostat is calling for heat.
|
// temperature when the thermostat is calling for heat.
|
||||||
@ -468,22 +468,23 @@ export class StateHistoryChartLine extends LitElement {
|
|||||||
`${this.hass.localize("ui.card.humidifier.humidifying", {
|
`${this.hass.localize("ui.card.humidifier.humidifying", {
|
||||||
name: name,
|
name: name,
|
||||||
})}`,
|
})}`,
|
||||||
true,
|
computedStyles.getPropertyValue("--state-humidifier-on-color"),
|
||||||
computedStyles.getPropertyValue("--state-humidifier-on-color")
|
true
|
||||||
);
|
);
|
||||||
} else if (hasDrying) {
|
} else if (hasDrying) {
|
||||||
addDataSet(
|
addDataSet(
|
||||||
`${this.hass.localize("ui.card.humidifier.drying", {
|
`${this.hass.localize("ui.card.humidifier.drying", {
|
||||||
name: name,
|
name: name,
|
||||||
})}`,
|
})}`,
|
||||||
true,
|
computedStyles.getPropertyValue("--state-humidifier-on-color"),
|
||||||
computedStyles.getPropertyValue("--state-humidifier-on-color")
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
addDataSet(
|
addDataSet(
|
||||||
`${this.hass.localize("ui.card.humidifier.on_entity", {
|
`${this.hass.localize("ui.card.humidifier.on_entity", {
|
||||||
name: name,
|
name: name,
|
||||||
})}`,
|
})}`,
|
||||||
|
undefined,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ class HaAddonPicker extends LitElement {
|
|||||||
"ui.components.addon-picker.error.no_supervisor"
|
"ui.components.addon-picker.error.no_supervisor"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
this._error = this.hass.localize(
|
this._error = this.hass.localize(
|
||||||
"ui.components.addon-picker.error.fetch_addons"
|
"ui.components.addon-picker.error.fetch_addons"
|
||||||
);
|
);
|
||||||
|
@ -34,7 +34,7 @@ export class HaAnsiToHtml extends LitElement {
|
|||||||
|
|
||||||
@litState() private _filter = "";
|
@litState() private _filter = "";
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult {
|
||||||
return html`<pre class=${classMap({ wrap: !this.wrapDisabled })}></pre>`;
|
return html`<pre class=${classMap({ wrap: !this.wrapDisabled })}></pre>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ export class HaCameraStream extends LitElement {
|
|||||||
this.clientWidth,
|
this.clientWidth,
|
||||||
this.clientHeight
|
this.clientHeight
|
||||||
);
|
);
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
// poster url is optional
|
// poster url is optional
|
||||||
this._posterUrl = undefined;
|
this._posterUrl = undefined;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ export class HaConversationAgentPicker extends LitElement {
|
|||||||
this._configEntry = (
|
this._configEntry = (
|
||||||
await getConfigEntry(this.hass, regEntry.config_entry_id)
|
await getConfigEntry(this.hass, regEntry.config_entry_id)
|
||||||
).config_entry;
|
).config_entry;
|
||||||
} catch (err) {
|
} catch (_err) {
|
||||||
this._configEntry = undefined;
|
this._configEntry = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import { bytesToString } from "../util/bytes-to-string";
|
|||||||
declare global {
|
declare global {
|
||||||
interface HASSDomEvents {
|
interface HASSDomEvents {
|
||||||
"file-picked": { files: File[] };
|
"file-picked": { files: File[] };
|
||||||
"files-cleared": void;
|
"files-cleared": undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ class HaHLSPlayer extends LitElement {
|
|||||||
let base_url: string;
|
let base_url: string;
|
||||||
try {
|
try {
|
||||||
base_url = new URL(this._url).href;
|
base_url = new URL(this._url).href;
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
base_url = new URL(this._url, window.location.href).href;
|
base_url = new URL(this._url, window.location.href).href;
|
||||||
}
|
}
|
||||||
playlist_url = new URL(match[3], base_url).href;
|
playlist_url = new URL(match[3], base_url).href;
|
||||||
|
@ -57,12 +57,12 @@ function adjustRgb(
|
|||||||
|
|
||||||
function drawColorWheel(
|
function drawColorWheel(
|
||||||
ctx: CanvasRenderingContext2D,
|
ctx: CanvasRenderingContext2D,
|
||||||
colorBrightness = 255,
|
|
||||||
wv?: number,
|
wv?: number,
|
||||||
cw?: number,
|
cw?: number,
|
||||||
ww?: number,
|
ww?: number,
|
||||||
minKelvin?: number,
|
minKelvin?: number,
|
||||||
maxKelvin?: number
|
maxKelvin?: number,
|
||||||
|
colorBrightness = 255
|
||||||
) {
|
) {
|
||||||
const radius = ctx.canvas.width / 2;
|
const radius = ctx.canvas.width / 2;
|
||||||
|
|
||||||
@ -160,12 +160,12 @@ class HaHsColorPicker extends LitElement {
|
|||||||
const ctx = this._canvas.getContext("2d")!;
|
const ctx = this._canvas.getContext("2d")!;
|
||||||
drawColorWheel(
|
drawColorWheel(
|
||||||
ctx,
|
ctx,
|
||||||
this.colorBrightness,
|
|
||||||
this.wv,
|
this.wv,
|
||||||
this.cw,
|
this.cw,
|
||||||
this.ww,
|
this.ww,
|
||||||
this.minKelvin,
|
this.minKelvin,
|
||||||
this.maxKelvin
|
this.maxKelvin,
|
||||||
|
this.colorBrightness
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ const loadCustomIconItems = async (iconsetPrefix: string) => {
|
|||||||
keywords: icon.keywords ?? [],
|
keywords: icon.keywords ?? [],
|
||||||
}));
|
}));
|
||||||
return customIconItems;
|
return customIconItems;
|
||||||
} catch (e) {
|
} catch (_err) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.warn(`Unable to load icon list for ${iconsetPrefix} iconset`);
|
console.warn(`Unable to load icon list for ${iconsetPrefix} iconset`);
|
||||||
return [];
|
return [];
|
||||||
|
@ -97,7 +97,7 @@ export class HaLanguagePicker extends LitElement {
|
|||||||
type: "language",
|
type: "language",
|
||||||
fallback: "code",
|
fallback: "code",
|
||||||
}).of(lang)!;
|
}).of(lang)!;
|
||||||
} catch (err) {
|
} catch (_err) {
|
||||||
label = lang;
|
label = lang;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ class HaMountPicker extends LitElement {
|
|||||||
"ui.components.mount-picker.error.no_supervisor"
|
"ui.components.mount-picker.error.no_supervisor"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
this._error = this.hass.localize(
|
this._error = this.hass.localize(
|
||||||
"ui.components.mount-picker.error.fetch_mounts"
|
"ui.components.mount-picker.error.fetch_mounts"
|
||||||
);
|
);
|
||||||
|
@ -50,7 +50,7 @@ class HaPushNotificationsToggle extends LitElement {
|
|||||||
this._loading = false;
|
this._loading = false;
|
||||||
this._pushChecked = !!subscription;
|
this._pushChecked = !!subscription;
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (_err) {
|
||||||
// We don't set loading to `false` so we remain disabled
|
// We don't set loading to `false` so we remain disabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ class HaPushNotificationsToggle extends LitElement {
|
|||||||
let applicationServerKey: Uint8Array | null;
|
let applicationServerKey: Uint8Array | null;
|
||||||
try {
|
try {
|
||||||
applicationServerKey = await getAppKey(this.hass);
|
applicationServerKey = await getAppKey(this.hass);
|
||||||
} catch (ex) {
|
} catch (_err) {
|
||||||
applicationServerKey = null;
|
applicationServerKey = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ export class HaFileSelector extends LitElement {
|
|||||||
this._busy = true;
|
this._busy = true;
|
||||||
try {
|
try {
|
||||||
await removeFile(this.hass, this.value!);
|
await removeFile(this.hass, this.value!);
|
||||||
} catch (err) {
|
} catch (_err) {
|
||||||
// Not ideal if removal fails, but will be cleaned up later
|
// Not ideal if removal fails, but will be cleaned up later
|
||||||
} finally {
|
} finally {
|
||||||
this._busy = false;
|
this._busy = false;
|
||||||
|
@ -859,7 +859,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: any) {
|
} catch (_err: any) {
|
||||||
// Ignore if loading manifest fails. Probably bad JSON in manifest
|
// Ignore if loading manifest fails. Probably bad JSON in manifest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,8 @@ export class HaLocationsEditor extends LitElement {
|
|||||||
|
|
||||||
private Leaflet?: LeafletModuleType;
|
private Leaflet?: LeafletModuleType;
|
||||||
|
|
||||||
private _loadPromise: Promise<boolean | void>;
|
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
||||||
|
private _loadPromise: Promise<boolean | undefined | void>;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
@ -202,7 +202,7 @@ export class HatScriptGraph extends LitElement {
|
|||||||
.notEnabled=${disabled || config.enabled === false}
|
.notEnabled=${disabled || config.enabled === false}
|
||||||
></hat-graph-node>
|
></hat-graph-node>
|
||||||
${branch.sequence !== null
|
${branch.sequence !== null
|
||||||
? ensureArray(branch.sequence).map((action, j) =>
|
? ensureArray<Action>(branch.sequence).map((action, j) =>
|
||||||
this._renderActionNode(
|
this._renderActionNode(
|
||||||
action,
|
action,
|
||||||
`${branchPath}/sequence/${j}`,
|
`${branchPath}/sequence/${j}`,
|
||||||
@ -218,13 +218,14 @@ export class HatScriptGraph extends LitElement {
|
|||||||
<div ?track=${trackDefault}>
|
<div ?track=${trackDefault}>
|
||||||
<hat-graph-spacer ?track=${trackDefault}></hat-graph-spacer>
|
<hat-graph-spacer ?track=${trackDefault}></hat-graph-spacer>
|
||||||
${config.default !== null
|
${config.default !== null
|
||||||
? ensureArray(config.default)?.map((action, i) =>
|
? ensureArray<Action | undefined>(config.default)?.map(
|
||||||
this._renderActionNode(
|
(action, i) =>
|
||||||
action,
|
this._renderActionNode(
|
||||||
`${path}/default/${i}`,
|
action,
|
||||||
false,
|
`${path}/default/${i}`,
|
||||||
disabled || config.enabled === false
|
false,
|
||||||
)
|
disabled || config.enabled === false
|
||||||
|
)
|
||||||
)
|
)
|
||||||
: ""}
|
: ""}
|
||||||
</div>
|
</div>
|
||||||
@ -278,7 +279,7 @@ export class HatScriptGraph extends LitElement {
|
|||||||
.notEnabled=${disabled || config.enabled === false}
|
.notEnabled=${disabled || config.enabled === false}
|
||||||
nofocus
|
nofocus
|
||||||
></hat-graph-node
|
></hat-graph-node
|
||||||
>${ensureArray(config.else).map((action, j) =>
|
>${ensureArray<Action>(config.else).map((action, j) =>
|
||||||
this._renderActionNode(
|
this._renderActionNode(
|
||||||
action,
|
action,
|
||||||
`${path}/else/${j}`,
|
`${path}/else/${j}`,
|
||||||
@ -296,7 +297,7 @@ export class HatScriptGraph extends LitElement {
|
|||||||
.notEnabled=${disabled || config.enabled === false}
|
.notEnabled=${disabled || config.enabled === false}
|
||||||
nofocus
|
nofocus
|
||||||
></hat-graph-node>
|
></hat-graph-node>
|
||||||
${ensureArray(config.then ?? []).map((action, j) =>
|
${ensureArray<Action>(config.then ?? []).map((action, j) =>
|
||||||
this._renderActionNode(
|
this._renderActionNode(
|
||||||
action,
|
action,
|
||||||
`${path}/then/${j}`,
|
`${path}/then/${j}`,
|
||||||
@ -403,7 +404,7 @@ export class HatScriptGraph extends LitElement {
|
|||||||
.badge=${repeats > 1 ? repeats : undefined}
|
.badge=${repeats > 1 ? repeats : undefined}
|
||||||
></hat-graph-node>
|
></hat-graph-node>
|
||||||
<div ?track=${trace}>
|
<div ?track=${trace}>
|
||||||
${ensureArray(node.repeat.sequence).map((action, i) =>
|
${ensureArray<Action>(node.repeat.sequence).map((action, i) =>
|
||||||
this._renderActionNode(
|
this._renderActionNode(
|
||||||
action,
|
action,
|
||||||
`${path}/repeat/sequence/${i}`,
|
`${path}/repeat/sequence/${i}`,
|
||||||
@ -526,17 +527,18 @@ export class HatScriptGraph extends LitElement {
|
|||||||
slot="head"
|
slot="head"
|
||||||
nofocus
|
nofocus
|
||||||
></hat-graph-node>
|
></hat-graph-node>
|
||||||
${ensureArray(node.parallel).map((action, i) =>
|
${ensureArray<Action>(node.parallel).map((action, i) =>
|
||||||
"sequence" in action
|
"sequence" in action
|
||||||
? html`<div ?track=${path in this.trace.trace}>
|
? html`<div ?track=${path in this.trace.trace}>
|
||||||
${ensureArray((action as ManualScriptConfig).sequence).map(
|
${ensureArray<Action>(
|
||||||
(sAction, j) =>
|
(action as ManualScriptConfig).sequence
|
||||||
this._renderActionNode(
|
).map((sAction, j) =>
|
||||||
sAction,
|
this._renderActionNode(
|
||||||
`${path}/parallel/${i}/sequence/${j}`,
|
sAction,
|
||||||
false,
|
`${path}/parallel/${i}/sequence/${j}`,
|
||||||
disabled || node.enabled === false
|
false,
|
||||||
)
|
disabled || node.enabled === false
|
||||||
|
)
|
||||||
)}
|
)}
|
||||||
</div>`
|
</div>`
|
||||||
: this._renderActionNode(
|
: this._renderActionNode(
|
||||||
@ -601,8 +603,9 @@ export class HatScriptGraph extends LitElement {
|
|||||||
)}`
|
)}`
|
||||||
: ""}
|
: ""}
|
||||||
${"sequence" in this.trace.config
|
${"sequence" in this.trace.config
|
||||||
? html`${ensureArray(this.trace.config.sequence).map((action, i) =>
|
? html`${ensureArray<Action>(this.trace.config.sequence).map(
|
||||||
this._renderActionNode(action, `sequence/${i}`, i === 0)
|
(action, i) =>
|
||||||
|
this._renderActionNode(action, `sequence/${i}`, i === 0)
|
||||||
)}`
|
)}`
|
||||||
: ""}
|
: ""}
|
||||||
</div>
|
</div>
|
||||||
|
@ -266,7 +266,7 @@ class ActionRenderer {
|
|||||||
let data;
|
let data;
|
||||||
try {
|
try {
|
||||||
data = getDataFromPath(this.trace.config, path);
|
data = getDataFromPath(this.trace.config, path);
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
this._renderEntry(
|
this._renderEntry(
|
||||||
path,
|
path,
|
||||||
this.hass.localize(
|
this.hass.localize(
|
||||||
|
@ -58,7 +58,7 @@ export const deleteApplicationCredential = async (
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
applicationCredentialsId: string
|
applicationCredentialsId: string
|
||||||
) =>
|
) =>
|
||||||
hass.callWS<void>({
|
hass.callWS<undefined>({
|
||||||
type: "application_credentials/delete",
|
type: "application_credentials/delete",
|
||||||
application_credentials_id: applicationCredentialsId,
|
application_credentials_id: applicationCredentialsId,
|
||||||
});
|
});
|
||||||
|
@ -366,7 +366,7 @@ export const setAssistPipelinePreferred = (
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const deleteAssistPipeline = (hass: HomeAssistant, pipelineId: string) =>
|
export const deleteAssistPipeline = (hass: HomeAssistant, pipelineId: string) =>
|
||||||
hass.callWS<void>({
|
hass.callWS<undefined>({
|
||||||
type: "assist_pipeline/pipeline/delete",
|
type: "assist_pipeline/pipeline/delete",
|
||||||
pipeline_id: pipelineId,
|
pipeline_id: pipelineId,
|
||||||
});
|
});
|
||||||
|
@ -132,7 +132,7 @@ export const adminChangePassword = (
|
|||||||
userId: string,
|
userId: string,
|
||||||
password: string
|
password: string
|
||||||
) =>
|
) =>
|
||||||
hass.callWS<void>({
|
hass.callWS<undefined>({
|
||||||
type: "config/auth_provider/homeassistant/admin_change_password",
|
type: "config/auth_provider/homeassistant/admin_change_password",
|
||||||
user_id: userId,
|
user_id: userId,
|
||||||
password,
|
password,
|
||||||
@ -143,7 +143,7 @@ export const adminChangeUsername = (
|
|||||||
userId: string,
|
userId: string,
|
||||||
username: string
|
username: string
|
||||||
) =>
|
) =>
|
||||||
hass.callWS<void>({
|
hass.callWS<undefined>({
|
||||||
type: "config/auth_provider/homeassistant/admin_change_username",
|
type: "config/auth_provider/homeassistant/admin_change_username",
|
||||||
user_id: userId,
|
user_id: userId,
|
||||||
username,
|
username,
|
||||||
|
@ -366,7 +366,7 @@ export const saveAutomationConfig = (
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
id: string,
|
id: string,
|
||||||
config: AutomationConfig
|
config: AutomationConfig
|
||||||
) => hass.callApi<void>("POST", `config/automation/config/${id}`, config);
|
) => hass.callApi<undefined>("POST", `config/automation/config/${id}`, config);
|
||||||
|
|
||||||
export const normalizeAutomationConfig = <
|
export const normalizeAutomationConfig = <
|
||||||
T extends Partial<AutomationConfig> | AutomationConfig,
|
T extends Partial<AutomationConfig> | AutomationConfig,
|
||||||
|
@ -81,7 +81,7 @@ export const fetchCalendarEvents = async (
|
|||||||
try {
|
try {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
result = await promise;
|
result = await promise;
|
||||||
} catch (err) {
|
} catch (_err) {
|
||||||
errors.push(calendars[idx].entity_id);
|
errors.push(calendars[idx].entity_id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ export const createCalendarEvent = (
|
|||||||
entityId: string,
|
entityId: string,
|
||||||
event: CalendarEventMutableParams
|
event: CalendarEventMutableParams
|
||||||
) =>
|
) =>
|
||||||
hass.callWS<void>({
|
hass.callWS<undefined>({
|
||||||
type: "calendar/event/create",
|
type: "calendar/event/create",
|
||||||
entity_id: entityId,
|
entity_id: entityId,
|
||||||
event: event,
|
event: event,
|
||||||
@ -168,7 +168,7 @@ export const updateCalendarEvent = (
|
|||||||
recurrence_id?: string,
|
recurrence_id?: string,
|
||||||
recurrence_range?: RecurrenceRange
|
recurrence_range?: RecurrenceRange
|
||||||
) =>
|
) =>
|
||||||
hass.callWS<void>({
|
hass.callWS<undefined>({
|
||||||
type: "calendar/event/update",
|
type: "calendar/event/update",
|
||||||
entity_id: entityId,
|
entity_id: entityId,
|
||||||
uid,
|
uid,
|
||||||
@ -184,7 +184,7 @@ export const deleteCalendarEvent = (
|
|||||||
recurrence_id?: string,
|
recurrence_id?: string,
|
||||||
recurrence_range?: RecurrenceRange
|
recurrence_range?: RecurrenceRange
|
||||||
) =>
|
) =>
|
||||||
hass.callWS<void>({
|
hass.callWS<undefined>({
|
||||||
type: "calendar/event/delete",
|
type: "calendar/event/delete",
|
||||||
entity_id: entityId,
|
entity_id: entityId,
|
||||||
uid,
|
uid,
|
||||||
|
@ -756,8 +756,8 @@ export type EnergyGasUnitClass = (typeof energyGasUnitClass)[number];
|
|||||||
|
|
||||||
export const getEnergyGasUnitClass = (
|
export const getEnergyGasUnitClass = (
|
||||||
prefs: EnergyPreferences,
|
prefs: EnergyPreferences,
|
||||||
statisticsMetaData: Record<string, StatisticsMetaData> = {},
|
excludeSource?: string,
|
||||||
excludeSource?: string
|
statisticsMetaData: Record<string, StatisticsMetaData> = {}
|
||||||
): EnergyGasUnitClass | undefined => {
|
): EnergyGasUnitClass | undefined => {
|
||||||
for (const source of prefs.energy_sources) {
|
for (const source of prefs.energy_sources) {
|
||||||
if (source.type !== "gas") {
|
if (source.type !== "gas") {
|
||||||
@ -783,7 +783,7 @@ export const getEnergyGasUnit = (
|
|||||||
prefs: EnergyPreferences,
|
prefs: EnergyPreferences,
|
||||||
statisticsMetaData: Record<string, StatisticsMetaData> = {}
|
statisticsMetaData: Record<string, StatisticsMetaData> = {}
|
||||||
): string | undefined => {
|
): string | undefined => {
|
||||||
const unitClass = getEnergyGasUnitClass(prefs, statisticsMetaData);
|
const unitClass = getEnergyGasUnitClass(prefs, undefined, statisticsMetaData);
|
||||||
if (unitClass === undefined) {
|
if (unitClass === undefined) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ export const saveFrontendUserData = async <
|
|||||||
key: UserDataKey,
|
key: UserDataKey,
|
||||||
value: FrontendUserData[UserDataKey]
|
value: FrontendUserData[UserDataKey]
|
||||||
): Promise<void> =>
|
): Promise<void> =>
|
||||||
conn.sendMessagePromise<void>({
|
conn.sendMessagePromise<undefined>({
|
||||||
type: "frontend/set_user_data",
|
type: "frontend/set_user_data",
|
||||||
key,
|
key,
|
||||||
value,
|
value,
|
||||||
|
@ -390,7 +390,7 @@ export const rebuildLocalAddon = async (
|
|||||||
slug: string
|
slug: string
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
if (atLeastVersion(hass.config.version, 2021, 2, 4)) {
|
if (atLeastVersion(hass.config.version, 2021, 2, 4)) {
|
||||||
return hass.callWS<void>({
|
return hass.callWS<undefined>({
|
||||||
type: "supervisor/api",
|
type: "supervisor/api",
|
||||||
endpoint: `/addons/${slug}/rebuild`,
|
endpoint: `/addons/${slug}/rebuild`,
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -237,9 +237,9 @@ export const subscribeHistoryStatesTimeWindow = (
|
|||||||
callbackFunction: (data: HistoryStates) => void,
|
callbackFunction: (data: HistoryStates) => void,
|
||||||
hoursToShow: number,
|
hoursToShow: number,
|
||||||
entityIds: string[],
|
entityIds: string[],
|
||||||
|
noAttributes?: boolean,
|
||||||
minimalResponse = true,
|
minimalResponse = true,
|
||||||
significantChangesOnly = true,
|
significantChangesOnly = true
|
||||||
noAttributes?: boolean
|
|
||||||
): Promise<() => Promise<void>> => {
|
): Promise<() => Promise<void>> => {
|
||||||
const params = {
|
const params = {
|
||||||
type: "history/stream",
|
type: "history/stream",
|
||||||
|
@ -109,7 +109,7 @@ export interface StatisticsUnitConfiguration {
|
|||||||
volume?: "L" | "gal" | "ft³" | "m³";
|
volume?: "L" | "gal" | "ft³" | "m³";
|
||||||
}
|
}
|
||||||
|
|
||||||
const statisticTypes = [
|
const _statisticTypes = [
|
||||||
"change",
|
"change",
|
||||||
"last_reset",
|
"last_reset",
|
||||||
"max",
|
"max",
|
||||||
@ -118,7 +118,7 @@ const statisticTypes = [
|
|||||||
"state",
|
"state",
|
||||||
"sum",
|
"sum",
|
||||||
] as const;
|
] as const;
|
||||||
export type StatisticsTypes = (typeof statisticTypes)[number][];
|
export type StatisticsTypes = (typeof _statisticTypes)[number][];
|
||||||
|
|
||||||
export interface StatisticsValidationResults {
|
export interface StatisticsValidationResults {
|
||||||
[statisticId: string]: StatisticsValidationResult[];
|
[statisticId: string]: StatisticsValidationResult[];
|
||||||
@ -152,6 +152,7 @@ export const fetchStatistics = (
|
|||||||
startTime: Date,
|
startTime: Date,
|
||||||
endTime?: Date,
|
endTime?: Date,
|
||||||
statistic_ids?: string[],
|
statistic_ids?: string[],
|
||||||
|
// eslint-disable-next-line default-param-last
|
||||||
period: "5minute" | "hour" | "day" | "week" | "month" = "hour",
|
period: "5minute" | "hour" | "day" | "week" | "month" = "hour",
|
||||||
units?: StatisticsUnitConfiguration,
|
units?: StatisticsUnitConfiguration,
|
||||||
types?: StatisticsTypes
|
types?: StatisticsTypes
|
||||||
@ -206,14 +207,14 @@ export const updateStatisticsMetadata = (
|
|||||||
statistic_id: string,
|
statistic_id: string,
|
||||||
unit_of_measurement: string | null
|
unit_of_measurement: string | null
|
||||||
) =>
|
) =>
|
||||||
hass.callWS<void>({
|
hass.callWS<undefined>({
|
||||||
type: "recorder/update_statistics_metadata",
|
type: "recorder/update_statistics_metadata",
|
||||||
statistic_id,
|
statistic_id,
|
||||||
unit_of_measurement,
|
unit_of_measurement,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const clearStatistics = (hass: HomeAssistant, statistic_ids: string[]) =>
|
export const clearStatistics = (hass: HomeAssistant, statistic_ids: string[]) =>
|
||||||
hass.callWS<void>({
|
hass.callWS<undefined>({
|
||||||
type: "recorder/clear_statistics",
|
type: "recorder/clear_statistics",
|
||||||
statistic_ids,
|
statistic_ids,
|
||||||
});
|
});
|
||||||
@ -295,7 +296,7 @@ export const adjustStatisticsSum = (
|
|||||||
adjustment_unit_of_measurement: string | null
|
adjustment_unit_of_measurement: string | null
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
const start_time_iso = new Date(start_time).toISOString();
|
const start_time_iso = new Date(start_time).toISOString();
|
||||||
return hass.callWS({
|
return hass.callWS<undefined>({
|
||||||
type: "recorder/adjust_sum_statistics",
|
type: "recorder/adjust_sum_statistics",
|
||||||
statistic_id,
|
statistic_id,
|
||||||
start_time: start_time_iso,
|
start_time: start_time_iso,
|
||||||
@ -334,4 +335,4 @@ export const isExternalStatistic = (statisticsId: string): boolean =>
|
|||||||
statisticsId.includes(":");
|
statisticsId.includes(":");
|
||||||
|
|
||||||
export const updateStatisticsIssues = (hass: HomeAssistant) =>
|
export const updateStatisticsIssues = (hass: HomeAssistant) =>
|
||||||
hass.callWS({ type: "recorder/update_statistics_issues" });
|
hass.callWS<undefined>({ type: "recorder/update_statistics_issues" });
|
||||||
|
@ -74,7 +74,6 @@ export type Selector =
|
|||||||
| BackupLocationSelector;
|
| BackupLocationSelector;
|
||||||
|
|
||||||
export interface ActionSelector {
|
export interface ActionSelector {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
action: {} | null;
|
action: {} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +93,6 @@ export interface AreaSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AreaFilterSelector {
|
export interface AreaFilterSelector {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
area_filter: {} | null;
|
area_filter: {} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +104,6 @@ export interface AttributeSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface BooleanSelector {
|
export interface BooleanSelector {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
boolean: {} | null;
|
boolean: {} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +116,6 @@ export interface ButtonToggleSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ColorRGBSelector {
|
export interface ColorRGBSelector {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
color_rgb: {} | null;
|
color_rgb: {} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +130,6 @@ export interface ColorTempSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ConditionSelector {
|
export interface ConditionSelector {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
condition: {} | null;
|
condition: {} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,12 +159,10 @@ export interface CountrySelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface DateSelector {
|
export interface DateSelector {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
date: {} | null;
|
date: {} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DateTimeSelector {
|
export interface DateTimeSelector {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
datetime: {} | null;
|
datetime: {} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +302,6 @@ export interface LocationSelectorValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface MediaSelector {
|
export interface MediaSelector {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
media: {} | null;
|
media: {} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +319,6 @@ export interface MediaSelectorValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface NavigationSelector {
|
export interface NavigationSelector {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
navigation: {} | null;
|
navigation: {} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,7 +334,6 @@ export interface NumberSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ObjectSelector {
|
export interface ObjectSelector {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
object: {} | null;
|
object: {} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +362,6 @@ export interface SelectSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface SelectorSelector {
|
export interface SelectorSelector {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
selector: {} | null;
|
selector: {} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,7 +374,6 @@ export interface StateSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface BackupLocationSelector {
|
export interface BackupLocationSelector {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
backup_location: {} | null;
|
backup_location: {} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,7 +422,6 @@ export interface TargetSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface TemplateSelector {
|
export interface TemplateSelector {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
template: {} | null;
|
template: {} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,7 +433,6 @@ export interface TimeSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface TriggerSelector {
|
export interface TriggerSelector {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
trigger: {} | null;
|
trigger: {} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ export const updateTag = async (
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const deleteTag = async (hass: HomeAssistant, tagId: string) =>
|
export const deleteTag = async (hass: HomeAssistant, tagId: string) =>
|
||||||
hass.callWS<void>({
|
hass.callWS<undefined>({
|
||||||
type: "tag/delete",
|
type: "tag/delete",
|
||||||
tag_id: tagId,
|
tag_id: tagId,
|
||||||
});
|
});
|
||||||
|
@ -63,7 +63,7 @@ export const updateUser = async (
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const deleteUser = async (hass: HomeAssistant, userId: string) =>
|
export const deleteUser = async (hass: HomeAssistant, userId: string) =>
|
||||||
hass.callWS<void>({
|
hass.callWS<undefined>({
|
||||||
type: "config/auth/delete",
|
type: "config/auth/delete",
|
||||||
user_id: userId,
|
user_id: userId,
|
||||||
});
|
});
|
||||||
|
@ -501,11 +501,11 @@ export const subscribeAddZwaveNode = (
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
entry_id: string,
|
entry_id: string,
|
||||||
callbackFunction: (message: any) => void,
|
callbackFunction: (message: any) => void,
|
||||||
inclusion_strategy: InclusionStrategy = InclusionStrategy.Default,
|
|
||||||
qr_provisioning_information?: QRProvisioningInformation,
|
qr_provisioning_information?: QRProvisioningInformation,
|
||||||
qr_code_string?: string,
|
qr_code_string?: string,
|
||||||
planned_provisioning_entry?: PlannedProvisioningEntry,
|
planned_provisioning_entry?: PlannedProvisioningEntry,
|
||||||
dsk?: string
|
dsk?: string,
|
||||||
|
inclusion_strategy: InclusionStrategy = InclusionStrategy.Default
|
||||||
): Promise<UnsubscribeFunc> =>
|
): Promise<UnsubscribeFunc> =>
|
||||||
hass.connection.subscribeMessage((message) => callbackFunction(message), {
|
hass.connection.subscribeMessage((message) => callbackFunction(message), {
|
||||||
type: "zwave_js/add_node",
|
type: "zwave_js/add_node",
|
||||||
|
@ -39,11 +39,12 @@ export class DialogAreaFilter
|
|||||||
this._areas = allAreas.concat().sort(areaCompare(this.hass!.areas, order));
|
this._areas = allAreas.concat().sort(areaCompare(this.hass!.areas, order));
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._dialogParams = undefined;
|
this._dialogParams = undefined;
|
||||||
this._hidden = [];
|
this._hidden = [];
|
||||||
this._areas = [];
|
this._areas = [];
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _submit(): void {
|
private _submit(): void {
|
||||||
|
@ -46,10 +46,11 @@ export class DialogEnterCode
|
|||||||
await this.updateComplete;
|
await this.updateComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._dialogParams = undefined;
|
this._dialogParams = undefined;
|
||||||
this._showClearButton = false;
|
this._showClearButton = false;
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _submit(): void {
|
private _submit(): void {
|
||||||
|
@ -22,7 +22,7 @@ declare global {
|
|||||||
export interface HassDialog<T = HASSDomEvents[ValidHassDomEvent]>
|
export interface HassDialog<T = HASSDomEvents[ValidHassDomEvent]>
|
||||||
extends HTMLElement {
|
extends HTMLElement {
|
||||||
showDialog(params: T);
|
showDialog(params: T);
|
||||||
closeDialog?: () => boolean | void;
|
closeDialog?: () => boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ShowDialogParams<T> {
|
interface ShowDialogParams<T> {
|
||||||
|
@ -78,7 +78,7 @@ class MoreInfoCamera extends LitElement {
|
|||||||
const blob = await result.blob();
|
const blob = await result.blob();
|
||||||
const url = window.URL.createObjectURL(blob);
|
const url = window.URL.createObjectURL(blob);
|
||||||
fileDownload(url, filename);
|
fileDownload(url, filename);
|
||||||
} catch (err) {
|
} catch (_err) {
|
||||||
this._waiting = false;
|
this._waiting = false;
|
||||||
button.actionError();
|
button.actionError();
|
||||||
showToast(this, {
|
showToast(this, {
|
||||||
|
@ -126,7 +126,7 @@ export class MoreInfoDialog extends LitElement {
|
|||||||
this.hass,
|
this.hass,
|
||||||
this._entityId
|
this._entityId
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (_e) {
|
||||||
this._entry = null;
|
this._entry = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ export class MoreInfoHistory extends LitElement {
|
|||||||
|
|
||||||
private _interval?: number;
|
private _interval?: number;
|
||||||
|
|
||||||
private _subscribed?: Promise<(() => Promise<void>) | void>;
|
private _subscribed?: Promise<(() => Promise<void>) | undefined>;
|
||||||
|
|
||||||
private _error?: string;
|
private _error?: string;
|
||||||
|
|
||||||
@ -239,6 +239,7 @@ export class MoreInfoHistory extends LitElement {
|
|||||||
).catch((err) => {
|
).catch((err) => {
|
||||||
this._subscribed = undefined;
|
this._subscribed = undefined;
|
||||||
this._error = err;
|
this._error = err;
|
||||||
|
return undefined;
|
||||||
});
|
});
|
||||||
this._setRedrawTimer();
|
this._setRedrawTimer();
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement {
|
|||||||
let i = 1;
|
let i = 1;
|
||||||
while (
|
while (
|
||||||
pipelines.pipelines.find(
|
pipelines.pipelines.find(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
// eslint-disable-next-line no-loop-func
|
||||||
(pipeline) => pipeline.name === pipelineName
|
(pipeline) => pipeline.name === pipelineName
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
@ -262,7 +262,7 @@ export class HaVoiceAssistantSetupStepPipeline extends LitElement {
|
|||||||
let i = 1;
|
let i = 1;
|
||||||
while (
|
while (
|
||||||
pipelines.pipelines.find(
|
pipelines.pipelines.find(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
// eslint-disable-next-line no-loop-func
|
||||||
(pipeline) => pipeline.name === pipelineName
|
(pipeline) => pipeline.name === pipelineName
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
@ -234,7 +234,7 @@ export class HaVoiceAssistantSetupStepSuccess extends LitElement {
|
|||||||
const result = await getTranslation(null, pipeline.language, false);
|
const result = await getTranslation(null, pipeline.language, false);
|
||||||
this._announce(result.data["ui.dialogs.tts-try.message_example"]);
|
this._announce(result.data["ui.dialogs.tts-try.message_example"]);
|
||||||
return;
|
return;
|
||||||
} catch (e) {
|
} catch (_e) {
|
||||||
// ignore fallback to user language
|
// ignore fallback to user language
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ export class ExternalAuth extends Auth {
|
|||||||
try {
|
try {
|
||||||
await this._tokenCallbackPromise;
|
await this._tokenCallbackPromise;
|
||||||
return;
|
return;
|
||||||
} catch (err: any) {
|
} 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;
|
||||||
|
@ -151,23 +151,15 @@ export const provideHass = (
|
|||||||
restResponses.push([path, callback]);
|
restResponses.push([path, callback]);
|
||||||
}
|
}
|
||||||
|
|
||||||
mockAPI(
|
mockAPI(/states\/.+/, (_method, path, parameters) => {
|
||||||
/states\/.+/,
|
const [domain, objectId] = path.substr(7).split(".", 2);
|
||||||
(
|
if (!domain || !objectId) {
|
||||||
// @ts-ignore
|
return;
|
||||||
method,
|
|
||||||
path,
|
|
||||||
parameters
|
|
||||||
) => {
|
|
||||||
const [domain, objectId] = path.substr(7).split(".", 2);
|
|
||||||
if (!domain || !objectId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
addEntities(
|
|
||||||
getEntity(domain, objectId, parameters.state, parameters.attributes)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
);
|
addEntities(
|
||||||
|
getEntity(domain, objectId, parameters.state, parameters.attributes)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
const localLanguage = getLocalLanguage();
|
const localLanguage = getLocalLanguage();
|
||||||
const noop = () => undefined;
|
const noop = () => undefined;
|
||||||
|
@ -246,7 +246,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: any) {
|
} catch (_err: any) {
|
||||||
this._renderInitInfo(true);
|
this._renderInitInfo(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._steps = steps;
|
this._steps = steps;
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
alert("Something went wrong loading onboarding, try refreshing");
|
alert("Something went wrong loading onboarding, try refreshing");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -370,7 +370,7 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
|
|||||||
saveTokens,
|
saveTokens,
|
||||||
});
|
});
|
||||||
await this._connectHass(auth);
|
await this._connectHass(auth);
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
alert("Ah snap, something went wrong!");
|
alert("Ah snap, something went wrong!");
|
||||||
location.reload();
|
location.reload();
|
||||||
} finally {
|
} finally {
|
||||||
@ -486,7 +486,7 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
|
|||||||
"selectedLanguage",
|
"selectedLanguage",
|
||||||
JSON.stringify(language)
|
JSON.stringify(language)
|
||||||
);
|
);
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ class DialogCalendarEventDetail extends LitElement {
|
|||||||
return html`<div id="text">${ruleText}</div>`;
|
return html`<div id="text">${ruleText}</div>`;
|
||||||
}
|
}
|
||||||
return html`<div id="text">Cannot convert recurrence rule</div>`;
|
return html`<div id="text">Cannot convert recurrence rule</div>`;
|
||||||
} catch (e) {
|
} catch (_e) {
|
||||||
return "Error while processing the rule";
|
return "Error while processing the rule";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ export class RecurrenceRuleEditor extends LitElement {
|
|||||||
let rrule: Partial<Options> | undefined;
|
let rrule: Partial<Options> | undefined;
|
||||||
try {
|
try {
|
||||||
rrule = RRule.parseString(this.value);
|
rrule = RRule.parseString(this.value);
|
||||||
} catch (ex) {
|
} catch (_err) {
|
||||||
// unsupported rrule string
|
// unsupported rrule string
|
||||||
this._freq = undefined;
|
this._freq = undefined;
|
||||||
return;
|
return;
|
||||||
|
@ -126,7 +126,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
|
|||||||
).matches;
|
).matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
if (this._params) {
|
if (this._params) {
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
@ -138,6 +138,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
|
|||||||
this._filter = "";
|
this._filter = "";
|
||||||
this._manifests = undefined;
|
this._manifests = undefined;
|
||||||
this._domains = undefined;
|
this._domains = undefined;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getGroups = (
|
private _getGroups = (
|
||||||
|
@ -45,13 +45,14 @@ class DialogAutomationMode extends LitElement implements HassDialog {
|
|||||||
: undefined;
|
: undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._params.onClose();
|
this._params.onClose();
|
||||||
|
|
||||||
if (this._opened) {
|
if (this._opened) {
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
this._opened = false;
|
this._opened = false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
|
@ -72,7 +72,7 @@ class DialogAutomationRename extends LitElement implements HassDialog {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._params.onClose();
|
this._params.onClose();
|
||||||
|
|
||||||
if (this._opened) {
|
if (this._opened) {
|
||||||
@ -80,6 +80,7 @@ class DialogAutomationRename extends LitElement implements HassDialog {
|
|||||||
}
|
}
|
||||||
this._opened = false;
|
this._opened = false;
|
||||||
this._visibleOptionals = [];
|
this._visibleOptionals = [];
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected _renderOptionalChip(id: string, label: string) {
|
protected _renderOptionalChip(id: string, label: string) {
|
||||||
|
@ -61,11 +61,12 @@ class DialogNewAutomation extends LitElement implements HassDialog {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
if (this._opened) {
|
if (this._opened) {
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
this._opened = false;
|
this._opened = false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _processedBlueprints = memoizeOne((blueprints?: Blueprints) => {
|
private _processedBlueprints = memoizeOne((blueprints?: Blueprints) => {
|
||||||
|
@ -55,7 +55,7 @@ export type BackupConfigData = {
|
|||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HASSDomEvents {
|
interface HASSDomEvents {
|
||||||
"backup-addons-fetched": void;
|
"backup-addons-fetched": undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ class DialogBackupOnboarding extends LitElement implements HassDialog {
|
|||||||
this._opened = true;
|
this._opened = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
if (this._params!.cancel) {
|
if (this._params!.cancel) {
|
||||||
this._params!.cancel();
|
this._params!.cancel();
|
||||||
}
|
}
|
||||||
@ -127,6 +127,7 @@ class DialogBackupOnboarding extends LitElement implements HassDialog {
|
|||||||
this._step = undefined;
|
this._step = undefined;
|
||||||
this._config = undefined;
|
this._config = undefined;
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private get _firstStep(): Step {
|
private get _firstStep(): Step {
|
||||||
|
@ -48,7 +48,7 @@ class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog {
|
|||||||
this._newEncryptionKey = generateEncryptionKey();
|
this._newEncryptionKey = generateEncryptionKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
if (this._params!.cancel) {
|
if (this._params!.cancel) {
|
||||||
this._params!.cancel();
|
this._params!.cancel();
|
||||||
}
|
}
|
||||||
@ -59,6 +59,7 @@ class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog {
|
|||||||
this._step = undefined;
|
this._step = undefined;
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
this._newEncryptionKey = undefined;
|
this._newEncryptionKey = undefined;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _done() {
|
private _done() {
|
||||||
|
@ -115,6 +115,7 @@ class DialogGenerateBackup extends LitElement implements HassDialog {
|
|||||||
|
|
||||||
public closeDialog() {
|
public closeDialog() {
|
||||||
this._dialog?.close();
|
this._dialog?.close();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _previousStep() {
|
private _previousStep() {
|
||||||
|
@ -31,8 +31,9 @@ class DialogNewBackup extends LitElement implements HassDialog {
|
|||||||
this._params = params;
|
this._params = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._dialog?.close();
|
this._dialog?.close();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _dialogClosed() {
|
private _dialogClosed() {
|
||||||
|
@ -90,6 +90,7 @@ class DialogRestoreBackup extends LitElement implements HassDialog {
|
|||||||
|
|
||||||
public closeDialog() {
|
public closeDialog() {
|
||||||
this._dialog?.close();
|
this._dialog?.close();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _dialogClosed() {
|
private _dialogClosed() {
|
||||||
|
@ -48,7 +48,7 @@ class DialogSetBackupEncryptionKey extends LitElement implements HassDialog {
|
|||||||
this._newEncryptionKey = generateEncryptionKey();
|
this._newEncryptionKey = generateEncryptionKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
if (this._params!.cancel) {
|
if (this._params!.cancel) {
|
||||||
this._params!.cancel();
|
this._params!.cancel();
|
||||||
}
|
}
|
||||||
@ -59,6 +59,7 @@ class DialogSetBackupEncryptionKey extends LitElement implements HassDialog {
|
|||||||
this._step = undefined;
|
this._step = undefined;
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
this._newEncryptionKey = undefined;
|
this._newEncryptionKey = undefined;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _done() {
|
private _done() {
|
||||||
|
@ -32,9 +32,10 @@ class DialogShowBackupEncryptionKey extends LitElement implements HassDialog {
|
|||||||
this._params = params;
|
this._params = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _closeDialog() {
|
private _closeDialog() {
|
||||||
|
@ -65,6 +65,7 @@ export class DialogUploadBackup
|
|||||||
|
|
||||||
public closeDialog() {
|
public closeDialog() {
|
||||||
this._dialog?.close();
|
this._dialog?.close();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _formValid() {
|
private _formValid() {
|
||||||
|
@ -11,7 +11,7 @@ export const showUploadBackupDialog = (
|
|||||||
element: HTMLElement,
|
element: HTMLElement,
|
||||||
params: UploadBackupDialogParams
|
params: UploadBackupDialogParams
|
||||||
) =>
|
) =>
|
||||||
new Promise<void | null>((resolve) => {
|
new Promise<undefined | null>((resolve) => {
|
||||||
const origCancel = params.cancel;
|
const origCancel = params.cancel;
|
||||||
const origSubmit = params.submit;
|
const origSubmit = params.submit;
|
||||||
fireEvent(element, "show-dialog", {
|
fireEvent(element, "show-dialog", {
|
||||||
@ -26,7 +26,7 @@ export const showUploadBackupDialog = (
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
submit: () => {
|
submit: () => {
|
||||||
resolve();
|
resolve(undefined);
|
||||||
if (origSubmit) {
|
if (origSubmit) {
|
||||||
origSubmit();
|
origSubmit();
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,10 @@ export class DialogJoinBeta
|
|||||||
this._dialogParams = dialogParams;
|
this._dialogParams = dialogParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._dialogParams = undefined;
|
this._dialogParams = undefined;
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
|
@ -45,12 +45,13 @@ class DialogNewDashboard extends LitElement implements HassDialog {
|
|||||||
this._params = params;
|
this._params = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
if (this._opened) {
|
if (this._opened) {
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
this._opened = false;
|
this._opened = false;
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
|
@ -41,7 +41,7 @@ export class HaDeviceInfoMatter extends SubscribeMixin(LitElement) {
|
|||||||
this.hass,
|
this.hass,
|
||||||
this.device.id
|
this.device.id
|
||||||
);
|
);
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
this._nodeDiagnostics = undefined;
|
this._nodeDiagnostics = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ class MQTTMessages extends LitElement {
|
|||||||
if (typeof payload === "string") {
|
if (typeof payload === "string") {
|
||||||
try {
|
try {
|
||||||
o = JSON.parse(payload);
|
o = JSON.parse(payload);
|
||||||
} catch (err: any) {
|
} catch (_err: any) {
|
||||||
o = null;
|
o = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,7 @@ export class EnergyGasSettings extends LitElement {
|
|||||||
showEnergySettingsGasDialog(this, {
|
showEnergySettingsGasDialog(this, {
|
||||||
allowedGasUnitClass: getEnergyGasUnitClass(
|
allowedGasUnitClass: getEnergyGasUnitClass(
|
||||||
this.preferences,
|
this.preferences,
|
||||||
|
undefined,
|
||||||
this.statsMetadata
|
this.statsMetadata
|
||||||
),
|
),
|
||||||
gas_sources: this.preferences.energy_sources.filter(
|
gas_sources: this.preferences.energy_sources.filter(
|
||||||
@ -157,8 +158,8 @@ export class EnergyGasSettings extends LitElement {
|
|||||||
source: { ...origSource },
|
source: { ...origSource },
|
||||||
allowedGasUnitClass: getEnergyGasUnitClass(
|
allowedGasUnitClass: getEnergyGasUnitClass(
|
||||||
this.preferences,
|
this.preferences,
|
||||||
this.statsMetadata,
|
origSource.stat_energy_from,
|
||||||
origSource.stat_energy_from
|
this.statsMetadata
|
||||||
),
|
),
|
||||||
metadata: this.statsMetadata?.[origSource.stat_energy_from],
|
metadata: this.statsMetadata?.[origSource.stat_energy_from],
|
||||||
gas_sources: this.preferences.energy_sources.filter(
|
gas_sources: this.preferences.energy_sources.filter(
|
||||||
|
@ -58,12 +58,13 @@ export class DialogEnergyBatterySettings
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
this._source = undefined;
|
this._source = undefined;
|
||||||
this._error = undefined;
|
this._error = undefined;
|
||||||
this._excludeList = undefined;
|
this._excludeList = undefined;
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
|
@ -49,12 +49,13 @@ export class DialogEnergyDeviceSettings
|
|||||||
.filter((id) => id !== this._device?.stat_consumption);
|
.filter((id) => id !== this._device?.stat_consumption);
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
this._device = undefined;
|
this._device = undefined;
|
||||||
this._error = undefined;
|
this._error = undefined;
|
||||||
this._excludeList = undefined;
|
this._excludeList = undefined;
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
|
@ -83,13 +83,14 @@ export class DialogEnergyGasSettings
|
|||||||
.filter((id) => id !== this._source?.stat_energy_from);
|
.filter((id) => id !== this._source?.stat_energy_from);
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
this._source = undefined;
|
this._source = undefined;
|
||||||
this._pickedDisplayUnit = undefined;
|
this._pickedDisplayUnit = undefined;
|
||||||
this._error = undefined;
|
this._error = undefined;
|
||||||
this._excludeList = undefined;
|
this._excludeList = undefined;
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
|
@ -100,13 +100,14 @@ export class DialogEnergyGridFlowSettings
|
|||||||
].filter((id) => id !== initialSourceId);
|
].filter((id) => id !== initialSourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
this._source = undefined;
|
this._source = undefined;
|
||||||
this._pickedDisplayUnit = undefined;
|
this._pickedDisplayUnit = undefined;
|
||||||
this._error = undefined;
|
this._error = undefined;
|
||||||
this._excludeList = undefined;
|
this._excludeList = undefined;
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
|
@ -66,12 +66,13 @@ export class DialogEnergySolarSettings
|
|||||||
.filter((id) => id !== this._source?.stat_energy_from);
|
.filter((id) => id !== this._source?.stat_energy_from);
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
this._source = undefined;
|
this._source = undefined;
|
||||||
this._error = undefined;
|
this._error = undefined;
|
||||||
this._excludeList = undefined;
|
this._excludeList = undefined;
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
|
@ -75,13 +75,14 @@ export class DialogEnergyWaterSettings
|
|||||||
.filter((id) => id !== this._source?.stat_energy_from);
|
.filter((id) => id !== this._source?.stat_energy_from);
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog() {
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
this._source = undefined;
|
this._source = undefined;
|
||||||
this._error = undefined;
|
this._error = undefined;
|
||||||
this._pickedDisplayUnit = undefined;
|
this._pickedDisplayUnit = undefined;
|
||||||
this._excludeList = undefined;
|
this._excludeList = undefined;
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user