mirror of
https://github.com/home-assistant/frontend.git
synced 2026-01-11 09:47:27 +00:00
Compare commits
23 Commits
master
...
padding-co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22d29ef4f5 | ||
|
|
f65d41fea6 | ||
|
|
be4e46a3c6 | ||
|
|
2fce89a689 | ||
|
|
81d21b0907 | ||
|
|
65381b1dc5 | ||
|
|
7cbede2f6e | ||
|
|
0a13dddaea | ||
|
|
662be980e8 | ||
|
|
209abf466d | ||
|
|
db9a3bd562 | ||
|
|
36ecaa6610 | ||
|
|
4f46d0f4a3 | ||
|
|
42ad47649d | ||
|
|
c62ee6e692 | ||
|
|
b38c8d7d5f | ||
|
|
83bcc39d5f | ||
|
|
8d317d1e2c | ||
|
|
9acad2e83c | ||
|
|
9099c5a92c | ||
|
|
60c4d60d66 | ||
|
|
e8a4cde643 | ||
|
|
148eab31b6 |
4
.github/copilot-instructions.md
vendored
4
.github/copilot-instructions.md
vendored
@@ -22,11 +22,13 @@ You are an assistant helping with development of the Home Assistant frontend. Th
|
||||
```bash
|
||||
yarn lint # ESLint + Prettier + TypeScript + Lit
|
||||
yarn format # Auto-fix ESLint + Prettier
|
||||
yarn lint:types # TypeScript compiler
|
||||
yarn lint:types # TypeScript compiler (run WITHOUT file arguments)
|
||||
yarn test # Vitest
|
||||
script/develop # Development server
|
||||
```
|
||||
|
||||
> **WARNING:** Never run `tsc` or `yarn lint:types` with file arguments (e.g., `yarn lint:types src/file.ts`). When `tsc` receives file arguments, it ignores `tsconfig.json` and emits `.js` files into `src/`, polluting the codebase. Always run `yarn lint:types` without arguments. For individual file type checking, rely on IDE diagnostics. If `.js` files are accidentally generated, clean up with `git clean -fd src/`.
|
||||
|
||||
### Component Prefixes
|
||||
|
||||
- `ha-` - Home Assistant components
|
||||
|
||||
2
.github/workflows/relative-ci.yaml
vendored
2
.github/workflows/relative-ci.yaml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Send bundle stats and build information to RelativeCI
|
||||
uses: relative-ci/agent-action@c45aaa919ef85620af54242a241ac17a8fa35983 # v3.2.1
|
||||
uses: relative-ci/agent-action@3c681926017930047fc03acaa35cd6a44efcbfc3 # v3.2.2
|
||||
with:
|
||||
key: ${{ secrets[format('RELATIVE_CI_KEY_{0}_{1}', matrix.bundle, matrix.build)] }}
|
||||
token: ${{ github.token }}
|
||||
|
||||
@@ -187,5 +187,11 @@ export default tseslint.config(
|
||||
],
|
||||
"no-use-before-define": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["src/util/recorder-worklet.js"],
|
||||
languageOptions: {
|
||||
globals: globals.audioWorklet,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
40
package.json
40
package.json
@@ -34,18 +34,18 @@
|
||||
"@codemirror/legacy-modes": "6.5.2",
|
||||
"@codemirror/search": "6.5.11",
|
||||
"@codemirror/state": "6.5.3",
|
||||
"@codemirror/view": "6.39.7",
|
||||
"@codemirror/view": "6.39.8",
|
||||
"@date-fns/tz": "1.4.1",
|
||||
"@egjs/hammerjs": "2.0.17",
|
||||
"@formatjs/intl-datetimeformat": "7.1.0",
|
||||
"@formatjs/intl-displaynames": "7.1.0",
|
||||
"@formatjs/intl-durationformat": "0.9.0",
|
||||
"@formatjs/intl-getcanonicallocales": "3.1.0",
|
||||
"@formatjs/intl-listformat": "8.1.0",
|
||||
"@formatjs/intl-locale": "5.1.0",
|
||||
"@formatjs/intl-numberformat": "9.1.0",
|
||||
"@formatjs/intl-pluralrules": "6.1.0",
|
||||
"@formatjs/intl-relativetimeformat": "12.1.0",
|
||||
"@formatjs/intl-datetimeformat": "7.1.1",
|
||||
"@formatjs/intl-displaynames": "7.1.1",
|
||||
"@formatjs/intl-durationformat": "0.9.1",
|
||||
"@formatjs/intl-getcanonicallocales": "3.1.1",
|
||||
"@formatjs/intl-listformat": "8.1.1",
|
||||
"@formatjs/intl-locale": "5.1.1",
|
||||
"@formatjs/intl-numberformat": "9.1.1",
|
||||
"@formatjs/intl-pluralrules": "6.1.1",
|
||||
"@formatjs/intl-relativetimeformat": "12.1.1",
|
||||
"@fullcalendar/core": "6.1.20",
|
||||
"@fullcalendar/daygrid": "6.1.20",
|
||||
"@fullcalendar/interaction": "6.1.20",
|
||||
@@ -112,13 +112,13 @@
|
||||
"hls.js": "1.6.15",
|
||||
"home-assistant-js-websocket": "9.6.0",
|
||||
"idb-keyval": "6.2.2",
|
||||
"intl-messageformat": "11.0.7",
|
||||
"intl-messageformat": "11.0.8",
|
||||
"js-yaml": "4.1.1",
|
||||
"leaflet": "1.9.4",
|
||||
"leaflet-draw": "patch:leaflet-draw@npm%3A1.0.4#./.yarn/patches/leaflet-draw-npm-1.0.4-0ca0ebcf65.patch",
|
||||
"leaflet.markercluster": "1.5.3",
|
||||
"lit": "3.3.2",
|
||||
"lit-html": "3.3.2",
|
||||
"lit": "3.3.1",
|
||||
"lit-html": "3.3.1",
|
||||
"luxon": "3.7.2",
|
||||
"marked": "17.0.1",
|
||||
"memoize-one": "6.0.0",
|
||||
@@ -156,8 +156,8 @@
|
||||
"@octokit/plugin-retry": "8.0.3",
|
||||
"@octokit/rest": "22.0.1",
|
||||
"@rsdoctor/rspack-plugin": "1.4.0",
|
||||
"@rspack/core": "1.6.8",
|
||||
"@rspack/dev-server": "1.1.4",
|
||||
"@rspack/core": "1.7.0",
|
||||
"@rspack/dev-server": "1.1.5",
|
||||
"@types/babel__plugin-transform-runtime": "7.9.5",
|
||||
"@types/chromecast-caf-receiver": "6.0.25",
|
||||
"@types/chromecast-caf-sender": "1.0.11",
|
||||
@@ -199,7 +199,7 @@
|
||||
"gulp-rename": "2.1.0",
|
||||
"html-minifier-terser": "7.2.0",
|
||||
"husky": "9.1.7",
|
||||
"jsdom": "27.3.0",
|
||||
"jsdom": "27.4.0",
|
||||
"jszip": "3.10.1",
|
||||
"lint-staged": "16.2.7",
|
||||
"lit-analyzer": "2.0.3",
|
||||
@@ -215,7 +215,7 @@
|
||||
"terser-webpack-plugin": "5.3.16",
|
||||
"ts-lit-plugin": "2.0.2",
|
||||
"typescript": "5.9.3",
|
||||
"typescript-eslint": "8.50.1",
|
||||
"typescript-eslint": "8.51.0",
|
||||
"vite-tsconfig-paths": "6.0.3",
|
||||
"vitest": "4.0.16",
|
||||
"webpack-stats-plugin": "1.1.3",
|
||||
@@ -224,12 +224,12 @@
|
||||
},
|
||||
"resolutions": {
|
||||
"@material/mwc-button@^0.25.3": "^0.27.0",
|
||||
"lit": "3.3.2",
|
||||
"lit-html": "3.3.2",
|
||||
"lit": "3.3.1",
|
||||
"lit-html": "3.3.1",
|
||||
"clean-css": "5.3.3",
|
||||
"@lit/reactive-element": "2.1.2",
|
||||
"@fullcalendar/daygrid": "6.1.20",
|
||||
"globals": "16.5.0",
|
||||
"globals": "17.0.0",
|
||||
"tslib": "2.8.1",
|
||||
"@material/mwc-list@^0.27.0": "patch:@material/mwc-list@npm%3A0.27.0#~/.yarn/patches/@material-mwc-list-npm-0.27.0-5344fc9de4.patch",
|
||||
"glob@^10.2.2": "^10.5.0"
|
||||
|
||||
@@ -44,6 +44,7 @@ class HaNavigationList extends LitElement {
|
||||
>
|
||||
<ha-svg-icon
|
||||
.path=${page.iconPath}
|
||||
.secondaryPath=${page.iconSecondaryPath}
|
||||
.viewBox=${page.iconViewBox}
|
||||
></ha-svg-icon>
|
||||
</div>
|
||||
|
||||
@@ -55,6 +55,7 @@ export interface PickerComboBoxItem {
|
||||
}
|
||||
|
||||
export const NO_ITEMS_AVAILABLE_ID = "___no_items_available___";
|
||||
const PADDING_ID = "___padding___";
|
||||
|
||||
const DEFAULT_ROW_RENDERER: RenderItemFunction<PickerComboBoxItem> = (
|
||||
item
|
||||
@@ -108,7 +109,7 @@ export class HaPickerComboBox extends ScrollableFadeMixin(LitElement) {
|
||||
public getItems!: (
|
||||
searchString?: string,
|
||||
section?: string
|
||||
) => (PickerComboBoxItem | string)[];
|
||||
) => PickerComboBoxItem[];
|
||||
|
||||
@property({ attribute: false, type: Array })
|
||||
public getAdditionalItems?: (searchString?: string) => PickerComboBoxItem[];
|
||||
@@ -150,7 +151,7 @@ export class HaPickerComboBox extends ScrollableFadeMixin(LitElement) {
|
||||
|
||||
@query("ha-textfield") private _searchFieldElement?: HaTextField;
|
||||
|
||||
@state() private _items: (PickerComboBoxItem | string)[] = [];
|
||||
@state() private _items: PickerComboBoxItem[] = [];
|
||||
|
||||
protected get scrollableElement(): HTMLElement | null {
|
||||
return this._virtualizerElement as HTMLElement | null;
|
||||
@@ -160,7 +161,7 @@ export class HaPickerComboBox extends ScrollableFadeMixin(LitElement) {
|
||||
|
||||
@state() private _valuePinned = true;
|
||||
|
||||
private _allItems: (PickerComboBoxItem | string)[] = [];
|
||||
private _allItems: PickerComboBoxItem[] = [];
|
||||
|
||||
private _selectedItemIndex = -1;
|
||||
|
||||
@@ -278,8 +279,8 @@ export class HaPickerComboBox extends ScrollableFadeMixin(LitElement) {
|
||||
this._sectionTitle = this.sectionTitleFunction({
|
||||
firstIndex: ev.first,
|
||||
lastIndex: ev.last,
|
||||
firstItem: firstItem as PickerComboBoxItem | string,
|
||||
secondItem: secondItem as PickerComboBoxItem | string,
|
||||
firstItem: firstItem as PickerComboBoxItem,
|
||||
secondItem: secondItem as PickerComboBoxItem,
|
||||
itemsCount: this._virtualizerElement.items.length,
|
||||
});
|
||||
}
|
||||
@@ -324,27 +325,27 @@ export class HaPickerComboBox extends ScrollableFadeMixin(LitElement) {
|
||||
}
|
||||
|
||||
if (!items.length) {
|
||||
items.push(NO_ITEMS_AVAILABLE_ID);
|
||||
items.push({ id: NO_ITEMS_AVAILABLE_ID, primary: "" });
|
||||
}
|
||||
|
||||
const additionalItems = this._getAdditionalItems();
|
||||
items.push(...additionalItems);
|
||||
|
||||
if (this.mode === "dialog") {
|
||||
items.push("padding"); // padding for safe area inset
|
||||
items.push({ id: PADDING_ID, primary: "" }); // padding for safe area inset
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
private _renderItem = (item: PickerComboBoxItem | string, index: number) => {
|
||||
private _renderItem = (item: PickerComboBoxItem, index: number) => {
|
||||
if (!item) {
|
||||
return nothing;
|
||||
}
|
||||
if (item === "padding") {
|
||||
if (item.id === PADDING_ID) {
|
||||
return html`<div class="bottom-padding"></div>`;
|
||||
}
|
||||
if (item === NO_ITEMS_AVAILABLE_ID) {
|
||||
if (item.id === NO_ITEMS_AVAILABLE_ID) {
|
||||
return html`
|
||||
<div class="combo-box-row">
|
||||
<ha-combo-box-item type="text" compact>
|
||||
@@ -419,21 +420,18 @@ export class HaPickerComboBox extends ScrollableFadeMixin(LitElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
const index = this._fuseIndex(
|
||||
this._allItems as PickerComboBoxItem[],
|
||||
this.searchKeys
|
||||
);
|
||||
const index = this._fuseIndex(this._allItems, this.searchKeys);
|
||||
|
||||
let filteredItems = multiTermSortedSearch<PickerComboBoxItem>(
|
||||
this._allItems as PickerComboBoxItem[],
|
||||
this._allItems,
|
||||
searchString,
|
||||
this.searchKeys || DEFAULT_SEARCH_KEYS,
|
||||
(item) => item.id,
|
||||
index
|
||||
) as (PickerComboBoxItem | string)[];
|
||||
);
|
||||
|
||||
if (!filteredItems.length) {
|
||||
filteredItems.push(NO_ITEMS_AVAILABLE_ID);
|
||||
filteredItems.push({ id: NO_ITEMS_AVAILABLE_ID, primary: "" });
|
||||
}
|
||||
|
||||
const additionalItems = this._getAdditionalItems(searchString);
|
||||
@@ -442,8 +440,8 @@ export class HaPickerComboBox extends ScrollableFadeMixin(LitElement) {
|
||||
if (this.searchFn) {
|
||||
filteredItems = this.searchFn(
|
||||
searchString,
|
||||
filteredItems as PickerComboBoxItem[],
|
||||
this._allItems as PickerComboBoxItem[]
|
||||
filteredItems,
|
||||
this._allItems
|
||||
);
|
||||
}
|
||||
|
||||
@@ -459,7 +457,7 @@ export class HaPickerComboBox extends ScrollableFadeMixin(LitElement) {
|
||||
});
|
||||
}
|
||||
|
||||
this._items = filteredItems as PickerComboBoxItem[];
|
||||
this._items = filteredItems;
|
||||
}
|
||||
|
||||
this._selectedItemIndex = -1;
|
||||
|
||||
@@ -282,6 +282,7 @@ export const provideHass = (
|
||||
dockedSidebar: "auto",
|
||||
vibrate: true,
|
||||
debugConnection: false,
|
||||
kioskMode: false,
|
||||
suspendWhenHidden: false,
|
||||
moreInfoEntityId: null as any,
|
||||
// @ts-ignore
|
||||
|
||||
@@ -23,6 +23,7 @@ export interface PageNavigation {
|
||||
core?: boolean;
|
||||
advancedOnly?: boolean;
|
||||
iconPath?: string;
|
||||
iconSecondaryPath?: string;
|
||||
iconViewBox?: string;
|
||||
description?: string;
|
||||
iconColor?: string;
|
||||
|
||||
@@ -163,7 +163,7 @@ class DialogImportBlueprint extends LitElement {
|
||||
</div>
|
||||
<ha-button
|
||||
appearance="plain"
|
||||
slot="primaryAction"
|
||||
slot="secondaryAction"
|
||||
@click=${this.closeDialog}
|
||||
.disabled=${this._saving}
|
||||
>
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import type { CSSResultGroup, TemplateResult } from "lit";
|
||||
import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit";
|
||||
import { css, html, LitElement } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { canShowPage } from "../../../common/config/can_show_page";
|
||||
import "../../../components/ha-card";
|
||||
import "../../../components/ha-icon-next";
|
||||
import "../../../components/ha-navigation-list";
|
||||
import type { CloudStatus } from "../../../data/cloud";
|
||||
import { getConfigEntries } from "../../../data/config_entries";
|
||||
import type { PageNavigation } from "../../../layouts/hass-tabs-subpage";
|
||||
import type { HomeAssistant } from "../../../types";
|
||||
|
||||
@@ -17,13 +18,29 @@ class HaConfigNavigation extends LitElement {
|
||||
|
||||
@property({ attribute: false }) public pages!: PageNavigation[];
|
||||
|
||||
@state() private _hasBluetoothConfigEntries = false;
|
||||
|
||||
protected firstUpdated(changedProps: PropertyValues) {
|
||||
super.firstUpdated(changedProps);
|
||||
getConfigEntries(this.hass, {
|
||||
domain: "bluetooth",
|
||||
}).then((bluetoothEntries) => {
|
||||
this._hasBluetoothConfigEntries = bluetoothEntries.length > 0;
|
||||
});
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
const pages = this.pages
|
||||
.filter((page) =>
|
||||
page.path === "#external-app-configuration"
|
||||
? this.hass.auth.external?.config.hasSettingsScreen
|
||||
: canShowPage(this.hass, page)
|
||||
)
|
||||
.filter((page) => {
|
||||
if (page.path === "#external-app-configuration") {
|
||||
return this.hass.auth.external?.config.hasSettingsScreen;
|
||||
}
|
||||
// Only show Bluetooth page if there are Bluetooth config entries
|
||||
if (page.component === "bluetooth") {
|
||||
return this._hasBluetoothConfigEntries;
|
||||
}
|
||||
return canShowPage(this.hass, page);
|
||||
})
|
||||
.map((page) => ({
|
||||
...page,
|
||||
name:
|
||||
|
||||
@@ -107,15 +107,6 @@ export const configSections: Record<string, PageNavigation[]> = {
|
||||
},
|
||||
],
|
||||
dashboard_2: [
|
||||
{
|
||||
path: "/config/matter",
|
||||
name: "Matter",
|
||||
iconPath:
|
||||
"M7.228375 6.41685c0.98855 0.80195 2.16365 1.3412 3.416275 1.56765V1.30093l1.3612 -0.7854275 1.360125 0.7854275V7.9845c1.252875 -0.226675 2.4283 -0.765875 3.41735 -1.56765l2.471225 1.4293c-4.019075 3.976275 -10.490025 3.976275 -14.5091 0l2.482925 -1.4293Zm3.00335 17.067575c1.43325 -5.47035 -1.8052 -11.074775 -7.2604 -12.564675v2.859675c1.189125 0.455 2.244125 1.202875 3.0672 2.174275L0.25 19.2955v1.5719l1.3611925 0.781175L7.39865 18.3068c0.430175 1.19825 0.550625 2.48575 0.35015 3.743l2.482925 1.434625ZM21.034 10.91975c-5.452225 1.4932 -8.6871 7.09635 -7.254025 12.564675l2.47655 -1.43035c-0.200025 -1.257275 -0.079575 -2.544675 0.35015 -3.743025l5.7832 3.337525L23.75 20.86315V19.2955L17.961475 15.9537c0.8233 -0.97115 1.878225 -1.718975 3.0672 -2.174275l0.005325 -2.859675Z",
|
||||
iconColor: "#2458B3",
|
||||
component: "matter",
|
||||
translationKey: "matter",
|
||||
},
|
||||
{
|
||||
path: "/config/zha",
|
||||
name: "Zigbee",
|
||||
@@ -145,6 +136,8 @@ export const configSections: Record<string, PageNavigation[]> = {
|
||||
name: "Thread",
|
||||
iconPath:
|
||||
"M82.498,0C37.008,0,0,37.008,0,82.496c0,45.181,36.51,81.977,81.573,82.476V82.569l-27.002-0.002 c-8.023,0-14.554,6.53-14.554,14.561c0,8.023,6.531,14.551,14.554,14.551v17.98c-17.939,0-32.534-14.595-32.534-32.531 c0-17.944,14.595-32.543,32.534-32.543l27.002,0.004v-9.096c0-14.932,12.146-27.08,27.075-27.08 c14.932,0,27.082,12.148,27.082,27.08c0,14.931-12.15,27.08-27.082,27.08l-9.097-0.001v80.641 C136.889,155.333,165,122.14,165,82.496C165,37.008,127.99,0,82.498,0z",
|
||||
iconSecondaryPath:
|
||||
"M117.748 55.493C117.748 50.477 113.666 46.395 108.648 46.395C103.633 46.395 99.551 50.477 99.551 55.493V64.59L108.648 64.591C113.666 64.591 117.748 60.51 117.748 55.493Z",
|
||||
iconViewBox: "0 0 165 165",
|
||||
iconColor: "#ED7744",
|
||||
component: "thread",
|
||||
@@ -161,7 +154,9 @@ export const configSections: Record<string, PageNavigation[]> = {
|
||||
{
|
||||
path: "/insteon",
|
||||
name: "Insteon",
|
||||
iconPath: mdiLan,
|
||||
iconPath:
|
||||
"M82.5108 43.8917H82.7152C107.824 43.8917 129.241 28.1166 137.629 5.95738L105.802 0L82.5108 43.8917ZM82.5108 43.8917H82.3065C57.1975 43.8917 35.7811 28.1352 27.3928 5.95738H27.3742L59.2015 0L82.5108 43.8917ZM43.8903 82.4951V82.2908C43.8903 57.1805 28.1158 35.7636 5.95718 27.3751L0 59.2037L43.8903 82.4951ZM43.8903 82.4951V82.6989C43.8903 107.809 28.1343 129.226 5.95718 137.615V137.633L0 105.805L43.8903 82.4951ZM165 59.2037L159.043 27.3751V27.3936C136.865 35.7822 121.11 57.1991 121.11 82.3094V82.5133V82.7176V82.7363C121.11 107.846 136.884 129.263 159.043 137.652L165 105.823L121.11 82.5133L165 59.2037ZM137.628 159.043L105.8 165L82.4912 121.108H82.695C107.804 121.108 129.221 136.865 137.609 159.043H137.628ZM82.4912 121.108L59.1818 165L27.3545 159.043C35.7428 136.884 57.1592 121.108 82.2682 121.108H82.2868H82.4912Z",
|
||||
iconViewBox: "0 0 165 165",
|
||||
iconColor: "#E4002C",
|
||||
component: "insteon",
|
||||
translationKey: "insteon",
|
||||
|
||||
@@ -46,44 +46,54 @@ export class MatterConfigDashboard extends LitElement {
|
||||
href="/config/thread"
|
||||
slot="toolbar-icon"
|
||||
>
|
||||
Visit Thread Panel</ha-button
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.matter.panel.thread_panel"
|
||||
)}</ha-button
|
||||
>
|
||||
`
|
||||
: ""}
|
||||
<div class="content">
|
||||
<ha-card header="Matter">
|
||||
<ha-alert alert-type="warning"
|
||||
>Matter is still in the early phase of development, it is not
|
||||
meant to be used in production. This panel is for development
|
||||
only.</ha-alert
|
||||
>${this.hass.localize(
|
||||
"ui.panel.config.matter.panel.experimental_note"
|
||||
)}</ha-alert
|
||||
>
|
||||
<div class="card-content">
|
||||
${this._error
|
||||
? html`<ha-alert alert-type="error">${this._error}</ha-alert>`
|
||||
: ""}
|
||||
You can add Matter devices by commissing them if they are not
|
||||
setup yet, or share them from another controller and enter the
|
||||
share code.
|
||||
${this.hass.localize("ui.panel.config.matter.panel.add_devices")}
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
${canCommissionMatterExternal(this.hass)
|
||||
? html`<ha-button
|
||||
appearance="plain"
|
||||
@click=${this._startMobileCommissioning}
|
||||
>Commission device with mobile app</ha-button
|
||||
>${this.hass.localize(
|
||||
"ui.panel.config.matter.panel.mobile_app_commisioning"
|
||||
)}</ha-button
|
||||
>`
|
||||
: ""}
|
||||
<ha-button appearance="plain" @click=${this._commission}
|
||||
>Commission device</ha-button
|
||||
>${this.hass.localize(
|
||||
"ui.panel.config.matter.panel.commission_device"
|
||||
)}</ha-button
|
||||
>
|
||||
<ha-button appearance="plain" @click=${this._acceptSharedDevice}
|
||||
>Add shared device</ha-button
|
||||
>${this.hass.localize(
|
||||
"ui.panel.config.matter.panel.add_shared_device"
|
||||
)}</ha-button
|
||||
>
|
||||
<ha-button appearance="plain" @click=${this._setWifi}
|
||||
>Set WiFi Credentials</ha-button
|
||||
>${this.hass.localize(
|
||||
"ui.panel.config.matter.panel.set_wifi_credentials"
|
||||
)}</ha-button
|
||||
>
|
||||
<ha-button appearance="plain" @click=${this._setThread}
|
||||
>Set Thread Credentials</ha-button
|
||||
>${this.hass.localize(
|
||||
"ui.panel.config.matter.panel.set_thread_credentials"
|
||||
)}</ha-button
|
||||
>
|
||||
</div>
|
||||
</ha-card>
|
||||
@@ -114,19 +124,31 @@ export class MatterConfigDashboard extends LitElement {
|
||||
private async _setWifi(): Promise<void> {
|
||||
this._error = undefined;
|
||||
const networkName = await showPromptDialog(this, {
|
||||
title: "Network name",
|
||||
inputLabel: "Network name",
|
||||
title: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.network_name.title"
|
||||
),
|
||||
inputLabel: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.network_name.input_label"
|
||||
),
|
||||
inputType: "string",
|
||||
confirmText: "Continue",
|
||||
confirmText: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.network_name.confirm"
|
||||
),
|
||||
});
|
||||
if (!networkName) {
|
||||
return;
|
||||
}
|
||||
const psk = await showPromptDialog(this, {
|
||||
title: "Passcode",
|
||||
inputLabel: "Code",
|
||||
title: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.passcode.title"
|
||||
),
|
||||
inputLabel: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.passcode.input_label"
|
||||
),
|
||||
inputType: "password",
|
||||
confirmText: "Set Wifi",
|
||||
confirmText: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.passcode.confirm"
|
||||
),
|
||||
});
|
||||
if (!psk) {
|
||||
return;
|
||||
@@ -140,10 +162,16 @@ export class MatterConfigDashboard extends LitElement {
|
||||
|
||||
private async _commission(): Promise<void> {
|
||||
const code = await showPromptDialog(this, {
|
||||
title: "Commission device",
|
||||
inputLabel: "Code",
|
||||
title: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.commission_device.title"
|
||||
),
|
||||
inputLabel: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.commission_device.input_label"
|
||||
),
|
||||
inputType: "string",
|
||||
confirmText: "Commission",
|
||||
confirmText: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.commission_device.confirm"
|
||||
),
|
||||
});
|
||||
if (!code) {
|
||||
return;
|
||||
@@ -160,10 +188,16 @@ export class MatterConfigDashboard extends LitElement {
|
||||
|
||||
private async _acceptSharedDevice(): Promise<void> {
|
||||
const code = await showPromptDialog(this, {
|
||||
title: "Add shared device",
|
||||
inputLabel: "Pin",
|
||||
title: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.add_shared_device.title"
|
||||
),
|
||||
inputLabel: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.add_shared_device.input_label"
|
||||
),
|
||||
inputType: "number",
|
||||
confirmText: "Accept device",
|
||||
confirmText: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.add_shared_device.confirm"
|
||||
),
|
||||
});
|
||||
if (!code) {
|
||||
return;
|
||||
@@ -180,10 +214,16 @@ export class MatterConfigDashboard extends LitElement {
|
||||
|
||||
private async _setThread(): Promise<void> {
|
||||
const code = await showPromptDialog(this, {
|
||||
title: "Set Thread operation",
|
||||
inputLabel: "Dataset",
|
||||
title: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.set_thread.title"
|
||||
),
|
||||
inputLabel: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.set_thread.input_label"
|
||||
),
|
||||
inputType: "string",
|
||||
confirmText: "Set Thread",
|
||||
confirmText: this.hass.localize(
|
||||
"ui.panel.config.matter.panel.prompts.set_thread.confirm"
|
||||
),
|
||||
});
|
||||
if (!code) {
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { navigate } from "../../../../../common/navigate";
|
||||
import type { RouterOptions } from "../../../../../layouts/hass-router-page";
|
||||
import { HassRouterPage } from "../../../../../layouts/hass-router-page";
|
||||
import type { HomeAssistant } from "../../../../../types";
|
||||
@@ -12,10 +11,6 @@ class ZHAConfigDashboardRouter extends HassRouterPage {
|
||||
|
||||
@property({ type: Boolean }) public narrow = false;
|
||||
|
||||
private _configEntry = new URLSearchParams(window.location.search).get(
|
||||
"config_entry"
|
||||
);
|
||||
|
||||
protected routerOptions: RouterOptions = {
|
||||
defaultPage: "dashboard",
|
||||
showLoading: true,
|
||||
@@ -52,7 +47,6 @@ class ZHAConfigDashboardRouter extends HassRouterPage {
|
||||
el.hass = this.hass;
|
||||
el.isWide = this.isWide;
|
||||
el.narrow = this.narrow;
|
||||
el.configEntryId = this._configEntry;
|
||||
if (this._currentPage === "group") {
|
||||
el.groupId = this.routeTail.path.substr(1);
|
||||
} else if (this._currentPage === "device") {
|
||||
@@ -60,17 +54,6 @@ class ZHAConfigDashboardRouter extends HassRouterPage {
|
||||
} else if (this._currentPage === "visualization") {
|
||||
el.zoomedDeviceIdFromURL = this.routeTail.path.substr(1);
|
||||
}
|
||||
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
if (this._configEntry && !searchParams.has("config_entry")) {
|
||||
searchParams.append("config_entry", this._configEntry);
|
||||
navigate(
|
||||
`${this.routeTail.prefix}${
|
||||
this.routeTail.path
|
||||
}?${searchParams.toString()}`,
|
||||
{ replace: true }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class ZHAConfigDashboard extends LitElement {
|
||||
|
||||
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
|
||||
|
||||
@property({ attribute: false }) public configEntryId?: string;
|
||||
@state() private _configEntry?: ConfigEntry;
|
||||
|
||||
@state() private _configuration?: ZHAConfiguration;
|
||||
|
||||
@@ -95,6 +95,7 @@ class ZHAConfigDashboard extends LitElement {
|
||||
super.firstUpdated(changedProperties);
|
||||
if (this.hass) {
|
||||
this.hass.loadBackendTranslation("config_panel", "zha", false);
|
||||
this._fetchConfigEntry();
|
||||
this._fetchConfiguration();
|
||||
this._fetchSettings();
|
||||
this._fetchDevicesAndUpdateStatus();
|
||||
@@ -110,7 +111,6 @@ class ZHAConfigDashboard extends LitElement {
|
||||
.narrow=${this.narrow}
|
||||
.route=${this.route}
|
||||
.tabs=${zhaTabs}
|
||||
back-path="/config/integrations"
|
||||
has-fab
|
||||
>
|
||||
<div class="container">
|
||||
@@ -151,28 +151,26 @@ class ZHAConfigDashboard extends LitElement {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
${this.configEntryId
|
||||
? html`<div class="card-actions">
|
||||
<ha-button
|
||||
href=${`/config/devices/dashboard?historyBack=1&config_entry=${this.configEntryId}`}
|
||||
appearance="plain"
|
||||
size="small"
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.devices.caption"
|
||||
)}</ha-button
|
||||
>
|
||||
<ha-button
|
||||
appearance="plain"
|
||||
size="small"
|
||||
href=${`/config/entities/dashboard?historyBack=1&config_entry=${this.configEntryId}`}
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.entities.caption"
|
||||
)}</ha-button
|
||||
>
|
||||
</div>`
|
||||
: ""}
|
||||
<div class="card-actions">
|
||||
<ha-button
|
||||
href=${`/config/devices/dashboard?historyBack=1&config_entry=${this._configEntry?.entry_id}`}
|
||||
appearance="plain"
|
||||
size="small"
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.devices.caption"
|
||||
)}</ha-button
|
||||
>
|
||||
<ha-button
|
||||
appearance="plain"
|
||||
size="small"
|
||||
href=${`/config/entities/dashboard?historyBack=1&config_entry=${this._configEntry?.entry_id}`}
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.entities.caption"
|
||||
)}</ha-button
|
||||
>
|
||||
</div>
|
||||
</ha-card>
|
||||
<ha-card
|
||||
class="network-settings"
|
||||
@@ -321,6 +319,15 @@ class ZHAConfigDashboard extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
private async _fetchConfigEntry(): Promise<void> {
|
||||
const configEntries = await getConfigEntries(this.hass, {
|
||||
domain: "zha",
|
||||
});
|
||||
if (configEntries.length) {
|
||||
this._configEntry = configEntries[0];
|
||||
}
|
||||
}
|
||||
|
||||
private async _fetchConfiguration(): Promise<void> {
|
||||
this._configuration = await fetchZHAConfiguration(this.hass!);
|
||||
}
|
||||
@@ -399,20 +406,11 @@ class ZHAConfigDashboard extends LitElement {
|
||||
fileDownload(backupJSON, `${basename}.json`);
|
||||
}
|
||||
|
||||
private async _openOptionFlow() {
|
||||
if (!this.configEntryId) {
|
||||
private _openOptionFlow() {
|
||||
if (!this._configEntry) {
|
||||
return;
|
||||
}
|
||||
|
||||
const configEntries: ConfigEntry[] = await getConfigEntries(this.hass, {
|
||||
domain: "zha",
|
||||
});
|
||||
|
||||
const configEntry = configEntries.find(
|
||||
(entry) => entry.entry_id === this.configEntryId
|
||||
);
|
||||
|
||||
showOptionsFlowDialog(this, configEntry!);
|
||||
showOptionsFlowDialog(this, this._configEntry);
|
||||
}
|
||||
|
||||
private _dataChanged(ev) {
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
import type { CSSResultGroup, PropertyValues } from "lit";
|
||||
import { LitElement, css, html } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import "../../../../../components/ha-card";
|
||||
import "../../../../../components/ha-icon-next";
|
||||
import "../../../../../components/ha-list";
|
||||
import "../../../../../components/ha-list-item";
|
||||
import "../../../../../layouts/hass-loading-screen";
|
||||
import "../../../../../layouts/hass-subpage";
|
||||
import type { ConfigEntry } from "../../../../../data/config_entries";
|
||||
import { getConfigEntries } from "../../../../../data/config_entries";
|
||||
import { haStyle } from "../../../../../resources/styles";
|
||||
import type { HomeAssistant } from "../../../../../types";
|
||||
import { navigate } from "../../../../../common/navigate";
|
||||
import { caseInsensitiveStringCompare } from "../../../../../common/string/compare";
|
||||
|
||||
@customElement("zwave_js-config-entry-picker")
|
||||
class ZWaveJSConfigEntryPicker extends LitElement {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@property({ type: Boolean }) public narrow = false;
|
||||
|
||||
@state() private _configEntries?: ConfigEntry[];
|
||||
|
||||
protected async firstUpdated(changedProps: PropertyValues) {
|
||||
super.firstUpdated(changedProps);
|
||||
await this._fetchConfigEntries();
|
||||
}
|
||||
|
||||
protected render() {
|
||||
if (!this._configEntries) {
|
||||
return html`<hass-loading-screen></hass-loading-screen>`;
|
||||
}
|
||||
|
||||
if (this._configEntries.length === 0) {
|
||||
return html`
|
||||
<hass-subpage header="Z-Wave" .narrow=${this.narrow} .hass=${this.hass}>
|
||||
<div class="content">
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<p>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.picker.no_entries"
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
</ha-card>
|
||||
</div>
|
||||
</hass-subpage>
|
||||
`;
|
||||
}
|
||||
|
||||
return html`
|
||||
<hass-subpage header="Z-Wave" .narrow=${this.narrow} .hass=${this.hass}>
|
||||
<div class="content">
|
||||
<ha-card
|
||||
.header=${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.picker.title"
|
||||
)}
|
||||
>
|
||||
<ha-list>
|
||||
${this._configEntries.map(
|
||||
(entry) => html`
|
||||
<a
|
||||
href="/config/zwave_js/dashboard?config_entry=${entry.entry_id}"
|
||||
>
|
||||
<ha-list-item hasMeta>
|
||||
<span>${entry.title}</span>
|
||||
<ha-icon-next slot="meta"></ha-icon-next>
|
||||
</ha-list-item>
|
||||
</a>
|
||||
`
|
||||
)}
|
||||
</ha-list>
|
||||
</ha-card>
|
||||
</div>
|
||||
</hass-subpage>
|
||||
`;
|
||||
}
|
||||
|
||||
private async _fetchConfigEntries() {
|
||||
const entries = await getConfigEntries(this.hass, {
|
||||
domain: "zwave_js",
|
||||
});
|
||||
this._configEntries = entries.sort((a, b) =>
|
||||
caseInsensitiveStringCompare(a.title, b.title)
|
||||
);
|
||||
if (this._configEntries.length === 1) {
|
||||
navigate(
|
||||
`/config/zwave_js/dashboard?config_entry=${this._configEntries[0].entry_id}`,
|
||||
{ replace: true }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static get styles(): CSSResultGroup {
|
||||
return [
|
||||
haStyle,
|
||||
css`
|
||||
.content {
|
||||
padding: 24px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
ha-card {
|
||||
max-width: 600px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
padding: 16px;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
ha-list {
|
||||
--md-list-item-leading-space: var(--ha-space-4);
|
||||
--md-list-item-trailing-space: var(--ha-space-4);
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"zwave_js-config-entry-picker": ZWaveJSConfigEntryPicker;
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,7 @@ import { customElement, property } from "lit/decorators";
|
||||
import type { RouterOptions } from "../../../../../layouts/hass-router-page";
|
||||
import { HassRouterPage } from "../../../../../layouts/hass-router-page";
|
||||
import type { HomeAssistant } from "../../../../../types";
|
||||
import { navigate } from "../../../../../common/navigate";
|
||||
import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage";
|
||||
import { getConfigEntries } from "../../../../../data/config_entries";
|
||||
|
||||
export const configTabs: PageNavigation[] = [
|
||||
{
|
||||
@@ -33,14 +31,36 @@ class ZWaveJSConfigRouter extends HassRouterPage {
|
||||
|
||||
@property({ type: Boolean }) public narrow = false;
|
||||
|
||||
private _configEntry = new URLSearchParams(window.location.search).get(
|
||||
"config_entry"
|
||||
);
|
||||
private _configEntry: string | null = null;
|
||||
|
||||
protected routerOptions: RouterOptions = {
|
||||
defaultPage: "dashboard",
|
||||
defaultPage: "picker",
|
||||
showLoading: true,
|
||||
// Make sure that we have a config entry in the URL before rendering other pages
|
||||
beforeRender: (page) => {
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
if (searchParams.has("config_entry")) {
|
||||
this._configEntry = searchParams.get("config_entry");
|
||||
} else if (page === "picker") {
|
||||
this._configEntry = null;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if ((!page || page === "picker") && this._configEntry) {
|
||||
return "dashboard";
|
||||
}
|
||||
|
||||
if ((!page || page !== "picker") && !this._configEntry) {
|
||||
return "picker";
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
routes: {
|
||||
picker: {
|
||||
tag: "zwave_js-config-entry-picker",
|
||||
load: () => import("./zwave_js-config-entry-picker"),
|
||||
},
|
||||
dashboard: {
|
||||
tag: "zwave_js-config-dashboard",
|
||||
load: () => import("./zwave_js-config-dashboard"),
|
||||
@@ -70,7 +90,6 @@ class ZWaveJSConfigRouter extends HassRouterPage {
|
||||
load: () => import("./zwave_js-network-visualization"),
|
||||
},
|
||||
},
|
||||
initialLoad: () => this._fetchConfigEntries(),
|
||||
};
|
||||
|
||||
protected updatePageEl(el): void {
|
||||
@@ -79,29 +98,6 @@ class ZWaveJSConfigRouter extends HassRouterPage {
|
||||
el.isWide = this.isWide;
|
||||
el.narrow = this.narrow;
|
||||
el.configEntryId = this._configEntry;
|
||||
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
if (this._configEntry && !searchParams.has("config_entry")) {
|
||||
searchParams.append("config_entry", this._configEntry);
|
||||
navigate(
|
||||
`${this.routeTail.prefix}${
|
||||
this.routeTail.path
|
||||
}?${searchParams.toString()}`,
|
||||
{ replace: true }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private async _fetchConfigEntries() {
|
||||
if (this._configEntry) {
|
||||
return;
|
||||
}
|
||||
const entries = await getConfigEntries(this.hass, {
|
||||
domain: "zwave_js",
|
||||
});
|
||||
if (entries.length) {
|
||||
this._configEntry = entries[0].entry_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ export class HuiEnergyDevicesGraphCard
|
||||
params.value[0] as number,
|
||||
this.hass.locale,
|
||||
params.value < 0.1 ? { maximumFractionDigits: 3 } : undefined
|
||||
)} kWh`;
|
||||
)} kWh ${params.percent ? `(${params.percent} %)` : ""}`;
|
||||
return `${title}${params.marker} ${params.seriesName}: <div style="direction:ltr; display: inline;">${value}</div>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -196,6 +196,10 @@ export class HuiStatisticsGraphCard extends LitElement implements LovelaceCard {
|
||||
|
||||
public willUpdate(changedProps: PropertyValues) {
|
||||
super.willUpdate(changedProps);
|
||||
if (changedProps.has("hass") || changedProps.has("_config")) {
|
||||
this._computeNames();
|
||||
}
|
||||
|
||||
if (!this._config || !changedProps.has("_config")) {
|
||||
return;
|
||||
}
|
||||
@@ -225,10 +229,6 @@ export class HuiStatisticsGraphCard extends LitElement implements LovelaceCard {
|
||||
}
|
||||
}
|
||||
|
||||
if (changedProps.has("hass")) {
|
||||
this._computeNames();
|
||||
}
|
||||
|
||||
if (
|
||||
changedProps.has("_config") &&
|
||||
oldConfig?.entities !== this._config.entities
|
||||
|
||||
@@ -28,11 +28,16 @@ import type { HomeAssistant, ValueChangedEvent } from "../../../../types";
|
||||
import { DEFAULT_HOURS_TO_SHOW, DEFAULT_ZOOM } from "../../cards/hui-map-card";
|
||||
import type { MapCardConfig, MapEntityConfig } from "../../cards/types";
|
||||
import "../../components/hui-entity-editor";
|
||||
import type { EntityConfig } from "../../entity-rows/types";
|
||||
import "../hui-sub-element-editor";
|
||||
import type {
|
||||
EditDetailElementEvent,
|
||||
SubElementEditorConfig,
|
||||
EntitiesEditorEvent,
|
||||
} from "../types";
|
||||
import type { HASSDomEvent } from "../../../../common/dom/fire_event";
|
||||
import type { LovelaceCardEditor } from "../../types";
|
||||
import { processEditorEntities } from "../process-editor-entities";
|
||||
import { baseLovelaceCardConfig } from "../structs/base-card-struct";
|
||||
import type { EntitiesEditorEvent } from "../types";
|
||||
import { configElementStyle } from "./config-elements-style";
|
||||
|
||||
export const mapEntitiesConfigStruct = union([
|
||||
@@ -76,13 +81,20 @@ const cardConfigStruct = assign(
|
||||
|
||||
const themeModes = ["auto", "light", "dark"] as const;
|
||||
|
||||
const SUB_SCHEMA = [
|
||||
{ name: "entity", selector: { entity: {} }, required: true },
|
||||
{ name: "name", selector: { text: {} } },
|
||||
] as const;
|
||||
|
||||
@customElement("hui-map-card-editor")
|
||||
export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor {
|
||||
@property({ attribute: false }) public hass?: HomeAssistant;
|
||||
|
||||
@state() private _config?: MapCardConfig;
|
||||
|
||||
@state() private _configEntities?: EntityConfig[];
|
||||
@state() private _subElementEditorConfig?: SubElementEditorConfig;
|
||||
|
||||
@state() private _configEntities?: MapEntityConfig[];
|
||||
|
||||
@state() private _possibleGeoSources?: { value: string; label?: string }[];
|
||||
|
||||
@@ -150,7 +162,7 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor {
|
||||
|
||||
this._config = config;
|
||||
this._configEntities = config.entities
|
||||
? processEditorEntities(config.entities)
|
||||
? (processEditorEntities(config.entities) as MapEntityConfig[])
|
||||
: [];
|
||||
}
|
||||
|
||||
@@ -167,6 +179,19 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor {
|
||||
return nothing;
|
||||
}
|
||||
|
||||
if (this._subElementEditorConfig) {
|
||||
return html`
|
||||
<hui-sub-element-editor
|
||||
.hass=${this.hass}
|
||||
.config=${this._subElementEditorConfig}
|
||||
.schema=${SUB_SCHEMA}
|
||||
@go-back=${this._goBack}
|
||||
@config-changed=${this._handleSubEntityChanged}
|
||||
>
|
||||
</hui-sub-element-editor>
|
||||
`;
|
||||
}
|
||||
|
||||
return html`
|
||||
<ha-form
|
||||
.hass=${this.hass}
|
||||
@@ -180,7 +205,9 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor {
|
||||
.hass=${this.hass}
|
||||
.entities=${this._configEntities}
|
||||
.entityFilter=${hasLocation}
|
||||
can-edit
|
||||
@entities-changed=${this._entitiesValueChanged}
|
||||
@edit-detail-element=${this._editDetailElement}
|
||||
></hui-entity-editor>
|
||||
|
||||
<h3>
|
||||
@@ -203,6 +230,36 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor {
|
||||
`;
|
||||
}
|
||||
|
||||
private _goBack(): void {
|
||||
this._subElementEditorConfig = undefined;
|
||||
}
|
||||
|
||||
private _editDetailElement(ev: HASSDomEvent<EditDetailElementEvent>): void {
|
||||
this._subElementEditorConfig = ev.detail.subElementConfig;
|
||||
}
|
||||
|
||||
private _handleSubEntityChanged(ev: CustomEvent): void {
|
||||
ev.stopPropagation();
|
||||
|
||||
const index = this._subElementEditorConfig!.index!;
|
||||
|
||||
const newEntities = this._configEntities!.concat();
|
||||
const newConfig = ev.detail.config as MapEntityConfig;
|
||||
this._subElementEditorConfig = {
|
||||
...this._subElementEditorConfig!,
|
||||
elementConfig: newConfig,
|
||||
};
|
||||
newEntities[index] = newConfig;
|
||||
let config = this._config!;
|
||||
config = { ...config, entities: newEntities };
|
||||
this._config = config;
|
||||
this._configEntities = processEditorEntities(
|
||||
config.entities as any[]
|
||||
) as MapEntityConfig[];
|
||||
|
||||
fireEvent(this, "config-changed", { config });
|
||||
}
|
||||
|
||||
private _selectSchema = memoizeOne(
|
||||
(options, localize: LocalizeFunc): SelectSelector => ({
|
||||
select: {
|
||||
@@ -229,7 +286,9 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor {
|
||||
if (ev.detail && ev.detail.entities) {
|
||||
this._config = { ...this._config!, entities: ev.detail.entities };
|
||||
|
||||
this._configEntities = processEditorEntities(this._config.entities || []);
|
||||
this._configEntities = processEditorEntities(
|
||||
this._config.entities || []
|
||||
) as MapEntityConfig[];
|
||||
fireEvent(this, "config-changed", { config: this._config! });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +263,8 @@ class HUIRoot extends LitElement {
|
||||
{
|
||||
icon: mdiPlus,
|
||||
key: "ui.panel.lovelace.menu.add",
|
||||
visible: !this._editMode && this.hass.user?.is_admin,
|
||||
visible:
|
||||
!this._editMode && this.hass.user?.is_admin && !this.hass.kioskMode,
|
||||
overflow: this.narrow,
|
||||
subItems: [
|
||||
{
|
||||
@@ -301,7 +302,7 @@ class HUIRoot extends LitElement {
|
||||
key: "ui.panel.lovelace.menu.search_entities",
|
||||
buttonAction: this._showQuickBar,
|
||||
overflowAction: this._handleShowQuickBar,
|
||||
visible: !this._editMode,
|
||||
visible: !this._editMode && !this.hass.kioskMode,
|
||||
overflow: this.narrow,
|
||||
suffix:
|
||||
this.hass.enableShortcuts && !isMobileClient ? "(E)" : undefined,
|
||||
@@ -349,7 +350,8 @@ class HUIRoot extends LitElement {
|
||||
visible:
|
||||
!this._editMode &&
|
||||
this.hass!.user?.is_admin &&
|
||||
!this.hass!.config.recovery_mode,
|
||||
!this.hass!.config.recovery_mode &&
|
||||
!this.hass.kioskMode,
|
||||
overflow: true,
|
||||
overflow_can_promote: true,
|
||||
},
|
||||
|
||||
@@ -4090,7 +4090,7 @@
|
||||
"new_automation_setup_failed_title": "New {type} setup timed out",
|
||||
"new_automation_setup_failed_text": "Your new {type} was saved, but waiting for it to set up has timed out. This could be due to errors parsing your configuration.yaml, please check the configuration in developer tools. Your {type} will not be visible until this is corrected and {types} are reloaded. Changes to area, category, or labels were not saved and must be reapplied.",
|
||||
"new_automation_setup_keep_waiting": "You may continue to wait for a response from the server, in case it is just taking an unusually long time to process this {type}.",
|
||||
"new_automation_setup_timedout_success": "The server has responded and this has now setup successfully. You may now close this dialog.",
|
||||
"new_automation_setup_timedout_success": "The server has responded and this has now set up successfully. You may now close this dialog.",
|
||||
"item_pasted": "{item} pasted",
|
||||
"ctrl": "Ctrl",
|
||||
"del": "Del",
|
||||
@@ -6253,7 +6253,7 @@
|
||||
"new_channel": "New channel",
|
||||
"change_channel": "Change channel",
|
||||
"migration_warning": "Zigbee channel migration is an experimental feature and relies on devices on your network to support it. Device support for this feature varies and only a portion of your network may end up migrating! It may take up to an hour for changes to propagate to all devices.",
|
||||
"description": "Change your Zigbee channel only after you have eliminated all other sources of 2.4GHz interference by using a USB extension cable and moving your coordinator away from USB 3.0 devices and ports, SSDs, 2.4GHz WiFi networks on the same channel, motherboards, and so on.",
|
||||
"description": "Change your Zigbee channel only after you have eliminated all other sources of 2.4GHz interference by using a USB extension cable and moving your coordinator away from USB 3.0 devices and ports, SSDs, 2.4GHz Wi-Fi networks on the same channel, motherboards, and so on.",
|
||||
"smart_explanation": "It is recommended to use the \"Smart\" option once your environment is optimized as opposed to manually choosing a channel, as it picks the best channel for you after scanning all Zigbee channels. This does not configure ZHA to automatically change channels in the future, it only changes the channel a single time.",
|
||||
"channel_has_been_changed": "Network channel has been changed",
|
||||
"devices_will_rejoin": "Devices will re-join the network over time. This may take a few minutes.",
|
||||
@@ -6827,9 +6827,50 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"picker": {
|
||||
"title": "Select Z-Wave network",
|
||||
"no_entries": "No Z-Wave networks configured. Set up the Z-Wave JS integration first."
|
||||
}
|
||||
},
|
||||
"matter": {
|
||||
"panel": {
|
||||
"thread_panel": "Visit Thread Panel",
|
||||
"experimental_note": "Matter is still in the early phase of development, it is not meant to be used in production. This panel is for development only.",
|
||||
"add_devices": "You can add Matter devices by commissioning them if they are not set up yet, or share them from another controller and enter the sharing code.",
|
||||
"mobile_app_commisioning": "Commission device with mobile app",
|
||||
"commission_device": "Commission device",
|
||||
"add_shared_device": "Add shared device",
|
||||
"set_wifi_credentials": "Set Wi-Fi credentials",
|
||||
"set_thread_credentials": "Set Thread credentials",
|
||||
"prompts": {
|
||||
"network_name": {
|
||||
"title": "Network name",
|
||||
"input_label": "Network name",
|
||||
"confirm": "Continue"
|
||||
},
|
||||
"passcode": {
|
||||
"title": "Passcode",
|
||||
"input_label": "Code",
|
||||
"confirm": "Set Wi-Fi"
|
||||
},
|
||||
"commission_device": {
|
||||
"title": "Commission device",
|
||||
"input_label": "Code",
|
||||
"confirm": "Commission"
|
||||
},
|
||||
"add_shared_device": {
|
||||
"title": "Add shared device",
|
||||
"input_label": "PIN",
|
||||
"confirm": "Accept device"
|
||||
},
|
||||
"set_thread": {
|
||||
"title": "Set Thread operation",
|
||||
"input_label": "Dataset",
|
||||
"confirm": "Set Thread"
|
||||
}
|
||||
}
|
||||
},
|
||||
"network_type": {
|
||||
"thread": "Thread",
|
||||
"wifi": "Wi-Fi",
|
||||
|
||||
Reference in New Issue
Block a user