mirror of
https://github.com/home-assistant/frontend.git
synced 2026-06-02 22:41:47 +00:00
Compare commits
43 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a86bab98ad | |||
| 8939dd2213 | |||
| fde1bb7d6a | |||
| 07e5aa30c6 | |||
| 3f0ec03a14 | |||
| 1bb871b9ac | |||
| 0e8783fb01 | |||
| 1d88c4465b | |||
| af2d575bf0 | |||
| 92165d776a | |||
| a8bbd8ab90 | |||
| 43ac9dbea7 | |||
| bba9eca4e9 | |||
| 40f65b1980 | |||
| 23a33b10a1 | |||
| 67a93013c7 | |||
| 1f838d7529 | |||
| ffc0435144 | |||
| 5877d69c87 | |||
| 99035cea8f | |||
| 1b441a7eec | |||
| ad49e9f7b0 | |||
| e32b15ede2 | |||
| a35b4376ea | |||
| 619f9f76ee | |||
| f771bc10db | |||
| b8889a1183 | |||
| eb6b45eaed | |||
| 31a748ed93 | |||
| 0110bdd24a | |||
| 365b712976 | |||
| 7d97dbe15b | |||
| 8bc0ea5a0b | |||
| 44948a3474 | |||
| bc51b53b4a | |||
| 67217b9dd0 | |||
| 487795b7c4 | |||
| a30e0d33f9 | |||
| 0c1b8abe03 | |||
| ce9c5149d5 | |||
| adbcdc62eb | |||
| faf872bfb8 | |||
| fe0fb2382a |
@@ -37,7 +37,7 @@ jobs:
|
||||
- name: Build resources
|
||||
run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data gather-gallery-pages
|
||||
- name: Setup lint cache
|
||||
uses: actions/cache@v4.0.2
|
||||
uses: actions/cache@v4.1.0
|
||||
with:
|
||||
path: |
|
||||
node_modules/.cache/prettier
|
||||
|
||||
@@ -111,6 +111,16 @@ export const demoEntitiesSections: DemoConfig["entities"] = (localize) =>
|
||||
friendly_name: "Living room Temperature",
|
||||
},
|
||||
},
|
||||
"sensor.living_room_humidity": {
|
||||
entity_id: "sensor.living_room_humidity",
|
||||
state: "57",
|
||||
attributes: {
|
||||
state_class: "measurement",
|
||||
unit_of_measurement: "%",
|
||||
device_class: "humidity",
|
||||
friendly_name: "Living room Humidity",
|
||||
},
|
||||
},
|
||||
"sensor.outdoor_temperature": {
|
||||
entity_id: "sensor.outdoor_temperature",
|
||||
state: "10.5",
|
||||
@@ -189,6 +199,14 @@ export const demoEntitiesSections: DemoConfig["entities"] = (localize) =>
|
||||
supported_features: 32,
|
||||
},
|
||||
},
|
||||
"binary_sensor.kitchen_motion": {
|
||||
entity_id: "light.kitchen_motion",
|
||||
state: "on",
|
||||
attributes: {
|
||||
device_class: "motion",
|
||||
friendly_name: "Kitchen motion",
|
||||
},
|
||||
},
|
||||
"light.worktop_spotlights": {
|
||||
entity_id: "light.worktop_spotlights",
|
||||
state: "off",
|
||||
@@ -423,6 +441,14 @@ export const demoEntitiesSections: DemoConfig["entities"] = (localize) =>
|
||||
supported_features: 64063,
|
||||
},
|
||||
},
|
||||
"switch.in_meeting": {
|
||||
entity_id: "switch.in_meeting",
|
||||
state: "on",
|
||||
attributes: {
|
||||
icon: "mdi:laptop-account",
|
||||
friendly_name: "In a meeting",
|
||||
},
|
||||
},
|
||||
"sensor.standing_desk_height": {
|
||||
entity_id: "sensor.standing_desk_height",
|
||||
state: "72",
|
||||
|
||||
@@ -30,12 +30,36 @@ export const demoLovelaceSections: DemoConfig["lovelace"] = (localize) => ({
|
||||
? []
|
||||
: [
|
||||
{
|
||||
title: `${localize("ui.panel.page-demo.config.sections.titles.welcome")} 👋`,
|
||||
cards: [{ type: "custom:ha-demo-card" }],
|
||||
cards: [
|
||||
{
|
||||
type: "heading",
|
||||
heading: `${localize("ui.panel.page-demo.config.sections.titles.welcome")} 👋`,
|
||||
},
|
||||
{ type: "custom:ha-demo-card" },
|
||||
],
|
||||
},
|
||||
]),
|
||||
{
|
||||
cards: [
|
||||
{
|
||||
type: "heading",
|
||||
heading: localize(
|
||||
"ui.panel.page-demo.config.sections.titles.living_room"
|
||||
),
|
||||
icon: "mdi:sofa",
|
||||
badges: [
|
||||
{
|
||||
type: "entity",
|
||||
entity: "sensor.living_room_temperature",
|
||||
color: "red",
|
||||
},
|
||||
{
|
||||
type: "entity",
|
||||
entity: "sensor.living_room_humidity",
|
||||
color: "indigo",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "tile",
|
||||
entity: "light.floor_lamp",
|
||||
@@ -54,13 +78,6 @@ export const demoLovelaceSections: DemoConfig["lovelace"] = (localize) => ({
|
||||
type: "tile",
|
||||
entity: "light.bar_lamp",
|
||||
},
|
||||
{
|
||||
graph: "line",
|
||||
type: "sensor",
|
||||
entity: "sensor.living_room_temperature",
|
||||
detail: 1,
|
||||
name: "Temperature",
|
||||
},
|
||||
{
|
||||
type: "tile",
|
||||
entity: "cover.living_room_garden_shutter",
|
||||
@@ -71,11 +88,25 @@ export const demoLovelaceSections: DemoConfig["lovelace"] = (localize) => ({
|
||||
entity: "media_player.living_room_nest_mini",
|
||||
},
|
||||
],
|
||||
title: `🛋️ ${localize("ui.panel.page-demo.config.sections.titles.living_room")} `,
|
||||
},
|
||||
{
|
||||
type: "grid",
|
||||
cards: [
|
||||
{
|
||||
type: "heading",
|
||||
heading: localize(
|
||||
"ui.panel.page-demo.config.sections.titles.kitchen"
|
||||
),
|
||||
icon: "mdi:fridge",
|
||||
badges: [
|
||||
{
|
||||
type: "entity",
|
||||
entity: "binary_sensor.kitchen_motion",
|
||||
show_state: false,
|
||||
color: "blue",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "tile",
|
||||
entity: "cover.kitchen_shutter",
|
||||
@@ -106,11 +137,17 @@ export const demoLovelaceSections: DemoConfig["lovelace"] = (localize) => ({
|
||||
entity: "media_player.kitchen_nest_audio",
|
||||
},
|
||||
],
|
||||
title: `👩🍳 ${localize("ui.panel.page-demo.config.sections.titles.kitchen")}`,
|
||||
},
|
||||
{
|
||||
type: "grid",
|
||||
cards: [
|
||||
{
|
||||
type: "heading",
|
||||
heading: localize(
|
||||
"ui.panel.page-demo.config.sections.titles.energy"
|
||||
),
|
||||
icon: "mdi:transmission-tower",
|
||||
},
|
||||
{
|
||||
type: "tile",
|
||||
entity: "binary_sensor.tesla_wall_connector_vehicle_connected",
|
||||
@@ -148,11 +185,17 @@ export const demoLovelaceSections: DemoConfig["lovelace"] = (localize) => ({
|
||||
color: "dark-grey",
|
||||
},
|
||||
],
|
||||
title: `⚡️ ${localize("ui.panel.page-demo.config.sections.titles.energy")}`,
|
||||
},
|
||||
{
|
||||
type: "grid",
|
||||
cards: [
|
||||
{
|
||||
type: "heading",
|
||||
heading: localize(
|
||||
"ui.panel.page-demo.config.sections.titles.climate"
|
||||
),
|
||||
icon: "mdi:thermometer",
|
||||
},
|
||||
{
|
||||
type: "tile",
|
||||
entity: "sun.sun",
|
||||
@@ -185,16 +228,38 @@ export const demoLovelaceSections: DemoConfig["lovelace"] = (localize) => ({
|
||||
state_content: ["preset_mode", "current_temperature"],
|
||||
},
|
||||
],
|
||||
title: `🌤️ ${localize("ui.panel.page-demo.config.sections.titles.climate")}`,
|
||||
},
|
||||
{
|
||||
type: "grid",
|
||||
cards: [
|
||||
{
|
||||
type: "heading",
|
||||
heading: localize(
|
||||
"ui.panel.page-demo.config.sections.titles.study"
|
||||
),
|
||||
icon: "mdi:desk-lamp",
|
||||
badges: [
|
||||
{
|
||||
type: "entity",
|
||||
entity: "switch.in_meeting",
|
||||
state: "on",
|
||||
state_content: "name",
|
||||
visibility: [
|
||||
{
|
||||
condition: "state",
|
||||
state: "on",
|
||||
entity: "switch.in_meeting",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "tile",
|
||||
entity: "cover.study_shutter",
|
||||
name: "Shutter",
|
||||
},
|
||||
|
||||
{
|
||||
type: "tile",
|
||||
entity: "light.study_spotlights",
|
||||
@@ -211,12 +276,23 @@ export const demoLovelaceSections: DemoConfig["lovelace"] = (localize) => ({
|
||||
color: "brown",
|
||||
icon: "mdi:desk",
|
||||
},
|
||||
{
|
||||
type: "tile",
|
||||
entity: "switch.in_meeting",
|
||||
name: "Meeting mode",
|
||||
},
|
||||
],
|
||||
title: `🧑💻 ${localize("ui.panel.page-demo.config.sections.titles.study")}`,
|
||||
},
|
||||
{
|
||||
type: "grid",
|
||||
cards: [
|
||||
{
|
||||
type: "heading",
|
||||
heading: localize(
|
||||
"ui.panel.page-demo.config.sections.titles.outdoor"
|
||||
),
|
||||
icon: "mdi:tree",
|
||||
},
|
||||
{
|
||||
type: "tile",
|
||||
entity: "light.outdoor_light",
|
||||
@@ -246,11 +322,17 @@ export const demoLovelaceSections: DemoConfig["lovelace"] = (localize) => ({
|
||||
name: "Illuminance",
|
||||
},
|
||||
],
|
||||
title: `🌳 ${localize("ui.panel.page-demo.config.sections.titles.outdoor")}`,
|
||||
},
|
||||
{
|
||||
type: "grid",
|
||||
cards: [
|
||||
{
|
||||
type: "heading",
|
||||
heading: localize(
|
||||
"ui.panel.page-demo.config.sections.titles.updates"
|
||||
),
|
||||
icon: "mdi:update",
|
||||
},
|
||||
{
|
||||
type: "tile",
|
||||
entity: "automation.home_assistant_auto_update",
|
||||
@@ -276,7 +358,6 @@ export const demoLovelaceSections: DemoConfig["lovelace"] = (localize) => ({
|
||||
icon: "mdi:home-assistant",
|
||||
},
|
||||
],
|
||||
title: `🎉 ${localize("ui.panel.page-demo.config.sections.titles.updates")}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -13,10 +13,11 @@
|
||||
<% for (const entry of es5EntryJS) { %>
|
||||
loadES5("<%= entry %>");
|
||||
<% } %>
|
||||
}
|
||||
} else {
|
||||
<% for (const entry of es5EntryJS) { %>
|
||||
loadES5("<%= entry %>");
|
||||
<% } %>
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
+13
-13
@@ -25,10 +25,10 @@
|
||||
"license": "Apache-2.0",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "7.25.6",
|
||||
"@babel/runtime": "7.25.7",
|
||||
"@braintree/sanitize-url": "7.1.0",
|
||||
"@codemirror/autocomplete": "6.18.1",
|
||||
"@codemirror/commands": "6.6.2",
|
||||
"@codemirror/commands": "6.7.0",
|
||||
"@codemirror/language": "6.10.3",
|
||||
"@codemirror/legacy-modes": "6.4.1",
|
||||
"@codemirror/search": "6.5.6",
|
||||
@@ -89,8 +89,8 @@
|
||||
"@polymer/polymer": "3.5.1",
|
||||
"@replit/codemirror-indentation-markers": "6.5.3",
|
||||
"@thomasloven/round-slider": "0.6.0",
|
||||
"@vaadin/combo-box": "24.4.10",
|
||||
"@vaadin/vaadin-themable-mixin": "24.4.10",
|
||||
"@vaadin/combo-box": "24.4.11",
|
||||
"@vaadin/vaadin-themable-mixin": "24.4.11",
|
||||
"@vibrant/color": "3.2.1-alpha.1",
|
||||
"@vibrant/core": "3.2.1-alpha.1",
|
||||
"@vibrant/quantizer-mmcq": "3.2.1-alpha.1",
|
||||
@@ -104,7 +104,7 @@
|
||||
"core-js": "3.38.1",
|
||||
"cropperjs": "1.6.2",
|
||||
"date-fns": "4.1.0",
|
||||
"date-fns-tz": "3.1.3",
|
||||
"date-fns-tz": "3.2.0",
|
||||
"deep-clone-simple": "1.1.1",
|
||||
"deep-freeze": "0.0.1",
|
||||
"dialog-polyfill": "0.5.6",
|
||||
@@ -151,12 +151,12 @@
|
||||
"xss": "1.0.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.25.2",
|
||||
"@babel/core": "7.25.7",
|
||||
"@babel/helper-define-polyfill-provider": "0.6.2",
|
||||
"@babel/plugin-proposal-decorators": "7.24.7",
|
||||
"@babel/plugin-transform-runtime": "7.25.4",
|
||||
"@babel/preset-env": "7.25.4",
|
||||
"@babel/preset-typescript": "7.24.7",
|
||||
"@babel/plugin-proposal-decorators": "7.25.7",
|
||||
"@babel/plugin-transform-runtime": "7.25.7",
|
||||
"@babel/preset-env": "7.25.7",
|
||||
"@babel/preset-typescript": "7.25.7",
|
||||
"@bundle-stats/plugin-webpack-filter": "4.15.1",
|
||||
"@koa/cors": "5.0.0",
|
||||
"@lokalise/node-api": "12.7.0",
|
||||
@@ -195,17 +195,17 @@
|
||||
"babel-plugin-template-html-minifier": "4.1.0",
|
||||
"browserslist-useragent-regexp": "4.1.3",
|
||||
"chai": "5.1.1",
|
||||
"del": "7.1.0",
|
||||
"del": "8.0.0",
|
||||
"eslint": "8.57.1",
|
||||
"eslint-config-airbnb-base": "15.0.0",
|
||||
"eslint-config-airbnb-typescript": "18.0.0",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
"eslint-import-resolver-webpack": "0.13.9",
|
||||
"eslint-plugin-import": "2.30.0",
|
||||
"eslint-plugin-import": "2.31.0",
|
||||
"eslint-plugin-lit": "1.15.0",
|
||||
"eslint-plugin-lit-a11y": "4.1.4",
|
||||
"eslint-plugin-unused-imports": "4.1.4",
|
||||
"eslint-plugin-wc": "2.1.1",
|
||||
"eslint-plugin-wc": "2.2.0",
|
||||
"fancy-log": "2.0.0",
|
||||
"fs-extra": "11.2.0",
|
||||
"glob": "11.0.0",
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "home-assistant-frontend"
|
||||
version = "20241002.1"
|
||||
version = "20241010.0"
|
||||
license = {text = "Apache-2.0"}
|
||||
description = "The Home Assistant frontend"
|
||||
readme = "README.md"
|
||||
|
||||
+5
-1
@@ -18,5 +18,9 @@ if [[ -n "$DEVCONTAINER" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! command -v yarn &> /dev/null; then
|
||||
echo "Error: yarn not found. Please install it following the official instructions: https://yarnpkg.com/getting-started/install" >&2
|
||||
exit 1
|
||||
fi
|
||||
# Install node modules
|
||||
yarn install
|
||||
yarn install
|
||||
|
||||
@@ -20,6 +20,15 @@ function findNestedItem(
|
||||
}, obj);
|
||||
}
|
||||
|
||||
function updateNestedItem(obj: any, path: ItemPath): any {
|
||||
const lastKey = path.pop()!;
|
||||
const parent = findNestedItem(obj, path);
|
||||
parent[lastKey] = Array.isArray(parent[lastKey])
|
||||
? [...parent[lastKey]]
|
||||
: [parent[lastKey]];
|
||||
return obj;
|
||||
}
|
||||
|
||||
export function nestedArrayMove<A>(
|
||||
obj: A,
|
||||
oldIndex: number,
|
||||
@@ -27,14 +36,18 @@ export function nestedArrayMove<A>(
|
||||
oldPath?: ItemPath,
|
||||
newPath?: ItemPath
|
||||
): A {
|
||||
const newObj = (Array.isArray(obj) ? [...obj] : { ...obj }) as A;
|
||||
let newObj = (Array.isArray(obj) ? [...obj] : { ...obj }) as A;
|
||||
|
||||
if (oldPath) {
|
||||
newObj = updateNestedItem(newObj, [...oldPath]);
|
||||
}
|
||||
if (newPath) {
|
||||
newObj = updateNestedItem(newObj, [...newPath]);
|
||||
}
|
||||
|
||||
const from = oldPath ? findNestedItem(newObj, oldPath) : newObj;
|
||||
const to = newPath ? findNestedItem(newObj, newPath, true) : newObj;
|
||||
|
||||
if (!Array.isArray(from) || !Array.isArray(to)) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
const item = from.splice(oldIndex, 1)[0];
|
||||
to.splice(newIndex, 0, item);
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@ export class HaColorPicker extends LitElement {
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
@query("ha-select") private _select!: HaSelect;
|
||||
@query("ha-select") private _select?: HaSelect;
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
// Refresh layout options when the field is connected to the DOM to ensure current value displayed
|
||||
this._select.layoutOptions();
|
||||
this._select?.layoutOptions();
|
||||
}
|
||||
|
||||
private _valueSelected(ev) {
|
||||
|
||||
@@ -68,7 +68,7 @@ export class HaGridSizeEditor extends LitElement {
|
||||
.min=${columnMin}
|
||||
.max=${columnMax}
|
||||
.range=${this.columns}
|
||||
.value=${fullWidth ? this.columns : columnValue}
|
||||
.value=${fullWidth ? this.columns : this.value?.columns}
|
||||
@value-changed=${this._valueChanged}
|
||||
@slider-moved=${this._sliderMoved}
|
||||
.disabled=${disabledColumns}
|
||||
@@ -83,7 +83,7 @@ export class HaGridSizeEditor extends LitElement {
|
||||
.max=${rowMax}
|
||||
.range=${this.rows}
|
||||
vertical
|
||||
.value=${rowValue}
|
||||
.value=${autoHeight ? rowMin : this.value?.rows}
|
||||
@value-changed=${this._valueChanged}
|
||||
@slider-moved=${this._sliderMoved}
|
||||
.disabled=${disabledRows}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-console */
|
||||
import {
|
||||
css,
|
||||
CSSResultGroup,
|
||||
@@ -6,11 +7,14 @@ import {
|
||||
PropertyValues,
|
||||
TemplateResult,
|
||||
} from "lit";
|
||||
import { customElement, property, state, query } from "lit/decorators";
|
||||
import { isComponentLoaded } from "../common/config/is_component_loaded";
|
||||
import { customElement, property, query, state } from "lit/decorators";
|
||||
import { ifDefined } from "lit/directives/if-defined";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import { handleWebRtcOffer, WebRtcAnswer } from "../data/camera";
|
||||
import { fetchWebRtcSettings } from "../data/rtsp_to_webrtc";
|
||||
import {
|
||||
fetchWebRtcClientConfiguration,
|
||||
handleWebRtcOffer,
|
||||
WebRtcAnswer,
|
||||
} from "../data/camera";
|
||||
import type { HomeAssistant } from "../types";
|
||||
import "./ha-alert";
|
||||
|
||||
@@ -37,12 +41,11 @@ class HaWebRtcPlayer extends LitElement {
|
||||
@property({ type: Boolean, attribute: "playsinline" })
|
||||
public playsInline = false;
|
||||
|
||||
@property() public posterUrl!: string;
|
||||
@property({ attribute: "poster-url" }) public posterUrl?: string;
|
||||
|
||||
@state() private _error?: string;
|
||||
|
||||
// don't cache this, as we remove it on disconnects
|
||||
@query("#remote-stream") private _videoEl!: HTMLVideoElement;
|
||||
@query("#remote-stream", true) private _videoEl!: HTMLVideoElement;
|
||||
|
||||
private _peerConnection?: RTCPeerConnection;
|
||||
|
||||
@@ -59,7 +62,7 @@ class HaWebRtcPlayer extends LitElement {
|
||||
.muted=${this.muted}
|
||||
?playsinline=${this.playsInline}
|
||||
?controls=${this.controls}
|
||||
.poster=${this.posterUrl}
|
||||
poster=${ifDefined(this.posterUrl)}
|
||||
@loadeddata=${this._loadedData}
|
||||
></video>
|
||||
`;
|
||||
@@ -81,20 +84,30 @@ class HaWebRtcPlayer extends LitElement {
|
||||
if (!changedProperties.has("entityid")) {
|
||||
return;
|
||||
}
|
||||
if (!this._videoEl) {
|
||||
return;
|
||||
}
|
||||
this._startWebRtc();
|
||||
}
|
||||
|
||||
private async _startWebRtc(): Promise<void> {
|
||||
console.time("WebRTC");
|
||||
|
||||
this._error = undefined;
|
||||
|
||||
const configuration = await this._fetchPeerConfiguration();
|
||||
const peerConnection = new RTCPeerConnection(configuration);
|
||||
// Some cameras (such as nest) require a data channel to establish a stream
|
||||
// however, not used by any integrations.
|
||||
peerConnection.createDataChannel("dataSendChannel");
|
||||
console.timeLog("WebRTC", "start clientConfig");
|
||||
|
||||
const clientConfig = await fetchWebRtcClientConfiguration(
|
||||
this.hass,
|
||||
this.entityid
|
||||
);
|
||||
|
||||
console.timeLog("WebRTC", "end clientConfig", clientConfig);
|
||||
|
||||
const peerConnection = new RTCPeerConnection(clientConfig.configuration);
|
||||
|
||||
if (clientConfig.dataChannel) {
|
||||
// Some cameras (such as nest) require a data channel to establish a stream
|
||||
// however, not used by any integrations.
|
||||
peerConnection.createDataChannel(clientConfig.dataChannel);
|
||||
}
|
||||
peerConnection.addTransceiver("audio", { direction: "recvonly" });
|
||||
peerConnection.addTransceiver("video", { direction: "recvonly" });
|
||||
|
||||
@@ -102,30 +115,48 @@ class HaWebRtcPlayer extends LitElement {
|
||||
offerToReceiveAudio: true,
|
||||
offerToReceiveVideo: true,
|
||||
};
|
||||
|
||||
console.timeLog("WebRTC", "start createOffer", offerOptions);
|
||||
|
||||
const offer: RTCSessionDescriptionInit =
|
||||
await peerConnection.createOffer(offerOptions);
|
||||
|
||||
console.timeLog("WebRTC", "end createOffer", offer);
|
||||
|
||||
console.timeLog("WebRTC", "start setLocalDescription");
|
||||
|
||||
await peerConnection.setLocalDescription(offer);
|
||||
|
||||
console.timeLog("WebRTC", "end setLocalDescription");
|
||||
|
||||
console.timeLog("WebRTC", "start iceResolver");
|
||||
|
||||
let candidates = ""; // Build an Offer SDP string with ice candidates
|
||||
const iceResolver = new Promise<void>((resolve) => {
|
||||
peerConnection.addEventListener("icecandidate", async (event) => {
|
||||
peerConnection.addEventListener("icecandidate", (event) => {
|
||||
if (!event.candidate?.candidate) {
|
||||
resolve(); // Gathering complete
|
||||
return;
|
||||
}
|
||||
console.timeLog("WebRTC", "iceResolver candidate", event.candidate);
|
||||
candidates += `a=${event.candidate.candidate}\r\n`;
|
||||
});
|
||||
});
|
||||
await iceResolver;
|
||||
|
||||
console.timeLog("WebRTC", "end iceResolver", candidates);
|
||||
|
||||
const offer_sdp = offer.sdp! + candidates;
|
||||
|
||||
let webRtcAnswer: WebRtcAnswer;
|
||||
try {
|
||||
console.timeLog("WebRTC", "start WebRTCOffer", offer_sdp);
|
||||
webRtcAnswer = await handleWebRtcOffer(
|
||||
this.hass,
|
||||
this.entityid,
|
||||
offer_sdp
|
||||
);
|
||||
console.timeLog("WebRTC", "end webRtcOffer", webRtcAnswer);
|
||||
} catch (err: any) {
|
||||
this._error = "Failed to start WebRTC stream: " + err.message;
|
||||
peerConnection.close();
|
||||
@@ -135,6 +166,7 @@ class HaWebRtcPlayer extends LitElement {
|
||||
// Setup callbacks to render remote stream once media tracks are discovered.
|
||||
const remoteStream = new MediaStream();
|
||||
peerConnection.addEventListener("track", (event) => {
|
||||
console.timeLog("WebRTC", "track", event);
|
||||
remoteStream.addTrack(event.track);
|
||||
this._videoEl.srcObject = remoteStream;
|
||||
});
|
||||
@@ -146,7 +178,9 @@ class HaWebRtcPlayer extends LitElement {
|
||||
sdp: webRtcAnswer.answer,
|
||||
});
|
||||
try {
|
||||
console.timeLog("WebRTC", "start setRemoteDescription", remoteDesc);
|
||||
await peerConnection.setRemoteDescription(remoteDesc);
|
||||
console.timeLog("WebRTC", "end setRemoteDescription");
|
||||
} catch (err: any) {
|
||||
this._error = "Failed to connect WebRTC stream: " + err.message;
|
||||
peerConnection.close();
|
||||
@@ -155,23 +189,6 @@ class HaWebRtcPlayer extends LitElement {
|
||||
this._peerConnection = peerConnection;
|
||||
}
|
||||
|
||||
private async _fetchPeerConfiguration(): Promise<RTCConfiguration> {
|
||||
if (!isComponentLoaded(this.hass!, "rtsp_to_webrtc")) {
|
||||
return {};
|
||||
}
|
||||
const settings = await fetchWebRtcSettings(this.hass!);
|
||||
if (!settings || !settings.stun_server) {
|
||||
return {};
|
||||
}
|
||||
return {
|
||||
iceServers: [
|
||||
{
|
||||
urls: [`stun:${settings.stun_server!}`],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
private _cleanUp() {
|
||||
if (this._remoteStream) {
|
||||
this._remoteStream.getTracks().forEach((track) => {
|
||||
@@ -190,6 +207,8 @@ class HaWebRtcPlayer extends LitElement {
|
||||
}
|
||||
|
||||
private _loadedData() {
|
||||
console.timeLog("WebRTC", "loadedData");
|
||||
console.timeEnd("WebRTC");
|
||||
// @ts-ignore
|
||||
fireEvent(this, "load");
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { Context, HomeAssistant } from "../types";
|
||||
import { BlueprintInput } from "./blueprint";
|
||||
import { DeviceCondition, DeviceTrigger } from "./device_automation";
|
||||
import { Action, MODES, migrateAutomationAction } from "./script";
|
||||
import { createSearchParam } from "../common/url/search-params";
|
||||
|
||||
export const AUTOMATION_DEFAULT_MODE: (typeof MODES)[number] = "single";
|
||||
export const AUTOMATION_DEFAULT_MAX = 10;
|
||||
@@ -462,9 +463,13 @@ export const flattenTriggers = (
|
||||
return flatTriggers;
|
||||
};
|
||||
|
||||
export const showAutomationEditor = (data?: Partial<AutomationConfig>) => {
|
||||
export const showAutomationEditor = (
|
||||
data?: Partial<AutomationConfig>,
|
||||
expanded?: boolean
|
||||
) => {
|
||||
initialAutomationEditorData = data;
|
||||
navigate("/config/automation/edit/new");
|
||||
const params = expanded ? `?${createSearchParam({ expanded: "1" })}` : "";
|
||||
navigate(`/config/automation/edit/new${params}`);
|
||||
};
|
||||
|
||||
export const duplicateAutomation = (config: AutomationConfig) => {
|
||||
|
||||
@@ -133,3 +133,17 @@ export const isCameraMediaSource = (mediaContentId: string) =>
|
||||
|
||||
export const getEntityIdFromCameraMediaSource = (mediaContentId: string) =>
|
||||
mediaContentId.substring(CAMERA_MEDIA_SOURCE_PREFIX.length);
|
||||
|
||||
export interface WebRTCClientConfiguration {
|
||||
configuration: RTCConfiguration;
|
||||
dataChannel?: string;
|
||||
}
|
||||
|
||||
export const fetchWebRtcClientConfiguration = async (
|
||||
hass: HomeAssistant,
|
||||
entityId: string
|
||||
) =>
|
||||
hass.callWS<WebRTCClientConfiguration>({
|
||||
type: "camera/webrtc/get_client_config",
|
||||
entity_id: entityId,
|
||||
});
|
||||
|
||||
@@ -28,6 +28,7 @@ export interface UrlActionConfig extends BaseActionConfig {
|
||||
|
||||
export interface MoreInfoActionConfig extends BaseActionConfig {
|
||||
action: "more-info";
|
||||
entity_id?: string;
|
||||
}
|
||||
|
||||
export interface AssistActionConfig extends BaseActionConfig {
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
import type { Condition } from "../../../panels/lovelace/common/validate-condition";
|
||||
import type { LovelaceLayoutOptions } from "../../../panels/lovelace/types";
|
||||
import type {
|
||||
LovelaceGridOptions,
|
||||
LovelaceLayoutOptions,
|
||||
} from "../../../panels/lovelace/types";
|
||||
|
||||
export interface LovelaceCardConfig {
|
||||
index?: number;
|
||||
view_index?: number;
|
||||
view_layout?: any;
|
||||
/** @deprecated Use `grid_options` instead */
|
||||
layout_options?: LovelaceLayoutOptions;
|
||||
grid_options?: LovelaceGridOptions;
|
||||
type: string;
|
||||
[key: string]: any;
|
||||
visibility?: Condition[];
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import { HomeAssistant } from "../types";
|
||||
|
||||
export interface WebRtcSettings {
|
||||
stun_server?: string;
|
||||
}
|
||||
|
||||
export const fetchWebRtcSettings = async (hass: HomeAssistant) =>
|
||||
hass.callWS<WebRtcSettings>({
|
||||
type: "rtsp_to_webrtc/get_settings",
|
||||
});
|
||||
+7
-2
@@ -28,6 +28,7 @@ import {
|
||||
} from "./automation";
|
||||
import { BlueprintInput } from "./blueprint";
|
||||
import { computeObjectId } from "../common/entity/compute_object_id";
|
||||
import { createSearchParam } from "../common/url/search-params";
|
||||
|
||||
export const MODES = ["single", "restart", "queued", "parallel"] as const;
|
||||
export const MODES_MAX = ["queued", "parallel"] as const;
|
||||
@@ -347,9 +348,13 @@ export const getScriptStateConfig = (hass: HomeAssistant, entity_id: string) =>
|
||||
entity_id,
|
||||
});
|
||||
|
||||
export const showScriptEditor = (data?: Partial<ScriptConfig>) => {
|
||||
export const showScriptEditor = (
|
||||
data?: Partial<ScriptConfig>,
|
||||
expanded?: boolean
|
||||
) => {
|
||||
inititialScriptEditorData = data;
|
||||
navigate("/config/script/edit/new");
|
||||
const params = expanded ? `?${createSearchParam({ expanded: "1" })}` : "";
|
||||
navigate(`/config/script/edit/new${params}`);
|
||||
};
|
||||
|
||||
export const getScriptEditorInitData = () => {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ export interface ThreadDataSet {
|
||||
channel: number | null;
|
||||
created: string;
|
||||
dataset_id: string;
|
||||
extended_pan_id: string | null;
|
||||
extended_pan_id: string;
|
||||
network_name: string;
|
||||
pan_id: string | null;
|
||||
preferred_border_agent_id: string | null;
|
||||
|
||||
@@ -9,23 +9,15 @@ import {
|
||||
html,
|
||||
nothing,
|
||||
} from "lit";
|
||||
import { customElement, state } from "lit/decorators";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { HASSDomEvent, fireEvent } from "../../common/dom/fire_event";
|
||||
import "../../components/ha-circular-progress";
|
||||
import "../../components/ha-dialog";
|
||||
import "../../components/ha-icon-button";
|
||||
import {
|
||||
AreaRegistryEntry,
|
||||
subscribeAreaRegistry,
|
||||
} from "../../data/area_registry";
|
||||
import {
|
||||
DataEntryFlowStep,
|
||||
subscribeDataEntryFlowProgressed,
|
||||
} from "../../data/data_entry_flow";
|
||||
import {
|
||||
DeviceRegistryEntry,
|
||||
subscribeDeviceRegistry,
|
||||
} from "../../data/device_registry";
|
||||
import { haStyleDialog } from "../../resources/styles";
|
||||
import type { HomeAssistant } from "../../types";
|
||||
import { documentationUrl } from "../../util/documentation-url";
|
||||
@@ -62,7 +54,7 @@ declare global {
|
||||
|
||||
@customElement("dialog-data-entry-flow")
|
||||
class DataEntryFlowDialog extends LitElement {
|
||||
public hass!: HomeAssistant;
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@state() private _params?: DataEntryFlowDialogParams;
|
||||
|
||||
@@ -76,16 +68,8 @@ class DataEntryFlowDialog extends LitElement {
|
||||
// Null means we need to pick a config flow
|
||||
| null;
|
||||
|
||||
@state() private _devices?: DeviceRegistryEntry[];
|
||||
|
||||
@state() private _areas?: AreaRegistryEntry[];
|
||||
|
||||
@state() private _handler?: string;
|
||||
|
||||
private _unsubAreas?: UnsubscribeFunc;
|
||||
|
||||
private _unsubDevices?: UnsubscribeFunc;
|
||||
|
||||
private _unsubDataEntryFlowProgressed?: Promise<UnsubscribeFunc>;
|
||||
|
||||
public async showDialog(params: DataEntryFlowDialogParams): Promise<void> {
|
||||
@@ -183,16 +167,7 @@ class DataEntryFlowDialog extends LitElement {
|
||||
this._loading = undefined;
|
||||
this._step = undefined;
|
||||
this._params = undefined;
|
||||
this._devices = undefined;
|
||||
this._handler = undefined;
|
||||
if (this._unsubAreas) {
|
||||
this._unsubAreas();
|
||||
this._unsubAreas = undefined;
|
||||
}
|
||||
if (this._unsubDevices) {
|
||||
this._unsubDevices();
|
||||
this._unsubDevices = undefined;
|
||||
}
|
||||
if (this._unsubDataEntryFlowProgressed) {
|
||||
this._unsubDataEntryFlowProgressed.then((unsub) => {
|
||||
unsub();
|
||||
@@ -309,25 +284,13 @@ class DataEntryFlowDialog extends LitElement {
|
||||
.hass=${this.hass}
|
||||
></step-flow-menu>
|
||||
`
|
||||
: this._devices === undefined ||
|
||||
this._areas === undefined
|
||||
? // When it's a create entry result, we will fetch device & area registry
|
||||
html`
|
||||
<step-flow-loading
|
||||
.flowConfig=${this._params.flowConfig}
|
||||
.hass=${this.hass}
|
||||
loadingReason="loading_devices_areas"
|
||||
></step-flow-loading>
|
||||
`
|
||||
: html`
|
||||
<step-flow-create-entry
|
||||
.flowConfig=${this._params.flowConfig}
|
||||
.step=${this._step}
|
||||
.hass=${this.hass}
|
||||
.devices=${this._devices}
|
||||
.areas=${this._areas}
|
||||
></step-flow-create-entry>
|
||||
`}
|
||||
: html`
|
||||
<step-flow-create-entry
|
||||
.flowConfig=${this._params.flowConfig}
|
||||
.step=${this._step}
|
||||
.hass=${this.hass}
|
||||
></step-flow-create-entry>
|
||||
`}
|
||||
`}
|
||||
</div>
|
||||
</ha-dialog>
|
||||
@@ -351,32 +314,6 @@ class DataEntryFlowDialog extends LitElement {
|
||||
// external and progress step will send update event from the backend, so we should subscribe to them
|
||||
this._subscribeDataEntryFlowProgressed();
|
||||
}
|
||||
if (this._step.type === "create_entry") {
|
||||
if (this._step.result && this._params!.flowConfig.loadDevicesAndAreas) {
|
||||
this._fetchDevices(this._step.result.entry_id);
|
||||
this._fetchAreas();
|
||||
} else {
|
||||
this._devices = [];
|
||||
this._areas = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async _fetchDevices(configEntryId) {
|
||||
this._unsubDevices = subscribeDeviceRegistry(
|
||||
this.hass.connection,
|
||||
(devices) => {
|
||||
this._devices = devices.filter((device) =>
|
||||
device.config_entries.includes(configEntryId)
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private async _fetchAreas() {
|
||||
this._unsubAreas = subscribeAreaRegistry(this.hass.connection, (areas) => {
|
||||
this._areas = areas;
|
||||
});
|
||||
}
|
||||
|
||||
private async _processStep(
|
||||
|
||||
@@ -20,7 +20,7 @@ export const showConfigFlowDialog = (
|
||||
): void =>
|
||||
showFlowDialog(element, dialogParams, {
|
||||
flowType: "config_flow",
|
||||
loadDevicesAndAreas: true,
|
||||
showDevices: true,
|
||||
createFlow: async (hass, handler) => {
|
||||
const [step] = await Promise.all([
|
||||
createConfigFlow(hass, handler, dialogParams.entryId),
|
||||
|
||||
@@ -17,7 +17,7 @@ import type { HomeAssistant } from "../../types";
|
||||
export interface FlowConfig {
|
||||
flowType: FlowType;
|
||||
|
||||
loadDevicesAndAreas: boolean;
|
||||
showDevices: boolean;
|
||||
|
||||
createFlow(hass: HomeAssistant, handler: string): Promise<DataEntryFlowStep>;
|
||||
|
||||
@@ -134,8 +134,7 @@ export interface FlowConfig {
|
||||
export type LoadingReason =
|
||||
| "loading_handlers"
|
||||
| "loading_flow"
|
||||
| "loading_step"
|
||||
| "loading_devices_areas";
|
||||
| "loading_step";
|
||||
|
||||
export interface DataEntryFlowDialogParams {
|
||||
startFlowHandler?: string;
|
||||
|
||||
@@ -29,7 +29,7 @@ export const showOptionsFlowDialog = (
|
||||
},
|
||||
{
|
||||
flowType: "options_flow",
|
||||
loadDevicesAndAreas: false,
|
||||
showDevices: false,
|
||||
createFlow: async (hass, handler) => {
|
||||
const [step] = await Promise.all([
|
||||
createOptionsFlow(hass, handler),
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
CSSResultGroup,
|
||||
html,
|
||||
LitElement,
|
||||
nothing,
|
||||
PropertyValues,
|
||||
TemplateResult,
|
||||
} from "lit";
|
||||
@@ -34,7 +35,16 @@ class StepFlowCreateEntry extends LitElement {
|
||||
|
||||
@property({ attribute: false }) public step!: DataEntryFlowStepCreateEntry;
|
||||
|
||||
@property({ attribute: false }) public devices!: DeviceRegistryEntry[];
|
||||
private _devices = memoizeOne(
|
||||
(
|
||||
showDevices: boolean,
|
||||
devices: DeviceRegistryEntry[],
|
||||
entry_id?: string
|
||||
) =>
|
||||
showDevices && entry_id
|
||||
? devices.filter((device) => device.config_entries.includes(entry_id))
|
||||
: []
|
||||
);
|
||||
|
||||
private _deviceEntities = memoizeOne(
|
||||
(
|
||||
@@ -50,35 +60,48 @@ class StepFlowCreateEntry extends LitElement {
|
||||
);
|
||||
|
||||
protected willUpdate(changedProps: PropertyValues) {
|
||||
if (!changedProps.has("devices") && !changedProps.has("hass")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const devices = this._devices(
|
||||
this.flowConfig.showDevices,
|
||||
Object.values(this.hass.devices),
|
||||
this.step.result?.entry_id
|
||||
);
|
||||
|
||||
if (
|
||||
(changedProps.has("devices") || changedProps.has("hass")) &&
|
||||
this.devices.length === 1
|
||||
devices.length !== 1 ||
|
||||
devices[0].primary_config_entry !== this.step.result?.entry_id
|
||||
) {
|
||||
// integration_type === "device"
|
||||
const assistSatellites = this._deviceEntities(
|
||||
this.devices[0].id,
|
||||
Object.values(this.hass.entities),
|
||||
"assist_satellite"
|
||||
);
|
||||
if (
|
||||
assistSatellites.length &&
|
||||
assistSatellites.some((satellite) =>
|
||||
assistSatelliteSupportsSetupFlow(
|
||||
this.hass.states[satellite.entity_id]
|
||||
)
|
||||
)
|
||||
) {
|
||||
this._flowDone();
|
||||
showVoiceAssistantSetupDialog(this, {
|
||||
deviceId: this.devices[0].id,
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const assistSatellites = this._deviceEntities(
|
||||
devices[0].id,
|
||||
Object.values(this.hass.entities),
|
||||
"assist_satellite"
|
||||
);
|
||||
if (
|
||||
assistSatellites.length &&
|
||||
assistSatellites.some((satellite) =>
|
||||
assistSatelliteSupportsSetupFlow(this.hass.states[satellite.entity_id])
|
||||
)
|
||||
) {
|
||||
this._flowDone();
|
||||
showVoiceAssistantSetupDialog(this, {
|
||||
deviceId: devices[0].id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
const localize = this.hass.localize;
|
||||
|
||||
const devices = this._devices(
|
||||
this.flowConfig.showDevices,
|
||||
Object.values(this.hass.devices),
|
||||
this.step.result?.entry_id
|
||||
);
|
||||
return html`
|
||||
<h2>${localize("ui.panel.config.integrations.config_flow.success")}!</h2>
|
||||
<div class="content">
|
||||
@@ -89,9 +112,9 @@ class StepFlowCreateEntry extends LitElement {
|
||||
"ui.panel.config.integrations.config_flow.not_loaded"
|
||||
)}</span
|
||||
>`
|
||||
: ""}
|
||||
${this.devices.length === 0
|
||||
? ""
|
||||
: nothing}
|
||||
${devices.length === 0
|
||||
? nothing
|
||||
: html`
|
||||
<p>
|
||||
${localize(
|
||||
@@ -99,7 +122,7 @@ class StepFlowCreateEntry extends LitElement {
|
||||
)}:
|
||||
</p>
|
||||
<div class="devices">
|
||||
${this.devices.map(
|
||||
${devices.map(
|
||||
(device) => html`
|
||||
<div class="device">
|
||||
<div>
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
updateReleaseNotes,
|
||||
} from "../../../data/update";
|
||||
import type { HomeAssistant } from "../../../types";
|
||||
import { showAlertDialog } from "../../generic/show-dialog-box";
|
||||
|
||||
@customElement("more-info-update")
|
||||
class MoreInfoUpdate extends LitElement {
|
||||
@@ -127,29 +128,27 @@ class MoreInfoUpdate extends LitElement {
|
||||
</ha-formfield> `
|
||||
: ""}
|
||||
<div class="actions">
|
||||
${this.stateObj.attributes.auto_update
|
||||
? ""
|
||||
: this.stateObj.state === BINARY_STATE_OFF &&
|
||||
this.stateObj.attributes.skipped_version
|
||||
? html`
|
||||
<mwc-button @click=${this._handleClearSkipped}>
|
||||
${this.hass.localize(
|
||||
"ui.dialogs.more_info_control.update.clear_skipped"
|
||||
)}
|
||||
</mwc-button>
|
||||
`
|
||||
: html`
|
||||
<mwc-button
|
||||
@click=${this._handleSkip}
|
||||
.disabled=${skippedVersion ||
|
||||
this.stateObj.state === BINARY_STATE_OFF ||
|
||||
updateIsInstalling(this.stateObj)}
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.dialogs.more_info_control.update.skip"
|
||||
)}
|
||||
</mwc-button>
|
||||
`}
|
||||
${this.stateObj.state === BINARY_STATE_OFF &&
|
||||
this.stateObj.attributes.skipped_version
|
||||
? html`
|
||||
<mwc-button @click=${this._handleClearSkipped}>
|
||||
${this.hass.localize(
|
||||
"ui.dialogs.more_info_control.update.clear_skipped"
|
||||
)}
|
||||
</mwc-button>
|
||||
`
|
||||
: html`
|
||||
<mwc-button
|
||||
@click=${this._handleSkip}
|
||||
.disabled=${skippedVersion ||
|
||||
this.stateObj.state === BINARY_STATE_OFF ||
|
||||
updateIsInstalling(this.stateObj)}
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.dialogs.more_info_control.update.skip"
|
||||
)}
|
||||
</mwc-button>
|
||||
`}
|
||||
${supportsFeature(this.stateObj, UpdateEntityFeature.INSTALL)
|
||||
? html`
|
||||
<mwc-button
|
||||
@@ -211,6 +210,17 @@ class MoreInfoUpdate extends LitElement {
|
||||
}
|
||||
|
||||
private _handleSkip(): void {
|
||||
if (this.stateObj!.attributes.auto_update) {
|
||||
showAlertDialog(this, {
|
||||
title: this.hass.localize(
|
||||
"ui.dialogs.more_info_control.update.auto_update_enabled_title"
|
||||
),
|
||||
text: this.hass.localize(
|
||||
"ui.dialogs.more_info_control.update.auto_update_enabled_text"
|
||||
),
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.hass.callService("update", "skip", {
|
||||
entity_id: this.stateObj!.entity_id,
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import { css, html, LitElement, nothing, PropertyValues } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { fireEvent } from "../../common/dom/fire_event";
|
||||
import "../../components/ha-circular-progress";
|
||||
import { OFF, ON, UNAVAILABLE } from "../../data/entity";
|
||||
import { OFF, ON, UNAVAILABLE, UNKNOWN } from "../../data/entity";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import { AssistantSetupStyles } from "./styles";
|
||||
|
||||
@@ -32,10 +32,11 @@ export class HaVoiceAssistantSetupStepUpdate extends LitElement {
|
||||
if (
|
||||
(oldState?.state === UNAVAILABLE &&
|
||||
newState?.state !== UNAVAILABLE) ||
|
||||
(oldState?.state === OFF && newState?.state === ON)
|
||||
(oldState?.state !== ON && newState?.state === ON)
|
||||
) {
|
||||
// Device is rebooted, let's move on
|
||||
this._tryUpdate(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,7 +59,7 @@ export class HaVoiceAssistantSetupStepUpdate extends LitElement {
|
||||
return html`<div class="content">
|
||||
<img src="/static/icons/casita/loading.png" />
|
||||
<h1>
|
||||
${stateObj.state === OFF
|
||||
${stateObj.state === OFF || stateObj.state === UNKNOWN
|
||||
? "Checking for updates"
|
||||
: "Updating your voice assistant"}
|
||||
</h1>
|
||||
@@ -88,10 +89,7 @@ export class HaVoiceAssistantSetupStepUpdate extends LitElement {
|
||||
return;
|
||||
}
|
||||
const updateEntity = this.hass.states[this.updateEntityId];
|
||||
if (
|
||||
updateEntity &&
|
||||
this.hass.states[updateEntity.entity_id].state === "on"
|
||||
) {
|
||||
if (updateEntity && this.hass.states[updateEntity.entity_id].state === ON) {
|
||||
this._updated = true;
|
||||
await this.hass.callService(
|
||||
"update",
|
||||
|
||||
@@ -141,9 +141,10 @@ interface EMOutgoingMessageImprovScan extends EMMessage {
|
||||
interface EMOutgoingMessageThreadStoreInPlatformKeychain extends EMMessage {
|
||||
type: "thread/store_in_platform_keychain";
|
||||
payload: {
|
||||
mac_extended_address: string;
|
||||
border_agent_id: string;
|
||||
mac_extended_address: string | null;
|
||||
border_agent_id: string | null;
|
||||
active_operational_dataset: string;
|
||||
extended_pan_id: string;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +156,15 @@ export default class HaAutomationAction extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
public expandAll() {
|
||||
const rows = this.shadowRoot!.querySelectorAll<HaAutomationActionRow>(
|
||||
"ha-automation-action-row"
|
||||
)!;
|
||||
rows.forEach((row) => {
|
||||
row.expand();
|
||||
});
|
||||
}
|
||||
|
||||
private _addActionDialog() {
|
||||
showAddAutomationElementDialog(this, {
|
||||
type: "action",
|
||||
|
||||
@@ -55,12 +55,12 @@ export class HaSceneAction extends LitElement implements ActionElement {
|
||||
fireEvent(this, "value-changed", {
|
||||
value: {
|
||||
...this.action,
|
||||
service: "scene.turn_on",
|
||||
action: "scene.turn_on",
|
||||
target: {
|
||||
entity_id: ev.detail.value,
|
||||
},
|
||||
metadata: {},
|
||||
},
|
||||
} as SceneAction,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export class HaPlayMediaAction extends LitElement implements ActionElement {
|
||||
fireEvent(this, "value-changed", {
|
||||
value: {
|
||||
...this.action,
|
||||
service: "media_player.play_media",
|
||||
action: "media_player.play_media",
|
||||
target: { entity_id: ev.detail.value.entity_id },
|
||||
data: {
|
||||
media_content_id: ev.detail.value.media_content_id,
|
||||
|
||||
@@ -117,6 +117,7 @@ export class HaServiceAction extends LitElement implements ActionElement {
|
||||
.value=${this._action}
|
||||
.disabled=${this.disabled}
|
||||
.showAdvanced=${this.hass.userData?.showAdvanced}
|
||||
.hidePicker=${!!this._action.metadata}
|
||||
@value-changed=${this._actionChanged}
|
||||
></ha-service-control>
|
||||
${domain && service && this.hass.services[domain]?.[service]?.response
|
||||
|
||||
@@ -106,6 +106,15 @@ export default class HaAutomationCondition extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
public expandAll() {
|
||||
const rows = this.shadowRoot!.querySelectorAll<HaAutomationConditionRow>(
|
||||
"ha-automation-condition-row"
|
||||
)!;
|
||||
rows.forEach((row) => {
|
||||
row.expand();
|
||||
});
|
||||
}
|
||||
|
||||
private get nested() {
|
||||
return this.path !== undefined;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
import "@material/mwc-button/mwc-button";
|
||||
import { mdiHelpCircle } from "@mdi/js";
|
||||
import { HassEntity } from "home-assistant-js-websocket";
|
||||
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||
import {
|
||||
css,
|
||||
CSSResultGroup,
|
||||
html,
|
||||
LitElement,
|
||||
nothing,
|
||||
PropertyValues,
|
||||
} from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { ensureArray } from "../../../common/array/ensure-array";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
@@ -21,6 +28,14 @@ import { documentationUrl } from "../../../util/documentation-url";
|
||||
import "./action/ha-automation-action";
|
||||
import "./condition/ha-automation-condition";
|
||||
import "./trigger/ha-automation-trigger";
|
||||
import type HaAutomationTrigger from "./trigger/ha-automation-trigger";
|
||||
import type HaAutomationAction from "./action/ha-automation-action";
|
||||
import type HaAutomationCondition from "./condition/ha-automation-condition";
|
||||
import {
|
||||
extractSearchParam,
|
||||
removeSearchParam,
|
||||
} from "../../../common/url/search-params";
|
||||
import { constructUrlCurrentPath } from "../../../common/url/construct-url";
|
||||
|
||||
@customElement("manual-automation-editor")
|
||||
export class HaManualAutomationEditor extends LitElement {
|
||||
@@ -36,6 +51,31 @@ export class HaManualAutomationEditor extends LitElement {
|
||||
|
||||
@property({ attribute: false }) public stateObj?: HassEntity;
|
||||
|
||||
protected firstUpdated(changedProps: PropertyValues): void {
|
||||
super.firstUpdated(changedProps);
|
||||
const expanded = extractSearchParam("expanded");
|
||||
if (expanded === "1") {
|
||||
this._clearParam("expanded");
|
||||
const items = this.shadowRoot!.querySelectorAll<
|
||||
HaAutomationTrigger | HaAutomationCondition | HaAutomationAction
|
||||
>("ha-automation-trigger, ha-automation-condition, ha-automation-action");
|
||||
|
||||
items.forEach((el) => {
|
||||
el.updateComplete.then(() => {
|
||||
el.expandAll();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private _clearParam(param: string) {
|
||||
window.history.replaceState(
|
||||
null,
|
||||
"",
|
||||
constructUrlCurrentPath(removeSearchParam(param))
|
||||
);
|
||||
}
|
||||
|
||||
protected render() {
|
||||
return html`
|
||||
${this.stateObj?.state === "off"
|
||||
|
||||
@@ -179,6 +179,15 @@ export default class HaAutomationTrigger extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
public expandAll() {
|
||||
const rows = this.shadowRoot!.querySelectorAll<HaAutomationTriggerRow>(
|
||||
"ha-automation-trigger-row"
|
||||
)!;
|
||||
rows.forEach((row) => {
|
||||
row.expand();
|
||||
});
|
||||
}
|
||||
|
||||
private _getKey(action: Trigger) {
|
||||
if (!this._triggerKeys.has(action)) {
|
||||
this._triggerKeys.set(action, Math.random().toString());
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { customElement } from "lit/decorators";
|
||||
import {
|
||||
DeviceAction,
|
||||
localizeDeviceAutomationAction,
|
||||
} from "../../../../data/device_automation";
|
||||
import { HaDeviceAutomationCard } from "./ha-device-automation-card";
|
||||
|
||||
@customElement("ha-device-actions-card")
|
||||
export class HaDeviceActionsCard extends HaDeviceAutomationCard<DeviceAction> {
|
||||
readonly type = "action";
|
||||
|
||||
readonly headerKey = "ui.panel.config.devices.automation.actions.caption";
|
||||
|
||||
constructor() {
|
||||
super(localizeDeviceAutomationAction);
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-device-actions-card": HaDeviceActionsCard;
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
import { css, html, LitElement, nothing } from "lit";
|
||||
import { property, state } from "lit/decorators";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import "../../../../components/chips/ha-assist-chip";
|
||||
import "../../../../components/chips/ha-chip-set";
|
||||
import { showAutomationEditor } from "../../../../data/automation";
|
||||
import {
|
||||
DeviceAction,
|
||||
DeviceAutomation,
|
||||
} from "../../../../data/device_automation";
|
||||
import { EntityRegistryEntry } from "../../../../data/entity_registry";
|
||||
import { showScriptEditor } from "../../../../data/script";
|
||||
import { buttonLinkStyle } from "../../../../resources/styles";
|
||||
import { HomeAssistant } from "../../../../types";
|
||||
|
||||
declare global {
|
||||
interface HASSDomEvents {
|
||||
"entry-selected": undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class HaDeviceAutomationCard<
|
||||
T extends DeviceAutomation,
|
||||
> extends LitElement {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@property() public deviceId?: string;
|
||||
|
||||
@property({ type: Boolean }) public script = false;
|
||||
|
||||
@property({ attribute: false }) public automations: T[] = [];
|
||||
|
||||
@property({ attribute: false }) entityReg?: EntityRegistryEntry[];
|
||||
|
||||
@state() public _showSecondary = false;
|
||||
|
||||
abstract headerKey: Parameters<typeof this.hass.localize>[0];
|
||||
|
||||
abstract type: "action" | "condition" | "trigger";
|
||||
|
||||
private _localizeDeviceAutomation: (
|
||||
hass: HomeAssistant,
|
||||
entityRegistry: EntityRegistryEntry[],
|
||||
automation: T
|
||||
) => string;
|
||||
|
||||
constructor(
|
||||
localizeDeviceAutomation: HaDeviceAutomationCard<T>["_localizeDeviceAutomation"]
|
||||
) {
|
||||
super();
|
||||
this._localizeDeviceAutomation = localizeDeviceAutomation;
|
||||
}
|
||||
|
||||
protected shouldUpdate(changedProps): boolean {
|
||||
if (changedProps.has("deviceId") || changedProps.has("automations")) {
|
||||
return true;
|
||||
}
|
||||
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
|
||||
if (!oldHass || oldHass.language !== this.hass.language) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected render() {
|
||||
if (this.automations.length === 0 || !this.entityReg) {
|
||||
return nothing;
|
||||
}
|
||||
const automations = this._showSecondary
|
||||
? this.automations
|
||||
: this.automations.filter(
|
||||
(automation) => automation.metadata?.secondary === false
|
||||
);
|
||||
return html`
|
||||
<h3>${this.hass.localize(this.headerKey)}</h3>
|
||||
<div class="content">
|
||||
<ha-chip-set>
|
||||
${automations.map(
|
||||
(automation, idx) => html`
|
||||
<ha-assist-chip
|
||||
filled
|
||||
.index=${idx}
|
||||
@click=${this._handleAutomationClicked}
|
||||
class=${automation.metadata?.secondary ? "secondary" : ""}
|
||||
.label=${this._localizeDeviceAutomation(
|
||||
this.hass,
|
||||
this.entityReg!,
|
||||
automation
|
||||
)}
|
||||
>
|
||||
</ha-assist-chip>
|
||||
`
|
||||
)}
|
||||
</ha-chip-set>
|
||||
${!this._showSecondary && automations.length < this.automations.length
|
||||
? html`<button class="link" @click=${this._toggleSecondary}>
|
||||
Show ${this.automations.length - automations.length} more...
|
||||
</button>`
|
||||
: ""}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
private _toggleSecondary() {
|
||||
this._showSecondary = !this._showSecondary;
|
||||
}
|
||||
|
||||
private _handleAutomationClicked(ev: CustomEvent) {
|
||||
const automation = { ...this.automations[(ev.currentTarget as any).index] };
|
||||
if (!automation) {
|
||||
return;
|
||||
}
|
||||
delete automation.metadata;
|
||||
if (this.script) {
|
||||
showScriptEditor({ sequence: [automation as DeviceAction] });
|
||||
fireEvent(this, "entry-selected");
|
||||
return;
|
||||
}
|
||||
const data = {};
|
||||
data[this.type] = [automation];
|
||||
showAutomationEditor(data);
|
||||
fireEvent(this, "entry-selected");
|
||||
}
|
||||
|
||||
static styles = [
|
||||
buttonLinkStyle,
|
||||
css`
|
||||
h3 {
|
||||
color: var(--primary-text-color);
|
||||
}
|
||||
.secondary {
|
||||
--ha-assist-chip-filled-container-color: rgba(
|
||||
var(--rgb-primary-text-color),
|
||||
0.07
|
||||
);
|
||||
}
|
||||
button.link {
|
||||
color: var(--primary-color);
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
@@ -1,8 +1,18 @@
|
||||
import "@material/mwc-button/mwc-button";
|
||||
import { CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||
import {
|
||||
mdiAbTesting,
|
||||
mdiGestureTap,
|
||||
mdiPencilOutline,
|
||||
mdiRoomService,
|
||||
} from "@mdi/js";
|
||||
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import "../../../../components/ha-dialog";
|
||||
import { shouldHandleRequestSelectedEvent } from "../../../../common/mwc/handle-request-selected-event";
|
||||
import { createCloseHeading } from "../../../../components/ha-dialog";
|
||||
import {
|
||||
AutomationConfig,
|
||||
showAutomationEditor,
|
||||
} from "../../../../data/automation";
|
||||
import {
|
||||
DeviceAction,
|
||||
DeviceCondition,
|
||||
@@ -12,11 +22,9 @@ import {
|
||||
fetchDeviceTriggers,
|
||||
sortDeviceAutomations,
|
||||
} from "../../../../data/device_automation";
|
||||
import { haStyleDialog } from "../../../../resources/styles";
|
||||
import { ScriptConfig, showScriptEditor } from "../../../../data/script";
|
||||
import { haStyle, haStyleDialog } from "../../../../resources/styles";
|
||||
import { HomeAssistant } from "../../../../types";
|
||||
import "./ha-device-actions-card";
|
||||
import "./ha-device-conditions-card";
|
||||
import "./ha-device-triggers-card";
|
||||
import { DeviceAutomationDialogParams } from "./show-dialog-device-automation";
|
||||
|
||||
@customElement("dialog-device-automation")
|
||||
@@ -77,75 +85,184 @@ export class DialogDeviceAutomation extends LitElement {
|
||||
});
|
||||
}
|
||||
|
||||
private _handleRowClick = (ev) => {
|
||||
if (!shouldHandleRequestSelectedEvent(ev) || !this._params) {
|
||||
return;
|
||||
}
|
||||
const type = (ev.currentTarget as any).type;
|
||||
const isScript = this._params.script;
|
||||
|
||||
this.closeDialog();
|
||||
|
||||
if (isScript) {
|
||||
const newScript = {} as ScriptConfig;
|
||||
if (type === "action") {
|
||||
newScript.sequence = [this._actions[0]];
|
||||
}
|
||||
showScriptEditor(newScript, true);
|
||||
} else {
|
||||
const newAutomation = {} as AutomationConfig;
|
||||
if (type === "trigger") {
|
||||
newAutomation.triggers = [this._triggers[0]];
|
||||
}
|
||||
if (type === "condition") {
|
||||
newAutomation.conditions = [this._conditions[0]];
|
||||
}
|
||||
if (type === "action") {
|
||||
newAutomation.actions = [this._actions[0]];
|
||||
}
|
||||
showAutomationEditor(newAutomation, true);
|
||||
}
|
||||
};
|
||||
|
||||
protected render() {
|
||||
if (!this._params) {
|
||||
return nothing;
|
||||
}
|
||||
|
||||
const mode = this._params.script ? "script" : "automation";
|
||||
|
||||
const title = this.hass.localize(`ui.panel.config.devices.${mode}.create`, {
|
||||
type: this.hass.localize(
|
||||
`ui.panel.config.devices.type.${
|
||||
this._params.device.entry_type || "device"
|
||||
}`
|
||||
),
|
||||
});
|
||||
|
||||
return html`
|
||||
<ha-dialog
|
||||
open
|
||||
hideActions
|
||||
@closed=${this.closeDialog}
|
||||
.heading=${this.hass.localize(
|
||||
`ui.panel.config.devices.${
|
||||
this._params.script ? "script" : "automation"
|
||||
}.create`,
|
||||
{
|
||||
type: this.hass.localize(
|
||||
`ui.panel.config.devices.type.${
|
||||
this._params.device.entry_type || "device"
|
||||
}`
|
||||
),
|
||||
}
|
||||
)}
|
||||
.heading=${createCloseHeading(this.hass, title)}
|
||||
>
|
||||
<div @entry-selected=${this.closeDialog}>
|
||||
<mwc-list
|
||||
innerRole="listbox"
|
||||
itemRoles="option"
|
||||
innerAriaLabel="Create new automation"
|
||||
rootTabbable
|
||||
dialogInitialFocus
|
||||
>
|
||||
${this._triggers.length
|
||||
? html`
|
||||
<ha-list-item
|
||||
hasmeta
|
||||
twoline
|
||||
graphic="icon"
|
||||
.type=${"trigger"}
|
||||
@request-selected=${this._handleRowClick}
|
||||
>
|
||||
<ha-svg-icon
|
||||
slot="graphic"
|
||||
.path=${mdiGestureTap}
|
||||
></ha-svg-icon>
|
||||
${this.hass.localize(
|
||||
`ui.panel.config.devices.automation.triggers.title`
|
||||
)}
|
||||
<span slot="secondary">
|
||||
${this.hass.localize(
|
||||
`ui.panel.config.devices.automation.triggers.description`
|
||||
)}
|
||||
</span>
|
||||
<ha-icon-next slot="meta"></ha-icon-next>
|
||||
</ha-list-item>
|
||||
`
|
||||
: nothing}
|
||||
${this._conditions.length
|
||||
? html`
|
||||
<ha-list-item
|
||||
hasmeta
|
||||
twoline
|
||||
graphic="icon"
|
||||
.type=${"condition"}
|
||||
@request-selected=${this._handleRowClick}
|
||||
>
|
||||
<ha-svg-icon
|
||||
slot="graphic"
|
||||
.path=${mdiAbTesting}
|
||||
></ha-svg-icon>
|
||||
${this.hass.localize(
|
||||
`ui.panel.config.devices.automation.conditions.title`
|
||||
)}
|
||||
<span slot="secondary">
|
||||
${this.hass.localize(
|
||||
`ui.panel.config.devices.automation.conditions.description`
|
||||
)}
|
||||
</span>
|
||||
<ha-icon-next slot="meta"></ha-icon-next>
|
||||
</ha-list-item>
|
||||
`
|
||||
: nothing}
|
||||
${this._actions.length
|
||||
? html`
|
||||
<ha-list-item
|
||||
hasmeta
|
||||
twoline
|
||||
graphic="icon"
|
||||
.type=${"action"}
|
||||
@request-selected=${this._handleRowClick}
|
||||
>
|
||||
<ha-svg-icon
|
||||
slot="graphic"
|
||||
.path=${mdiRoomService}
|
||||
></ha-svg-icon>
|
||||
${this.hass.localize(
|
||||
`ui.panel.config.devices.${mode}.actions.title`
|
||||
)}
|
||||
<span slot="secondary">
|
||||
${this.hass.localize(
|
||||
`ui.panel.config.devices.${mode}.actions.description`
|
||||
)}
|
||||
</span>
|
||||
<ha-icon-next slot="meta"></ha-icon-next>
|
||||
</ha-list-item>
|
||||
`
|
||||
: nothing}
|
||||
${this._triggers.length ||
|
||||
this._conditions.length ||
|
||||
this._actions.length
|
||||
? html`
|
||||
${this._triggers.length
|
||||
? html`
|
||||
<ha-device-triggers-card
|
||||
.hass=${this.hass}
|
||||
.automations=${this._triggers}
|
||||
.entityReg=${this._params.entityReg}
|
||||
></ha-device-triggers-card>
|
||||
`
|
||||
: ""}
|
||||
${this._conditions.length
|
||||
? html`
|
||||
<ha-device-conditions-card
|
||||
.hass=${this.hass}
|
||||
.automations=${this._conditions}
|
||||
.entityReg=${this._params.entityReg}
|
||||
></ha-device-conditions-card>
|
||||
`
|
||||
: ""}
|
||||
${this._actions.length
|
||||
? html`
|
||||
<ha-device-actions-card
|
||||
.hass=${this.hass}
|
||||
.automations=${this._actions}
|
||||
.script=${this._params.script}
|
||||
.entityReg=${this._params.entityReg}
|
||||
></ha-device-actions-card>
|
||||
`
|
||||
: ""}
|
||||
`
|
||||
: this.hass.localize(
|
||||
"ui.panel.config.devices.automation.no_device_automations"
|
||||
? html`<li divider role="separator"></li>`
|
||||
: nothing}
|
||||
<ha-list-item
|
||||
hasmeta
|
||||
twoline
|
||||
graphic="icon"
|
||||
@request-selected=${this._handleRowClick}
|
||||
>
|
||||
<ha-svg-icon slot="graphic" .path=${mdiPencilOutline}></ha-svg-icon>
|
||||
${this.hass.localize(`ui.panel.config.devices.${mode}.new.title`)}
|
||||
<span slot="secondary">
|
||||
${this.hass.localize(
|
||||
`ui.panel.config.devices.${mode}.new.description`
|
||||
)}
|
||||
</div>
|
||||
<mwc-button slot="primaryAction" @click=${this.closeDialog}>
|
||||
${this.hass.localize("ui.common.close")}
|
||||
</mwc-button>
|
||||
</span>
|
||||
<ha-icon-next slot="meta"></ha-icon-next>
|
||||
</ha-list-item>
|
||||
</mwc-list>
|
||||
</ha-dialog>
|
||||
`;
|
||||
}
|
||||
|
||||
static get styles(): CSSResultGroup {
|
||||
return haStyleDialog;
|
||||
return [
|
||||
haStyle,
|
||||
haStyleDialog,
|
||||
css`
|
||||
ha-dialog {
|
||||
--dialog-content-padding: 0;
|
||||
--mdc-dialog-max-height: 60vh;
|
||||
}
|
||||
@media all and (min-width: 550px) {
|
||||
ha-dialog {
|
||||
--mdc-dialog-min-width: 500px;
|
||||
}
|
||||
}
|
||||
ha-icon-next {
|
||||
width: 24px;
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { customElement } from "lit/decorators";
|
||||
import {
|
||||
DeviceCondition,
|
||||
localizeDeviceAutomationCondition,
|
||||
} from "../../../../data/device_automation";
|
||||
import { HaDeviceAutomationCard } from "./ha-device-automation-card";
|
||||
|
||||
@customElement("ha-device-conditions-card")
|
||||
export class HaDeviceConditionsCard extends HaDeviceAutomationCard<DeviceCondition> {
|
||||
readonly type = "condition";
|
||||
|
||||
readonly headerKey = "ui.panel.config.devices.automation.conditions.caption";
|
||||
|
||||
constructor() {
|
||||
super(localizeDeviceAutomationCondition);
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-device-conditions-card": HaDeviceConditionsCard;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import { customElement } from "lit/decorators";
|
||||
import {
|
||||
DeviceTrigger,
|
||||
localizeDeviceAutomationTrigger,
|
||||
} from "../../../../data/device_automation";
|
||||
import { HaDeviceAutomationCard } from "./ha-device-automation-card";
|
||||
|
||||
@customElement("ha-device-triggers-card")
|
||||
export class HaDeviceTriggersCard extends HaDeviceAutomationCard<DeviceTrigger> {
|
||||
readonly type = "trigger";
|
||||
|
||||
readonly headerKey = "ui.panel.config.devices.automation.triggers.caption";
|
||||
|
||||
constructor() {
|
||||
super(localizeDeviceAutomationTrigger);
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-device-triggers-card": HaDeviceTriggersCard;
|
||||
}
|
||||
}
|
||||
@@ -83,9 +83,15 @@ export const getZHADeviceActions = async (
|
||||
classes: "warning",
|
||||
action: async () => {
|
||||
const confirmed = await showConfirmationDialog(el, {
|
||||
text: hass.localize(
|
||||
"ui.dialogs.zha_device_info.confirmations.remove"
|
||||
title: hass.localize(
|
||||
"ui.dialogs.zha_device_info.confirmations.remove_title"
|
||||
),
|
||||
text: hass.localize(
|
||||
"ui.dialogs.zha_device_info.confirmations.remove_text"
|
||||
),
|
||||
confirmText: hass.localize("ui.common.remove"),
|
||||
dismissText: hass.localize("ui.common.cancel"),
|
||||
destructive: true,
|
||||
});
|
||||
|
||||
if (!confirmed) {
|
||||
|
||||
@@ -37,6 +37,7 @@ import {
|
||||
ThreadDataSet,
|
||||
ThreadRouter,
|
||||
addThreadDataSet,
|
||||
getThreadDataSetTLV,
|
||||
listThreadDataSets,
|
||||
removeThreadDataSet,
|
||||
setPreferredBorderAgent,
|
||||
@@ -168,8 +169,7 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
|
||||
(otbr) => otbr.extended_pan_id === network.dataset!.extended_pan_id
|
||||
));
|
||||
const canImportKeychain =
|
||||
this.hass.auth.external?.config.canTransferThreadCredentialsToKeychain &&
|
||||
otbrForNetwork;
|
||||
this.hass.auth.external?.config.canTransferThreadCredentialsToKeychain;
|
||||
|
||||
return html`<ha-card>
|
||||
<div class="card-header">
|
||||
@@ -208,8 +208,12 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
|
||||
${network.routers.map((router) => {
|
||||
const otbr =
|
||||
this._otbrInfo && this._otbrInfo[router.extended_address];
|
||||
const showOverflow =
|
||||
("dataset" in network && router.border_agent_id) || otbr;
|
||||
const showDefaultRouter = !!network.dataset;
|
||||
const isDefaultRouter =
|
||||
showDefaultRouter &&
|
||||
router.extended_address ===
|
||||
network.dataset!.preferred_extended_address;
|
||||
const showOverflow = showDefaultRouter || otbr;
|
||||
return html`<ha-list-item
|
||||
class="router"
|
||||
twoline
|
||||
@@ -235,9 +239,7 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
|
||||
""}
|
||||
<span slot="secondary">${router.server}</span>
|
||||
${showOverflow
|
||||
? html`${network.dataset &&
|
||||
router.extended_address ===
|
||||
network.dataset.preferred_extended_address
|
||||
? html`${isDefaultRouter
|
||||
? html`<ha-svg-icon
|
||||
.path=${mdiCellphoneKey}
|
||||
.title=${this.hass.localize(
|
||||
@@ -259,13 +261,9 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
|
||||
.path=${mdiDotsVertical}
|
||||
slot="trigger"
|
||||
></ha-icon-button>
|
||||
${network.dataset && router.border_agent_id
|
||||
? html`<ha-list-item
|
||||
.disabled=${router.border_agent_id ===
|
||||
network.dataset.preferred_border_agent_id}
|
||||
>
|
||||
${router.border_agent_id ===
|
||||
network.dataset.preferred_border_agent_id
|
||||
${showDefaultRouter
|
||||
? html`<ha-list-item .disabled=${isDefaultRouter}>
|
||||
${isDefaultRouter
|
||||
? this.hass.localize(
|
||||
"ui.panel.config.thread.default_router"
|
||||
)
|
||||
@@ -321,9 +319,13 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
|
||||
>
|
||||
</div>`
|
||||
: ""}
|
||||
${canImportKeychain
|
||||
${canImportKeychain &&
|
||||
network.dataset?.preferred &&
|
||||
network.routers?.length
|
||||
? html`<div class="card-actions">
|
||||
<mwc-button .otbr=${otbrForNetwork} @click=${this._sendCredentials}
|
||||
<mwc-button
|
||||
.networkDataset=${network.dataset}
|
||||
@click=${this._sendCredentials}
|
||||
>Send credentials to phone</mwc-button
|
||||
>
|
||||
</div>`
|
||||
@@ -331,17 +333,30 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
|
||||
</ha-card>`;
|
||||
}
|
||||
|
||||
private _sendCredentials(ev) {
|
||||
const otbr = (ev.currentTarget as any).otbr as OTBRInfo;
|
||||
if (!otbr) {
|
||||
private async _sendCredentials(ev) {
|
||||
const dataset = (ev.currentTarget as any).networkDataset as ThreadDataSet;
|
||||
if (!dataset) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!dataset.preferred_extended_address &&
|
||||
!dataset.preferred_border_agent_id
|
||||
) {
|
||||
showAlertDialog(this, {
|
||||
title: "Error",
|
||||
text: this.hass.localize("ui.panel.config.thread.no_preferred_router"),
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.hass.auth.external!.fireMessage({
|
||||
type: "thread/store_in_platform_keychain",
|
||||
payload: {
|
||||
mac_extended_address: otbr.extended_address,
|
||||
border_agent_id: otbr.border_agent_id,
|
||||
active_operational_dataset: otbr.active_dataset_tlvs,
|
||||
mac_extended_address: dataset.preferred_extended_address,
|
||||
border_agent_id: dataset.preferred_border_agent_id,
|
||||
active_operational_dataset: (
|
||||
await getThreadDataSetTLV(this.hass, dataset.dataset_id)
|
||||
).tlv,
|
||||
extended_pan_id: dataset.extended_pan_id,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -467,10 +482,9 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
|
||||
const network = (ev.currentTarget as any).network as ThreadNetwork;
|
||||
const router = (ev.currentTarget as any).router as ThreadRouter;
|
||||
const otbr = (ev.currentTarget as any).otbr as OTBRInfo;
|
||||
const index =
|
||||
network.dataset && router.border_agent_id
|
||||
? Number(ev.detail.index)
|
||||
: Number(ev.detail.index) + 1;
|
||||
const index = network.dataset
|
||||
? Number(ev.detail.index)
|
||||
: Number(ev.detail.index) + 1;
|
||||
switch (index) {
|
||||
case 0:
|
||||
this._setPreferredBorderAgent(network.dataset!, router);
|
||||
|
||||
@@ -24,6 +24,7 @@ import { haStyle } from "../../../../../resources/styles";
|
||||
import { HomeAssistant, Route } from "../../../../../types";
|
||||
import { formatAsPaddedHex, sortZHAGroups } from "./functions";
|
||||
import { zhaTabs } from "./zha-config-dashboard";
|
||||
import { LocalizeFunc } from "../../../../../common/translations/localize";
|
||||
|
||||
export interface GroupRowData extends ZHAGroup {
|
||||
group?: GroupRowData;
|
||||
@@ -71,38 +72,35 @@ export class ZHAGroupsDashboard extends LitElement {
|
||||
});
|
||||
|
||||
private _columns = memoizeOne(
|
||||
(narrow: boolean): DataTableColumnContainer<GroupRowData> =>
|
||||
narrow
|
||||
? {
|
||||
name: {
|
||||
title: "Group",
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
direction: "asc",
|
||||
flex: 2,
|
||||
},
|
||||
}
|
||||
: {
|
||||
name: {
|
||||
title: this.hass.localize("ui.panel.config.zha.groups.groups"),
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
direction: "asc",
|
||||
flex: 2,
|
||||
},
|
||||
group_id: {
|
||||
title: this.hass.localize("ui.panel.config.zha.groups.group_id"),
|
||||
type: "numeric",
|
||||
template: (group) => html` ${formatAsPaddedHex(group.group_id)} `,
|
||||
sortable: true,
|
||||
},
|
||||
members: {
|
||||
title: this.hass.localize("ui.panel.config.zha.groups.members"),
|
||||
type: "numeric",
|
||||
template: (group) => html` ${group.members.length} `,
|
||||
sortable: true,
|
||||
},
|
||||
}
|
||||
(localize: LocalizeFunc): DataTableColumnContainer => {
|
||||
const columns: DataTableColumnContainer<GroupRowData> = {
|
||||
name: {
|
||||
title: localize("ui.panel.config.zha.groups.groups"),
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
showNarrow: true,
|
||||
main: true,
|
||||
hideable: false,
|
||||
moveable: false,
|
||||
direction: "asc",
|
||||
flex: 2,
|
||||
},
|
||||
group_id: {
|
||||
title: localize("ui.panel.config.zha.groups.group_id"),
|
||||
type: "numeric",
|
||||
template: (group) => html` ${formatAsPaddedHex(group.group_id)} `,
|
||||
sortable: true,
|
||||
},
|
||||
members: {
|
||||
title: localize("ui.panel.config.zha.groups.members"),
|
||||
type: "numeric",
|
||||
template: (group) => html` ${group.members.length} `,
|
||||
sortable: true,
|
||||
},
|
||||
};
|
||||
|
||||
return columns;
|
||||
}
|
||||
);
|
||||
|
||||
protected render(): TemplateResult {
|
||||
@@ -112,7 +110,7 @@ export class ZHAGroupsDashboard extends LitElement {
|
||||
.hass=${this.hass}
|
||||
.narrow=${this.narrow}
|
||||
.route=${this.route}
|
||||
.columns=${this._columns(this.narrow)}
|
||||
.columns=${this._columns(this.hass.localize)}
|
||||
.data=${this._formattedGroups(this._groups)}
|
||||
@row-click=${this._handleRowClicked}
|
||||
clickable
|
||||
|
||||
@@ -47,7 +47,7 @@ export const showRepairsFlowDialog = (
|
||||
},
|
||||
{
|
||||
flowType: "repair_flow",
|
||||
loadDevicesAndAreas: false,
|
||||
showDevices: false,
|
||||
createFlow: async (hass, handler) => {
|
||||
const [step] = await Promise.all([
|
||||
createRepairsFlow(hass, handler, issue.issue_id),
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
import "@material/mwc-button/mwc-button";
|
||||
import { mdiHelpCircle } from "@mdi/js";
|
||||
import { CSSResultGroup, LitElement, css, html, nothing } from "lit";
|
||||
import {
|
||||
CSSResultGroup,
|
||||
LitElement,
|
||||
PropertyValues,
|
||||
css,
|
||||
html,
|
||||
nothing,
|
||||
} from "lit";
|
||||
import { customElement, property, query } from "lit/decorators";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
import { constructUrlCurrentPath } from "../../../common/url/construct-url";
|
||||
import {
|
||||
extractSearchParam,
|
||||
removeSearchParam,
|
||||
} from "../../../common/url/search-params";
|
||||
import { nestedArrayMove } from "../../../common/util/array-move";
|
||||
import "../../../components/ha-card";
|
||||
import "../../../components/ha-icon-button";
|
||||
@@ -12,6 +24,7 @@ import { haStyle } from "../../../resources/styles";
|
||||
import type { HomeAssistant } from "../../../types";
|
||||
import { documentationUrl } from "../../../util/documentation-url";
|
||||
import "../automation/action/ha-automation-action";
|
||||
import type HaAutomationAction from "../automation/action/ha-automation-action";
|
||||
import "./ha-script-fields";
|
||||
import type HaScriptFields from "./ha-script-fields";
|
||||
|
||||
@@ -58,6 +71,31 @@ export class HaManualScriptEditor extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected firstUpdated(changedProps: PropertyValues): void {
|
||||
super.firstUpdated(changedProps);
|
||||
const expanded = extractSearchParam("expanded");
|
||||
if (expanded === "1") {
|
||||
this._clearParam("expanded");
|
||||
const items = this.shadowRoot!.querySelectorAll<HaAutomationAction>(
|
||||
"ha-automation-action"
|
||||
);
|
||||
|
||||
items.forEach((el) => {
|
||||
el.updateComplete.then(() => {
|
||||
el.expandAll();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private _clearParam(param: string) {
|
||||
window.history.replaceState(
|
||||
null,
|
||||
"",
|
||||
constructUrlCurrentPath(removeSearchParam(param))
|
||||
);
|
||||
}
|
||||
|
||||
protected render() {
|
||||
return html`
|
||||
${this.config.description
|
||||
|
||||
@@ -7,6 +7,7 @@ import "../../../components/ha-card";
|
||||
import "../../../components/ha-textfield";
|
||||
import "../../../components/ha-yaml-editor";
|
||||
import "../../../components/ha-button";
|
||||
import "../../../components/ha-alert";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
|
||||
@customElement("event-subscribe-card")
|
||||
@@ -22,6 +23,8 @@ class EventSubscribeCard extends LitElement {
|
||||
event: HassEvent;
|
||||
}> = [];
|
||||
|
||||
@state() private _error?: string;
|
||||
|
||||
private _eventCount = 0;
|
||||
|
||||
public disconnectedCallback() {
|
||||
@@ -52,6 +55,9 @@ class EventSubscribeCard extends LitElement {
|
||||
.value=${this._eventType}
|
||||
@input=${this._valueChanged}
|
||||
></ha-textfield>
|
||||
${this._error
|
||||
? html`<ha-alert alert-type="error">${this._error}</ha-alert>`
|
||||
: ""}
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<ha-button
|
||||
@@ -110,33 +116,43 @@ class EventSubscribeCard extends LitElement {
|
||||
|
||||
private _valueChanged(ev): void {
|
||||
this._eventType = ev.target.value;
|
||||
this._error = undefined;
|
||||
}
|
||||
|
||||
private async _startOrStopListening(): Promise<void> {
|
||||
if (this._subscribed) {
|
||||
this._subscribed();
|
||||
this._subscribed = undefined;
|
||||
this._error = undefined;
|
||||
} else {
|
||||
this._subscribed = await this.hass!.connection.subscribeEvents<HassEvent>(
|
||||
(event) => {
|
||||
const tail =
|
||||
this._events.length > 30 ? this._events.slice(0, 29) : this._events;
|
||||
this._events = [
|
||||
{
|
||||
event,
|
||||
id: this._eventCount++,
|
||||
},
|
||||
...tail,
|
||||
];
|
||||
},
|
||||
this._eventType
|
||||
);
|
||||
try {
|
||||
this._subscribed =
|
||||
await this.hass!.connection.subscribeEvents<HassEvent>((event) => {
|
||||
const tail =
|
||||
this._events.length > 30
|
||||
? this._events.slice(0, 29)
|
||||
: this._events;
|
||||
this._events = [
|
||||
{
|
||||
event,
|
||||
id: this._eventCount++,
|
||||
},
|
||||
...tail,
|
||||
];
|
||||
}, this._eventType);
|
||||
} catch (error: any) {
|
||||
this._error = this.hass!.localize(
|
||||
"ui.panel.developer-tools.tabs.events.subscribe_failed",
|
||||
{ error: error.message || "Unknown error" }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private _clearEvents(): void {
|
||||
this._events = [];
|
||||
this._eventCount = 0;
|
||||
this._error = undefined;
|
||||
}
|
||||
|
||||
static get styles(): CSSResultGroup {
|
||||
@@ -145,6 +161,9 @@ class EventSubscribeCard extends LitElement {
|
||||
display: block;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.error-message {
|
||||
margin-top: 8px;
|
||||
}
|
||||
.event {
|
||||
border-top: 1px solid var(--divider-color);
|
||||
padding-top: 8px;
|
||||
|
||||
@@ -39,6 +39,7 @@ import {
|
||||
StatisticsValidationResult,
|
||||
clearStatistics,
|
||||
getStatisticIds,
|
||||
updateStatisticsIssues,
|
||||
validateStatistics,
|
||||
} from "../../../data/recorder";
|
||||
import { SubscribeMixin } from "../../../mixins/subscribe-mixin";
|
||||
@@ -636,6 +637,8 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) {
|
||||
validateStatistics(this.hass),
|
||||
]);
|
||||
|
||||
updateStatisticsIssues(this.hass);
|
||||
|
||||
const statsIds = new Set();
|
||||
|
||||
this._data = statisticIds
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
PropertyValues,
|
||||
} from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { classMap } from "lit/directives/class-map";
|
||||
import { repeat } from "lit/directives/repeat";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
import "../../../components/ha-sortable";
|
||||
@@ -124,7 +125,7 @@ export class HuiViewBadges extends LitElement {
|
||||
.options=${BADGE_SORTABLE_OPTIONS}
|
||||
invert-swap
|
||||
>
|
||||
<div class="badges">
|
||||
<div class="badges ${classMap({ "edit-mode": editMode })}">
|
||||
${repeat(
|
||||
badges,
|
||||
(badge) => this._getBadgeKey(badge),
|
||||
@@ -185,6 +186,8 @@ export class HuiViewBadges extends LitElement {
|
||||
hui-badge-edit-mode {
|
||||
display: block;
|
||||
position: relative;
|
||||
min-width: 36px;
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
.add {
|
||||
|
||||
@@ -5,6 +5,7 @@ import { MediaQueriesListener } from "../../../common/dom/media_query";
|
||||
import "../../../components/ha-svg-icon";
|
||||
import { LovelaceCardConfig } from "../../../data/lovelace/config/card";
|
||||
import type { HomeAssistant } from "../../../types";
|
||||
import { migrateLayoutToGridOptions } from "../common/compute-card-grid-size";
|
||||
import { computeCardSize } from "../common/compute-card-size";
|
||||
import {
|
||||
attachConditionMediaQueriesListeners,
|
||||
@@ -12,7 +13,7 @@ import {
|
||||
} from "../common/validate-condition";
|
||||
import { createCardElement } from "../create-element/create-card-element";
|
||||
import { createErrorCardConfig } from "../create-element/create-element-base";
|
||||
import type { LovelaceCard, LovelaceLayoutOptions } from "../types";
|
||||
import type { LovelaceCard, LovelaceGridOptions } from "../types";
|
||||
|
||||
declare global {
|
||||
interface HASSDomEvents {
|
||||
@@ -67,20 +68,44 @@ export class HuiCard extends ReactiveElement {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public getLayoutOptions(): LovelaceLayoutOptions {
|
||||
const configOptions = this.config?.layout_options ?? {};
|
||||
if (this._element) {
|
||||
const cardOptions = this._element.getLayoutOptions?.() ?? {};
|
||||
return {
|
||||
...cardOptions,
|
||||
...configOptions,
|
||||
};
|
||||
}
|
||||
return configOptions;
|
||||
public getGridOptions(): LovelaceGridOptions {
|
||||
const elementOptions = this.getElementGridOptions();
|
||||
const configOptions = this.getConfigGridOptions();
|
||||
return {
|
||||
...elementOptions,
|
||||
...configOptions,
|
||||
};
|
||||
}
|
||||
|
||||
public getElementLayoutOptions(): LovelaceLayoutOptions {
|
||||
return this._element?.getLayoutOptions?.() ?? {};
|
||||
// options provided by the element
|
||||
public getElementGridOptions(): LovelaceGridOptions {
|
||||
if (!this._element) return {};
|
||||
|
||||
if (this._element.getGridOptions) {
|
||||
return this._element.getGridOptions();
|
||||
}
|
||||
if (this._element.getLayoutOptions) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
`This card (${this.config?.type}) is using "getLayoutOptions" and it is deprecated, contact the developer to suggest to use "getGridOptions" instead`
|
||||
);
|
||||
const config = migrateLayoutToGridOptions(
|
||||
this._element.getLayoutOptions()
|
||||
);
|
||||
return config;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
// options provided by the config
|
||||
public getConfigGridOptions(): LovelaceGridOptions {
|
||||
if (this.config?.grid_options) {
|
||||
return this.config.grid_options;
|
||||
}
|
||||
if (this.config?.layout_options) {
|
||||
return migrateLayoutToGridOptions(this.config.layout_options);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
private _updateElement(config: LovelaceCardConfig) {
|
||||
|
||||
@@ -129,6 +129,8 @@ export class HuiHeadingCard extends LitElement implements LovelaceCard {
|
||||
return css`
|
||||
ha-card {
|
||||
background: none;
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
padding: 0;
|
||||
@@ -185,7 +187,6 @@ export class HuiHeadingCard extends LitElement implements LovelaceCard {
|
||||
}
|
||||
.content p {
|
||||
margin: 0;
|
||||
font-family: Roboto;
|
||||
font-style: normal;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -275,7 +275,7 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
|
||||
"ui.panel.lovelace.cards.todo-list.no_unchecked_items"
|
||||
)}
|
||||
</p>`}
|
||||
${checkedItems.length
|
||||
${!this._config.hide_completed && checkedItems.length
|
||||
? html`
|
||||
<div role="separator">
|
||||
<div class="divider"></div>
|
||||
|
||||
@@ -453,6 +453,7 @@ export interface TodoListCardConfig extends LovelaceCardConfig {
|
||||
title?: string;
|
||||
theme?: string;
|
||||
entity?: string;
|
||||
hide_completed?: boolean;
|
||||
}
|
||||
|
||||
export interface StackCardConfig extends LovelaceCardConfig {
|
||||
|
||||
@@ -1,8 +1,34 @@
|
||||
import { conditionalClamp } from "../../../common/number/clamp";
|
||||
import { LovelaceLayoutOptions } from "../types";
|
||||
import { LovelaceGridOptions, LovelaceLayoutOptions } from "../types";
|
||||
|
||||
const GRID_COLUMN_MULTIPLIER = 3;
|
||||
|
||||
const multiplyBy = <T extends number | string | undefined>(
|
||||
value: T,
|
||||
multiplier: number
|
||||
): T => (typeof value === "number" ? ((value * multiplier) as T) : value);
|
||||
|
||||
export const migrateLayoutToGridOptions = (
|
||||
options: LovelaceLayoutOptions
|
||||
): LovelaceGridOptions => {
|
||||
const gridOptions: LovelaceGridOptions = {
|
||||
columns: multiplyBy(options.grid_columns, GRID_COLUMN_MULTIPLIER),
|
||||
max_columns: multiplyBy(options.grid_max_columns, GRID_COLUMN_MULTIPLIER),
|
||||
min_columns: multiplyBy(options.grid_min_columns, GRID_COLUMN_MULTIPLIER),
|
||||
rows: options.grid_rows,
|
||||
max_rows: options.grid_max_rows,
|
||||
min_rows: options.grid_min_rows,
|
||||
};
|
||||
for (const [key, value] of Object.entries(gridOptions)) {
|
||||
if (value === undefined) {
|
||||
delete gridOptions[key];
|
||||
}
|
||||
}
|
||||
return gridOptions;
|
||||
};
|
||||
|
||||
export const DEFAULT_GRID_SIZE = {
|
||||
columns: 4,
|
||||
columns: 12,
|
||||
rows: "auto",
|
||||
} as CardGridSize;
|
||||
|
||||
@@ -12,14 +38,14 @@ export type CardGridSize = {
|
||||
};
|
||||
|
||||
export const computeCardGridSize = (
|
||||
options: LovelaceLayoutOptions
|
||||
options: LovelaceGridOptions
|
||||
): CardGridSize => {
|
||||
const rows = options.grid_rows ?? DEFAULT_GRID_SIZE.rows;
|
||||
const columns = options.grid_columns ?? DEFAULT_GRID_SIZE.columns;
|
||||
const minRows = options.grid_min_rows;
|
||||
const maxRows = options.grid_max_rows;
|
||||
const minColumns = options.grid_min_columns;
|
||||
const maxColumns = options.grid_max_columns;
|
||||
const rows = options.rows ?? DEFAULT_GRID_SIZE.rows;
|
||||
const columns = options.columns ?? DEFAULT_GRID_SIZE.columns;
|
||||
const minRows = options.min_rows;
|
||||
const maxRows = options.max_rows;
|
||||
const minColumns = options.min_columns;
|
||||
const maxColumns = options.max_columns;
|
||||
|
||||
const clampedRows =
|
||||
typeof rows === "string" ? rows : conditionalClamp(rows, minRows, maxRows);
|
||||
|
||||
@@ -64,11 +64,16 @@ const addEntities = (entities: Set<string>, obj) => {
|
||||
if (obj.badges && Array.isArray(obj.badges)) {
|
||||
obj.badges.forEach((badge) => addEntityId(entities, badge));
|
||||
}
|
||||
if (obj.sections && Array.isArray(obj.sections)) {
|
||||
obj.sections.forEach((section) => addEntities(entities, section));
|
||||
}
|
||||
};
|
||||
|
||||
export const computeUsedEntities = (config: LovelaceConfig): Set<string> => {
|
||||
const entities = new Set<string>();
|
||||
config.views.forEach((view) => addEntities(entities, view));
|
||||
config.views.forEach((view) => {
|
||||
addEntities(entities, view);
|
||||
});
|
||||
return entities;
|
||||
};
|
||||
|
||||
|
||||
@@ -94,12 +94,13 @@ export const handleAction = async (
|
||||
|
||||
switch (actionConfig.action) {
|
||||
case "more-info": {
|
||||
if (config.entity || config.camera_image || config.image_entity) {
|
||||
fireEvent(node, "hass-more-info", {
|
||||
entityId: (config.entity ||
|
||||
config.camera_image ||
|
||||
config.image_entity)!,
|
||||
});
|
||||
const entityId =
|
||||
actionConfig.entity_id ||
|
||||
config.entity ||
|
||||
config.camera_image ||
|
||||
config.image_entity;
|
||||
if (entityId) {
|
||||
fireEvent(node, "hass-more-info", { entityId });
|
||||
} else {
|
||||
showToast(node, {
|
||||
message: hass.localize(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ActionDetail } from "@material/mwc-list";
|
||||
import { mdiCheck, mdiDotsVertical } from "@mdi/js";
|
||||
import { css, html, LitElement, nothing, PropertyValues } from "lit";
|
||||
import { customElement, property, query, state } from "lit/decorators";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { styleMap } from "lit/directives/style-map";
|
||||
import memoizeOne from "memoize-one";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
@@ -17,7 +17,6 @@ import "../../../../components/ha-slider";
|
||||
import "../../../../components/ha-svg-icon";
|
||||
import "../../../../components/ha-switch";
|
||||
import "../../../../components/ha-yaml-editor";
|
||||
import type { HaYamlEditor } from "../../../../components/ha-yaml-editor";
|
||||
import { LovelaceCardConfig } from "../../../../data/lovelace/config/card";
|
||||
import { LovelaceSectionConfig } from "../../../../data/lovelace/config/section";
|
||||
import { haStyle } from "../../../../resources/styles";
|
||||
@@ -26,8 +25,9 @@ import { HuiCard } from "../../cards/hui-card";
|
||||
import {
|
||||
CardGridSize,
|
||||
computeCardGridSize,
|
||||
migrateLayoutToGridOptions,
|
||||
} from "../../common/compute-card-grid-size";
|
||||
import { LovelaceLayoutOptions } from "../../types";
|
||||
import { LovelaceGridOptions } from "../../types";
|
||||
|
||||
@customElement("hui-card-layout-editor")
|
||||
export class HuiCardLayoutEditor extends LitElement {
|
||||
@@ -37,21 +37,16 @@ export class HuiCardLayoutEditor extends LitElement {
|
||||
|
||||
@property({ attribute: false }) public sectionConfig!: LovelaceSectionConfig;
|
||||
|
||||
@state() _defaultLayoutOptions?: LovelaceLayoutOptions;
|
||||
@state() _defaultGridOptions?: LovelaceGridOptions;
|
||||
|
||||
@state() public _yamlMode = false;
|
||||
|
||||
@state() public _uiAvailable = true;
|
||||
|
||||
@query("ha-yaml-editor") private _yamlEditor?: HaYamlEditor;
|
||||
|
||||
private _cardElement?: HuiCard;
|
||||
|
||||
private _mergedOptions = memoizeOne(
|
||||
(
|
||||
options?: LovelaceLayoutOptions,
|
||||
defaultOptions?: LovelaceLayoutOptions
|
||||
) => ({
|
||||
(options?: LovelaceGridOptions, defaultOptions?: LovelaceGridOptions) => ({
|
||||
...defaultOptions,
|
||||
...options,
|
||||
})
|
||||
@@ -60,19 +55,30 @@ export class HuiCardLayoutEditor extends LitElement {
|
||||
private _computeCardGridSize = memoizeOne(computeCardGridSize);
|
||||
|
||||
private _isDefault = memoizeOne(
|
||||
(options?: LovelaceLayoutOptions) =>
|
||||
options?.grid_columns === undefined && options?.grid_rows === undefined
|
||||
(options?: LovelaceGridOptions) =>
|
||||
options?.columns === undefined && options?.rows === undefined
|
||||
);
|
||||
|
||||
private _configGridOptions = (config: LovelaceCardConfig) => {
|
||||
if (config.grid_options) {
|
||||
return config.grid_options;
|
||||
}
|
||||
if (config.layout_options) {
|
||||
return migrateLayoutToGridOptions(config.layout_options);
|
||||
}
|
||||
return {};
|
||||
};
|
||||
|
||||
render() {
|
||||
const configGridOptions = this._configGridOptions(this.config);
|
||||
const options = this._mergedOptions(
|
||||
this.config.layout_options,
|
||||
this._defaultLayoutOptions
|
||||
configGridOptions,
|
||||
this._defaultGridOptions
|
||||
);
|
||||
|
||||
const value = this._computeCardGridSize(options);
|
||||
|
||||
const totalColumns = (this.sectionConfig.column_span ?? 1) * 4;
|
||||
const totalColumns = (this.sectionConfig.column_span ?? 1) * 12;
|
||||
|
||||
return html`
|
||||
<div class="header">
|
||||
@@ -130,24 +136,24 @@ export class HuiCardLayoutEditor extends LitElement {
|
||||
? html`
|
||||
<ha-yaml-editor
|
||||
.hass=${this.hass}
|
||||
.defaultValue=${this.config.layout_options}
|
||||
.defaultValue=${configGridOptions}
|
||||
@value-changed=${this._valueChanged}
|
||||
></ha-yaml-editor>
|
||||
`
|
||||
: html`
|
||||
<ha-grid-size-picker
|
||||
style=${styleMap({
|
||||
"max-width": `${totalColumns * 45 + 50}px`,
|
||||
"max-width": `${totalColumns * 20 + 50}px`,
|
||||
})}
|
||||
.columns=${totalColumns}
|
||||
.hass=${this.hass}
|
||||
.value=${value}
|
||||
.isDefault=${this._isDefault(this.config.layout_options)}
|
||||
.isDefault=${this._isDefault(configGridOptions)}
|
||||
@value-changed=${this._gridSizeChanged}
|
||||
.rowMin=${options.grid_min_rows}
|
||||
.rowMax=${options.grid_max_rows}
|
||||
.columnMin=${options.grid_min_columns}
|
||||
.columnMax=${options.grid_max_columns}
|
||||
.rowMin=${options.min_rows}
|
||||
.rowMax=${options.max_rows}
|
||||
.columnMin=${options.min_columns}
|
||||
.columnMax=${options.max_columns}
|
||||
></ha-grid-size-picker>
|
||||
<ha-settings-row>
|
||||
<span slot="heading" data-for="full-width">
|
||||
@@ -167,6 +173,19 @@ export class HuiCardLayoutEditor extends LitElement {
|
||||
>
|
||||
</ha-switch>
|
||||
</ha-settings-row>
|
||||
<ha-settings-row>
|
||||
<span slot="heading" data-for="full-width">
|
||||
${this.hass.localize(
|
||||
"ui.panel.lovelace.editor.edit_card.layout.precision_mode"
|
||||
)}
|
||||
</span>
|
||||
<span slot="description" data-for="full-width">
|
||||
${this.hass.localize(
|
||||
"ui.panel.lovelace.editor.edit_card.layout.precision_mode_helper"
|
||||
)}
|
||||
</span>
|
||||
<ha-switch name="full-precision_mode"> </ha-switch>
|
||||
</ha-settings-row>
|
||||
`}
|
||||
`;
|
||||
}
|
||||
@@ -180,11 +199,10 @@ export class HuiCardLayoutEditor extends LitElement {
|
||||
this._cardElement.config = this.config;
|
||||
this._cardElement.addEventListener("card-updated", (ev: Event) => {
|
||||
ev.stopPropagation();
|
||||
this._defaultLayoutOptions =
|
||||
this._cardElement?.getElementLayoutOptions();
|
||||
this._defaultGridOptions = this._cardElement?.getElementGridOptions();
|
||||
});
|
||||
this._cardElement.load();
|
||||
this._defaultLayoutOptions = this._cardElement.getElementLayoutOptions();
|
||||
this._defaultGridOptions = this._cardElement.getElementGridOptions();
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
@@ -211,53 +229,49 @@ export class HuiCardLayoutEditor extends LitElement {
|
||||
case 1:
|
||||
this._yamlMode = true;
|
||||
break;
|
||||
case 2:
|
||||
this._reset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private async _reset() {
|
||||
const newConfig = { ...this.config };
|
||||
delete newConfig.layout_options;
|
||||
this._yamlEditor?.setValue({});
|
||||
fireEvent(this, "value-changed", { value: newConfig });
|
||||
}
|
||||
|
||||
private _gridSizeChanged(ev: CustomEvent): void {
|
||||
ev.stopPropagation();
|
||||
const value = ev.detail.value as CardGridSize;
|
||||
|
||||
const newConfig: LovelaceCardConfig = {
|
||||
...this.config,
|
||||
layout_options: {
|
||||
...this.config.layout_options,
|
||||
grid_columns: value.columns,
|
||||
grid_rows: value.rows,
|
||||
grid_options: {
|
||||
...this.config.grid_options,
|
||||
columns: value.columns,
|
||||
rows: value.rows,
|
||||
},
|
||||
};
|
||||
|
||||
if (newConfig.layout_options!.grid_columns === undefined) {
|
||||
delete newConfig.layout_options!.grid_columns;
|
||||
}
|
||||
if (newConfig.layout_options!.grid_rows === undefined) {
|
||||
delete newConfig.layout_options!.grid_rows;
|
||||
}
|
||||
if (Object.keys(newConfig.layout_options!).length === 0) {
|
||||
delete newConfig.layout_options;
|
||||
}
|
||||
this._updateValue(newConfig);
|
||||
}
|
||||
|
||||
fireEvent(this, "value-changed", { value: newConfig });
|
||||
private _updateValue(value: LovelaceCardConfig): void {
|
||||
if (value.grid_options!.columns === undefined) {
|
||||
delete value.grid_options!.columns;
|
||||
}
|
||||
if (value.grid_options!.rows === undefined) {
|
||||
delete value.grid_options!.rows;
|
||||
}
|
||||
if (Object.keys(value.grid_options!).length === 0) {
|
||||
delete value.grid_options;
|
||||
}
|
||||
if (value.layout_options) {
|
||||
delete value.layout_options;
|
||||
}
|
||||
fireEvent(this, "value-changed", { value });
|
||||
}
|
||||
|
||||
private _valueChanged(ev: CustomEvent): void {
|
||||
ev.stopPropagation();
|
||||
const options = ev.detail.value as LovelaceLayoutOptions;
|
||||
const options = ev.detail.value as LovelaceGridOptions;
|
||||
const newConfig: LovelaceCardConfig = {
|
||||
...this.config,
|
||||
layout_options: options,
|
||||
grid_options: options,
|
||||
};
|
||||
fireEvent(this, "value-changed", { value: newConfig });
|
||||
this._updateValue(newConfig);
|
||||
}
|
||||
|
||||
private _fullWidthChanged(ev): void {
|
||||
@@ -265,14 +279,12 @@ export class HuiCardLayoutEditor extends LitElement {
|
||||
const value = ev.target.checked;
|
||||
const newConfig: LovelaceCardConfig = {
|
||||
...this.config,
|
||||
layout_options: {
|
||||
...this.config.layout_options,
|
||||
grid_columns: value
|
||||
? "full"
|
||||
: (this._defaultLayoutOptions?.grid_min_columns ?? 1),
|
||||
grid_options: {
|
||||
...this.config.grid_options,
|
||||
columns: value ? "full" : (this._defaultGridOptions?.min_columns ?? 1),
|
||||
},
|
||||
};
|
||||
fireEvent(this, "value-changed", { value: newConfig });
|
||||
this._updateValue(newConfig);
|
||||
}
|
||||
|
||||
static styles = [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { assert, assign, object, optional, string } from "superstruct";
|
||||
import { assert, assign, boolean, object, optional, string } from "superstruct";
|
||||
import { isComponentLoaded } from "../../../../common/config/is_component_loaded";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import "../../../../components/ha-alert";
|
||||
@@ -18,6 +18,7 @@ const cardConfigStruct = assign(
|
||||
title: optional(string()),
|
||||
theme: optional(string()),
|
||||
entity: optional(string()),
|
||||
hide_completed: optional(boolean()),
|
||||
})
|
||||
);
|
||||
|
||||
@@ -30,6 +31,7 @@ const SCHEMA = [
|
||||
},
|
||||
},
|
||||
{ name: "theme", selector: { theme: {} } },
|
||||
{ name: "hide_completed", selector: { boolean: {} } },
|
||||
] as const;
|
||||
|
||||
@customElement("hui-todo-list-card-editor")
|
||||
@@ -87,6 +89,10 @@ export class HuiTodoListEditor
|
||||
)} (${this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.card.config.optional"
|
||||
)})`;
|
||||
case "hide_completed":
|
||||
return this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.card.todo-list.hide_completed"
|
||||
);
|
||||
default:
|
||||
return this.hass!.localize(
|
||||
`ui.panel.lovelace.editor.card.generic.${schema.name}`
|
||||
|
||||
@@ -36,7 +36,7 @@ export const DEFAULT_CONFIG: Partial<EntityHeadingBadgeConfig> = {
|
||||
|
||||
const entityConfigStruct = object({
|
||||
type: optional(string()),
|
||||
entity: string(),
|
||||
entity: optional(string()),
|
||||
name: optional(string()),
|
||||
icon: optional(string()),
|
||||
state_content: optional(union([string(), array(string())])),
|
||||
|
||||
@@ -61,6 +61,11 @@ const actionConfigStructAssist = type({
|
||||
start_listening: optional(boolean()),
|
||||
});
|
||||
|
||||
const actionConfigStructMoreInfo = type({
|
||||
action: literal("more-info"),
|
||||
entity_id: optional(string()),
|
||||
});
|
||||
|
||||
export const actionConfigStructType = object({
|
||||
action: enums([
|
||||
"none",
|
||||
@@ -93,6 +98,9 @@ export const actionConfigStruct = dynamic<any>((value) => {
|
||||
case "assist": {
|
||||
return actionConfigStructAssist;
|
||||
}
|
||||
case "more-info": {
|
||||
return actionConfigStructMoreInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,5 +4,6 @@ export const baseLovelaceCardConfig = object({
|
||||
type: string(),
|
||||
view_layout: any(),
|
||||
layout_options: any(),
|
||||
grid_options: any(),
|
||||
visibility: any(),
|
||||
});
|
||||
|
||||
@@ -84,9 +84,9 @@ export class GridSection extends LitElement implements LovelaceSectionElement {
|
||||
(_cardConfig, idx) => {
|
||||
const card = this.cards![idx];
|
||||
card.layout = "grid";
|
||||
const layoutOptions = card.getLayoutOptions();
|
||||
const gridOptions = card.getGridOptions();
|
||||
|
||||
const { rows, columns } = computeCardGridSize(layoutOptions);
|
||||
const { rows, columns } = computeCardGridSize(gridOptions);
|
||||
|
||||
return html`
|
||||
<div
|
||||
@@ -96,7 +96,7 @@ export class GridSection extends LitElement implements LovelaceSectionElement {
|
||||
"--row-size": typeof rows === "number" ? rows : undefined,
|
||||
})}
|
||||
class="card ${classMap({
|
||||
"fit-rows": typeof layoutOptions?.grid_rows === "number",
|
||||
"fit-rows": typeof rows === "number",
|
||||
"full-width": columns === "full",
|
||||
})}"
|
||||
>
|
||||
@@ -165,7 +165,7 @@ export class GridSection extends LitElement implements LovelaceSectionElement {
|
||||
haStyle,
|
||||
css`
|
||||
:host {
|
||||
--base-column-count: 4;
|
||||
--base-column-count: 12;
|
||||
--row-gap: var(--ha-section-grid-row-gap, 8px);
|
||||
--column-gap: var(--ha-section-grid-column-gap, 8px);
|
||||
--row-height: var(--ha-section-grid-row-height, 56px);
|
||||
@@ -204,6 +204,10 @@ export class GridSection extends LitElement implements LovelaceSectionElement {
|
||||
grid-column: span min(var(--column-size, 1), var(--grid-column-count));
|
||||
}
|
||||
|
||||
.container.edit-mode .card {
|
||||
min-height: calc((var(--row-height) - var(--row-gap)) / 2);
|
||||
}
|
||||
|
||||
.card.fit-rows {
|
||||
height: calc(
|
||||
(var(--row-size, 1) * (var(--row-height) + var(--row-gap))) - var(
|
||||
@@ -226,8 +230,8 @@ export class GridSection extends LitElement implements LovelaceSectionElement {
|
||||
|
||||
.add {
|
||||
outline: none;
|
||||
grid-row: span var(--row-size, 1);
|
||||
grid-column: span var(--column-size, 2);
|
||||
grid-row: span 1;
|
||||
grid-column: span 6;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
border-radius: var(--ha-card-border-radius, 12px);
|
||||
|
||||
@@ -51,12 +51,23 @@ export type LovelaceLayoutOptions = {
|
||||
grid_max_rows?: number;
|
||||
};
|
||||
|
||||
export type LovelaceGridOptions = {
|
||||
columns?: number | "full";
|
||||
rows?: number | "auto";
|
||||
max_columns?: number;
|
||||
min_columns?: number;
|
||||
min_rows?: number;
|
||||
max_rows?: number;
|
||||
};
|
||||
|
||||
export interface LovelaceCard extends HTMLElement {
|
||||
hass?: HomeAssistant;
|
||||
preview?: boolean;
|
||||
layout?: string;
|
||||
getCardSize(): number | Promise<number>;
|
||||
/** @deprecated Use `getGridOptions` instead */
|
||||
getLayoutOptions?(): LovelaceLayoutOptions;
|
||||
getGridOptions?(): LovelaceGridOptions;
|
||||
setConfig(config: LovelaceCardConfig): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,31 +99,38 @@ class StateDisplay extends LitElement {
|
||||
if (content === "name") {
|
||||
return html`${this.name || stateObj.attributes.friendly_name}`;
|
||||
}
|
||||
|
||||
let relativeDateTime: string | undefined;
|
||||
|
||||
// Check last-changed for backwards compatibility
|
||||
if (content === "last_changed" || content === "last-changed") {
|
||||
return html`
|
||||
<ha-relative-time
|
||||
.hass=${this.hass}
|
||||
.datetime=${stateObj.last_changed}
|
||||
capitalize
|
||||
></ha-relative-time>
|
||||
`;
|
||||
relativeDateTime = stateObj.last_changed;
|
||||
}
|
||||
// Check last_updated for backwards compatibility
|
||||
if (content === "last_updated" || content === "last-updated") {
|
||||
return html`
|
||||
<ha-relative-time
|
||||
.hass=${this.hass}
|
||||
.datetime=${stateObj.last_updated}
|
||||
capitalize
|
||||
></ha-relative-time>
|
||||
`;
|
||||
relativeDateTime = stateObj.last_updated;
|
||||
}
|
||||
if (content === "last_triggered") {
|
||||
|
||||
if (
|
||||
content === "last_triggered" ||
|
||||
(domain === "calendar" &&
|
||||
(content === "start_time" || content === "end_time")) ||
|
||||
(domain === "sun" &&
|
||||
(content === "next_dawn" ||
|
||||
content === "next_dusk" ||
|
||||
content === "next_midnight" ||
|
||||
content === "next_noon" ||
|
||||
content === "next_rising" ||
|
||||
content === "next_setting"))
|
||||
) {
|
||||
relativeDateTime = stateObj.attributes[content];
|
||||
}
|
||||
|
||||
if (relativeDateTime) {
|
||||
return html`
|
||||
<ha-relative-time
|
||||
.hass=${this.hass}
|
||||
.datetime=${stateObj.attributes.last_triggered}
|
||||
.datetime=${relativeDateTime}
|
||||
capitalize
|
||||
></ha-relative-time>
|
||||
`;
|
||||
|
||||
@@ -1191,7 +1191,9 @@
|
||||
"skip": "Skip",
|
||||
"clear_skipped": "Clear skipped",
|
||||
"install": "Install",
|
||||
"create_backup": "Create backup before updating"
|
||||
"create_backup": "Create backup before updating",
|
||||
"auto_update_enabled_title": "Can not skip version",
|
||||
"auto_update_enabled_text": "Automatic updates for this item have been enabled; skipping it is, therefore, unavailable. You can either install this update now or wait for Home Assistant to do it automatically."
|
||||
},
|
||||
"updater": {
|
||||
"title": "Update instructions"
|
||||
@@ -1633,7 +1635,8 @@
|
||||
"zigbee_information": "View the Zigbee information for the device."
|
||||
},
|
||||
"confirmations": {
|
||||
"remove": "Are you sure that you want to remove the device?"
|
||||
"remove_title": "Remove device",
|
||||
"remove_text": "This device will be permanently removed from the Zigbee network."
|
||||
},
|
||||
"quirk": "Quirk",
|
||||
"last_seen": "Last seen",
|
||||
@@ -4039,18 +4042,25 @@
|
||||
"unknown_automation": "Unknown automation",
|
||||
"create": "Create automation with {type}",
|
||||
"create_disable": "Can't create automation with disabled {type}",
|
||||
"new": {
|
||||
"title": "Create new automation",
|
||||
"description": "Start with an empty automation from scratch"
|
||||
},
|
||||
"triggers": {
|
||||
"caption": "Do something when…",
|
||||
"title": "Use device as trigger",
|
||||
"description": "When something happens to the device",
|
||||
"no_triggers": "No triggers",
|
||||
"unknown_trigger": "Unknown trigger"
|
||||
},
|
||||
"conditions": {
|
||||
"caption": "Only do something if…",
|
||||
"title": "Use device as condition",
|
||||
"description": "Only if a condition is met for the device",
|
||||
"no_conditions": "No conditions",
|
||||
"unknown_condition": "Unknown condition"
|
||||
},
|
||||
"actions": {
|
||||
"caption": "When something is triggered…",
|
||||
"title": "Use device as action",
|
||||
"description": "Do something on the device",
|
||||
"no_actions": "No actions",
|
||||
"unknown_action": "Unknown action"
|
||||
},
|
||||
@@ -4061,7 +4071,15 @@
|
||||
"scripts": "scripts",
|
||||
"no_scripts": "No scripts",
|
||||
"create": "Create script with {type}",
|
||||
"create_disable": "Can't create script with disabled {type}"
|
||||
"create_disable": "Can't create script with disabled {type}",
|
||||
"new": {
|
||||
"title": "Create new script",
|
||||
"description": "Start with an empty script from scratch"
|
||||
},
|
||||
"actions": {
|
||||
"title": "Use device as action",
|
||||
"description": "Do something on this device."
|
||||
}
|
||||
},
|
||||
"scene": {
|
||||
"scenes_heading": "Scenes",
|
||||
@@ -4590,6 +4608,7 @@
|
||||
"confirm_delete_dataset": "Delete {name} dataset?",
|
||||
"confirm_delete_dataset_text": "This network will be removed from Home Assistant.",
|
||||
"no_border_routers": "No border routers found",
|
||||
"no_preferred_router": "No preferred border router defined",
|
||||
"border_routers": "{count} border {count, plural,\n one {router}\n other {routers}\n}",
|
||||
"managed_by_home_assistant": "Managed by Home Assistant",
|
||||
"operational_dataset": "Operational dataset",
|
||||
@@ -5626,7 +5645,9 @@
|
||||
},
|
||||
"layout": {
|
||||
"full_width": "Full width card",
|
||||
"full_width_helper": "Take up the full width of the section whatever its size"
|
||||
"full_width_helper": "Take up the full width of the section whatever its size",
|
||||
"precision_mode": "Precision mode",
|
||||
"precision_mode_helper": "Change the card width with precision without limits"
|
||||
}
|
||||
},
|
||||
"edit_badge": {
|
||||
@@ -6113,7 +6134,8 @@
|
||||
"todo-list": {
|
||||
"name": "To-do list",
|
||||
"description": "The to-do list card allows you to add, edit, check-off, and clear items from your to-do list.",
|
||||
"integration_not_loaded": "This card requires the `todo` integration to be set up."
|
||||
"integration_not_loaded": "This card requires the `todo` integration to be set up.",
|
||||
"hide_completed": "Hide completed items"
|
||||
},
|
||||
"thermostat": {
|
||||
"name": "Thermostat",
|
||||
@@ -6881,7 +6903,8 @@
|
||||
"stop_listening": "Stop listening",
|
||||
"clear_events": "Clear events",
|
||||
"alert_event_type": "Event type is a mandatory field",
|
||||
"notification_event_fired": "Event {type} successfully fired!"
|
||||
"notification_event_fired": "Event {type} successfully fired!",
|
||||
"subscribe_failed": "Failed to subscribe to event: {error}"
|
||||
},
|
||||
"actions": {
|
||||
"title": "Actions",
|
||||
|
||||
Reference in New Issue
Block a user