Compare commits

...

13 Commits

Author SHA1 Message Date
Bram Kragten
b4e5740050 Fix race condition in zwave migration (#8268) 2021-01-28 20:59:54 +01:00
Bram Kragten
12bb3f5796 Use close dialog function to close device registry detail dialog (#8269) 2021-01-28 20:59:37 +01:00
Bram Kragten
ff62fdb69d hide config links in demo (#8267) 2021-01-28 20:59:15 +01:00
Bram Kragten
4ebf32cb1f Move try tss button to bottom (#8266) 2021-01-28 20:58:59 +01:00
Thomas Lovén
5afb8a77a9 Make input_text entity row usable when value is "unknown" (#8258) 2021-01-28 20:58:43 +01:00
Jaroslav Hanslík
48ed33af95 Typo in texts (#8265) 2021-01-28 20:58:26 +01:00
Jaroslav Hanslík
4a64cd4464 Typo in texts (#8264) 2021-01-28 20:58:12 +01:00
Paulus Schoutsen
8ae1a1b558 Fix tts (#8261) 2021-01-28 20:57:56 +01:00
Philip Allgaier
ef1dd8b761 Add check to prevent undefined access during action validation (#8257) 2021-01-28 20:57:41 +01:00
Bram Kragten
3766f44787 Bumped version to 20210127.2 2021-01-28 20:57:15 +01:00
Bram Kragten
178605664e Bumped version to 20210127.1 2021-01-27 17:17:48 +01:00
Joakim Sørensen
0cf8004b8d Add twine to release flow (#8254) 2021-01-27 17:14:00 +01:00
Bram Kragten
00412c7216 Merge pull request #8252 from home-assistant/dev 2021-01-27 16:24:07 +01:00
13 changed files with 89 additions and 63 deletions

View File

@@ -33,6 +33,7 @@ jobs:
- name: Build and release package
run: |
python3 -m pip install twine
export TWINE_USERNAME="__token__"
export TWINE_PASSWORD="${{ secrets.TWINE_TOKEN }}"

View File

@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="home-assistant-frontend",
version="20210127.0",
version="20210127.2",
description="The Home Assistant frontend",
url="https://github.com/home-assistant/home-assistant-polymer",
author="The Home Assistant Authors",

View File

@@ -202,9 +202,8 @@ export class HaForm extends LitElement implements HaFormElement {
ev.stopPropagation();
const schema = (ev.target as HaFormElement).schema as HaFormSchema;
const data = this.data as HaFormDataContainer;
data[schema.name] = ev.detail.value;
fireEvent(this, "value-changed", {
value: { ...data },
value: { ...data, [schema.name]: ev.detail.value },
});
}

View File

@@ -9,4 +9,4 @@ export const convertTextToSpeech = (
language?: string;
options?: Record<string, unknown>;
}
) => hass.callApi<{ url: string }>("POST", "tts_get_url", data);
) => hass.callApi<{ url: string; path: string }>("POST", "tts_get_url", data);

View File

@@ -78,6 +78,9 @@ export class MoreInfoDialog extends LitElement {
}
protected shouldShowEditIcon(domain, stateObj): boolean {
if (__DEMO__) {
return false;
}
if (EDITABLE_DOMAINS_WITH_ID.includes(domain) && stateObj.attributes.id) {
return true;
}

View File

@@ -2,7 +2,6 @@ import "@polymer/paper-dropdown-menu/paper-dropdown-menu-light";
import "@polymer/paper-item/paper-item";
import "@polymer/paper-listbox/paper-listbox";
import "@material/mwc-button";
import { mdiPlayCircleOutline } from "@mdi/js";
import {
css,
CSSResult,
@@ -59,12 +58,6 @@ export class CloudTTSPref extends LitElement {
<ha-card
header=${this.hass.localize("ui.panel.config.cloud.account.tts.title")}
>
<div class="example">
<mwc-button @click=${this._openTryDialog}>
<ha-svg-icon .path=${mdiPlayCircleOutline}></ha-svg-icon>
&nbsp;${this.hass.localize("ui.panel.config.cloud.account.tts.try")}
</mwc-button>
</div>
<div class="card-content">
${this.hass.localize(
"ui.panel.config.cloud.account.tts.info",
@@ -112,6 +105,11 @@ export class CloudTTSPref extends LitElement {
</paper-listbox>
</paper-dropdown-menu-light>
</div>
<div class="card-actions">
<mwc-button @click=${this._openTryDialog}>
${this.hass.localize("ui.panel.config.cloud.account.tts.try")}
</mwc-button>
</div>
</ha-card>
`;
}

View File

@@ -164,7 +164,7 @@ export class DialogTryTts extends LitElement {
language,
options: { gender },
});
url = result.url;
url = result.path;
} catch (err) {
this._loadingExample = false;
showAlertDialog(this, {

View File

@@ -149,7 +149,7 @@ class DialogDeviceRegistryDetail extends LitElement {
area_id: this._areaId || null,
disabled_by: this._disabledBy || null,
});
this._params = undefined;
this.closeDialog();
} catch (err) {
this._error =
err.message ||

View File

@@ -37,8 +37,7 @@ import { showAlertDialog } from "../../../../../dialogs/generic/show-dialog-box"
import { computeStateName } from "../../../../../common/entity/compute_state_name";
import {
computeDeviceName,
DeviceRegistryEntry,
fetchDeviceRegistry,
subscribeDeviceRegistry,
} from "../../../../../data/device_registry";
@customElement("zwave-migration")
@@ -53,8 +52,6 @@ export class ZwaveMigration extends LitElement {
@internalProperty() private _networkStatus?: ZWaveNetworkStatus;
@internalProperty() private _unsub?: Promise<UnsubscribeFunc>;
@internalProperty() private _step = 0;
@internalProperty() private _stoppingNetwork = false;
@@ -65,10 +62,18 @@ export class ZwaveMigration extends LitElement {
@internalProperty() private _migratedZwaveEntities?: string[];
@internalProperty() private _deviceRegistry?: DeviceRegistryEntry[];
@internalProperty() private _deviceNameLookup: { [id: string]: string } = {};
private _unsub?: Promise<UnsubscribeFunc>;
private _unsubDevices?: UnsubscribeFunc;
public disconnectedCallback(): void {
this._unsubscribe();
if (this._unsubDevices) {
this._unsubDevices();
this._unsubDevices = undefined;
}
}
protected render(): TemplateResult {
@@ -89,7 +94,8 @@ export class ZwaveMigration extends LitElement {
"ui.panel.config.zwave.migration.ozw.introduction"
)}
</div>
${!this.hass.config.components.includes("mqtt")
${!this.hass.config.components.includes("hassio") &&
!this.hass.config.components.includes("mqtt")
? html`
<ha-card class="content" header="MQTT Required">
<div class="card-content">
@@ -277,9 +283,9 @@ export class ZwaveMigration extends LitElement {
).map(
(device_id) =>
html`<li>
${this._computeDeviceName(
${this._deviceNameLookup[
device_id
)}
] || device_id}
</li>`
)}
</ul>`
@@ -372,10 +378,7 @@ export class ZwaveMigration extends LitElement {
private async _setupOzw() {
const ozwConfigFlow = await startOzwConfigFlow(this.hass);
if (
!this.hass.config.components.includes("hassio") &&
this.hass.config.components.includes("ozw")
) {
if (this.hass.config.components.includes("ozw")) {
this._getMigrationData();
this._step = 3;
return;
@@ -399,18 +402,29 @@ export class ZwaveMigration extends LitElement {
this._migrationData.migration_entity_map
);
if (Object.keys(this._migrationData.migration_device_map).length) {
this._deviceRegistry = await fetchDeviceRegistry(this.hass);
this._fetchDevices();
}
}
private _computeDeviceName(deviceId) {
const device = this._deviceRegistry?.find(
(devReg) => devReg.id === deviceId
private _fetchDevices() {
this._unsubDevices = subscribeDeviceRegistry(
this.hass.connection,
(devices) => {
if (!this._migrationData) {
return;
}
const migrationDevices = Object.keys(
this._migrationData.migration_device_map
);
const deviceNameLookup = {};
devices.forEach((device) => {
if (migrationDevices.includes(device.id)) {
deviceNameLookup[device.id] = computeDeviceName(device, this.hass);
}
});
this._deviceNameLookup = deviceNameLookup;
}
);
if (!device) {
return deviceId;
}
return computeDeviceName(device, this.hass);
}
private async _doMigrate() {

View File

@@ -96,8 +96,14 @@ export interface EditSubElementEvent {
}
export const actionConfigStruct = dynamic((_value, ctx) => {
const test = actionConfigMap[ctx.branch[0][ctx.path[0]].action];
return test || actionConfigStructType;
if (ctx.branch[0][ctx.path[0]]) {
return (
actionConfigMap[ctx.branch[0][ctx.path[0]].action] ||
actionConfigStructType
);
}
return actionConfigStructType;
});
const actionConfigStructUser = object({

View File

@@ -10,7 +10,7 @@ import {
PropertyValues,
TemplateResult,
} from "lit-element";
import { UNAVAILABLE_STATES } from "../../../data/entity";
import { UNAVAILABLE } from "../../../data/entity";
import { setValue } from "../../../data/input_text";
import { HomeAssistant } from "../../../types";
import { hasConfigOrEntityChanged } from "../common/has-changed";
@@ -54,7 +54,7 @@ class HuiInputTextEntityRow extends LitElement implements LovelaceRow {
<hui-generic-entity-row .hass=${this.hass} .config=${this._config}>
<paper-input
no-label-float
.disabled=${UNAVAILABLE_STATES.includes(stateObj.state)}
.disabled=${stateObj.state === UNAVAILABLE}
.value="${stateObj.state}"
.minlength="${stateObj.attributes.min}"
.maxlength="${stateObj.attributes.max}"

View File

@@ -189,30 +189,6 @@ class HUIRoot extends LitElement {
)}
</mwc-list-item>
`}
<mwc-list-item
graphic="icon"
@request-selected="${this._handleManageDashboards}"
>
<ha-svg-icon
slot="graphic"
.path=${mdiViewDashboard}
></ha-svg-icon>
${this.hass!.localize(
"ui.panel.lovelace.editor.menu.manage_dashboards"
)}
</mwc-list-item>
<mwc-list-item
graphic="icon"
@request-selected="${this._handleManageResources}"
>
<ha-svg-icon
slot="graphic"
.path=${mdiFileMultiple}
></ha-svg-icon>
${this.hass!.localize(
"ui.panel.lovelace.editor.menu.manage_resources"
)}
</mwc-list-item>
<mwc-list-item
graphic="icon"
@request-selected="${this._handleRawEditor}"
@@ -225,6 +201,35 @@ class HUIRoot extends LitElement {
"ui.panel.lovelace.editor.menu.raw_editor"
)}
</mwc-list-item>
${__DEMO__ /* No config available in the demo */
? ""
: html`<mwc-list-item
graphic="icon"
@request-selected="${this._handleManageDashboards}"
>
<ha-svg-icon
slot="graphic"
.path=${mdiViewDashboard}
></ha-svg-icon>
${this.hass!.localize(
"ui.panel.lovelace.editor.menu.manage_dashboards"
)}
</mwc-list-item>
${this.hass.userData?.showAdvanced
? html`<mwc-list-item
graphic="icon"
@request-selected="${this
._handleManageResources}"
>
<ha-svg-icon
slot="graphic"
.path=${mdiFileMultiple}
></ha-svg-icon>
${this.hass!.localize(
"ui.panel.lovelace.editor.menu.manage_resources"
)}
</mwc-list-item>`
: ""} `}
</ha-button-menu>
</app-toolbar>
`

View File

@@ -774,7 +774,7 @@
"edit_in_yaml_supported": "You can still edit your config in YAML.",
"key_missing": "Required key \"{key}\" is missing.",
"key_not_expected": "Key \"{key}\" is not expected or not supported by the visual editor.",
"key_wrong_type": "The provided value for \"{key}\" is not supported by the visual editor editor. We support ({type_correct}) but received ({type_wrong})."
"key_wrong_type": "The provided value for \"{key}\" is not supported by the visual editor. We support ({type_correct}) but received ({type_wrong})."
}
},
"login-form": {
@@ -2505,7 +2505,7 @@
"cards": {
"confirm_delete": "Are you sure you want to delete this card?",
"actions": {
"action_confirmation": "Are you sure you want to exectue action \"{action}\"?",
"action_confirmation": "Are you sure you want to execute action \"{action}\"?",
"no_entity_more_info": "No entity provided for more info dialog",
"no_entity_toggle": "No entity provided to toggle",
"no_navigation_path": "No navigation path specified",