-
- ${this._blueprints
- ? Object.keys(this._blueprints).length
- ? html`
-
- `
- : this.hass.localize(
- "ui.panel.config.automation.editor.blueprint.no_blueprints"
- )
- : html``}
-
- ${this.hass.localize(
- "ui.panel.config.automation.editor.blueprint.manage_blueprints"
- )}
-
-
-
- ${this.config.use_blueprint.path
- ? blueprint && "error" in blueprint
- ? html`
- There is an error in this Blueprint: ${blueprint.error}
-
`
- : html`${blueprint?.metadata.description
- ? html`
${blueprint.metadata.description}
`
- : ""}
- ${blueprint?.metadata?.input &&
- Object.keys(blueprint.metadata.input).length
- ? html`
- ${this.hass.localize(
- "ui.panel.config.automation.editor.blueprint.inputs"
- )}
-
- ${Object.entries(blueprint.metadata.input).map(
- ([key, value]) =>
- html`
- ${value?.description}
- ${value?.selector
- ? html`
`
- : html`
`}
-
`
- )}`
- : this.hass.localize(
- "ui.panel.config.automation.editor.blueprint.no_inputs"
- )}`
- : ""}
+
+ ${this._blueprints
+ ? Object.keys(this._blueprints).length
+ ? html`
+
+ `
+ : this.hass.localize(
+ "ui.panel.config.automation.editor.blueprint.no_blueprints"
+ )
+ : html``}
+
+ ${this.hass.localize(
+ "ui.panel.config.automation.editor.blueprint.manage_blueprints"
+ )}
+
+
+ ${this.config.use_blueprint.path
+ ? blueprint && "error" in blueprint
+ ? html`
+ There is an error in this Blueprint: ${blueprint.error}
+
`
+ : html`${blueprint?.metadata.description
+ ? html`
${blueprint.metadata.description}
`
+ : ""}
+ ${blueprint?.metadata?.input &&
+ Object.keys(blueprint.metadata.input).length
+ ? html`
+ ${this.hass.localize(
+ "ui.panel.config.automation.editor.blueprint.inputs"
+ )}
+
+ ${Object.entries(blueprint.metadata.input).map(
+ ([key, value]) =>
+ html`
+ ${value?.name || key}
+ ${value?.description}
+ ${value?.selector
+ ? html``
+ : html``}
+ `
+ )}`
+ : html`
+ ${this.hass.localize(
+ "ui.panel.config.automation.editor.blueprint.no_inputs"
+ )}
+
`}`
+ : ""}
`;
}
@@ -279,16 +283,20 @@ export class HaBlueprintAutomationEditor extends LitElement {
font-weight: bold;
color: var(--error-color);
}
+ .padding {
+ padding: 16px;
+ }
.content {
padding-bottom: 20px;
}
.blueprint-picker-container {
+ padding: 16px;
display: flex;
align-items: center;
justify-content: space-between;
}
h3 {
- margin-top: 16px;
+ margin: 16px;
}
span[slot="introduction"] a {
color: var(--primary-color);
@@ -299,6 +307,16 @@ export class HaBlueprintAutomationEditor extends LitElement {
ha-entity-toggle {
margin-right: 8px;
}
+ ha-settings-row {
+ --paper-time-input-justify-content: flex-end;
+ border-top: 1px solid var(--divider-color);
+ }
+ :host(:not([narrow])) ha-settings-row paper-input {
+ width: 50%;
+ }
+ :host(:not([narrow])) ha-settings-row ha-selector {
+ width: 50%;
+ }
mwc-fab {
position: relative;
bottom: calc(-80px - env(safe-area-inset-bottom));
diff --git a/src/panels/config/automation/ha-automation-editor.ts b/src/panels/config/automation/ha-automation-editor.ts
index e6b785e01f..a544fc3215 100644
--- a/src/panels/config/automation/ha-automation-editor.ts
+++ b/src/panels/config/automation/ha-automation-editor.ts
@@ -205,12 +205,14 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
${"use_blueprint" in this._config
? html`
`
: html`
${this._result.blueprint.metadata.name}`,
"domain",
this._result.blueprint.metadata.domain
- )}
+ )}
+
+ ${this._result.blueprint.metadata.description}
${this._result.validation_errors
? html`
@@ -94,7 +97,14 @@ class DialogImportBlueprint extends LitElement {
)}
>
`}
-
${this._result.raw_data}
`
+
+ ${this.hass.localize(
+ "ui.panel.config.blueprint.add.raw_blueprint"
+ )}
+ ${this._result.raw_data}
+ `
: html`${this.hass.localize(
"ui.panel.config.blueprint.add.import_introduction"
)} {
- const columns: DataTableColumnContainer = {
- name: {
- title: this.hass.localize(
- "ui.panel.config.blueprint.overview.headers.name"
- ),
- sortable: true,
- filterable: true,
- direction: "asc",
- grows: true,
- },
- };
-
- if (narrow) {
- columns.name.template = (name, entity: any) => {
- return html`
- ${name}
-
- ${entity.path}
-
- `;
- };
- columns.create = {
- title: "",
- type: "icon-button",
- template: (_, blueprint: any) =>
- blueprint.error
- ? ""
- : html` this._createNew(ev)}
- >`,
- };
- } else {
- columns.path = {
- title: this.hass.localize(
- "ui.panel.config.blueprint.overview.headers.file_name"
- ),
- sortable: true,
- filterable: true,
- direction: "asc",
- width: "25%",
- };
- columns.create = {
- title: "",
- width: "180px",
- template: (_, blueprint: any) =>
- blueprint.error
- ? ""
- : html` this._createNew(ev)}
- >
- ${this.hass.localize(
- "ui.panel.config.blueprint.overview.use_blueprint"
- )}
- `,
- };
- }
-
- columns.delete = {
+ (narrow, _language): DataTableColumnContainer => ({
+ name: {
+ title: this.hass.localize(
+ "ui.panel.config.blueprint.overview.headers.name"
+ ),
+ sortable: true,
+ filterable: true,
+ direction: "asc",
+ grows: true,
+ template: narrow
+ ? (name, entity: any) =>
+ html`
+ ${name}
+
+ ${entity.path}
+
+ `
+ : undefined,
+ },
+ path: {
+ title: this.hass.localize(
+ "ui.panel.config.blueprint.overview.headers.file_name"
+ ),
+ sortable: true,
+ filterable: true,
+ hidden: narrow,
+ direction: "asc",
+ width: "25%",
+ },
+ create: {
+ title: "",
+ type: narrow ? "icon-button" : undefined,
+ width: narrow ? undefined : "180px",
+ template: (_, blueprint: any) =>
+ blueprint.error
+ ? ""
+ : narrow
+ ? html` this._createNew(ev)}
+ >`
+ : html` this._createNew(ev)}
+ >
+ ${this.hass.localize(
+ "ui.panel.config.blueprint.overview.use_blueprint"
+ )}
+ `,
+ },
+ delete: {
title: "",
type: "icon-button",
template: (_, blueprint: any) =>
@@ -161,10 +151,8 @@ class HaBlueprintOverview extends LitElement {
@click=${(ev) => this._delete(ev)}
>`,
- };
-
- return columns;
- }
+ },
+ })
);
protected render(): TemplateResult {
diff --git a/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts
index 77f971e6c8..e36441c6e2 100644
--- a/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts
+++ b/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts
@@ -6,6 +6,7 @@ import {
internalProperty,
PropertyValues,
TemplateResult,
+ query,
} from "lit-element";
import "../../../components/ha-date-input";
import type { HaDateInput } from "../../../components/ha-date-input";
@@ -25,6 +26,10 @@ class HuiInputDatetimeEntityRow extends LitElement implements LovelaceRow {
@internalProperty() private _config?: EntityConfig;
+ @query("paper-time-input") private _timeInputEl?: PaperTimeInput;
+
+ @query("ha-date-input") private _dateInputEl?: HaDateInput;
+
public setConfig(config: EntityConfig): void {
if (!config) {
throw new Error("Invalid configuration");
@@ -74,11 +79,10 @@ class HuiInputDatetimeEntityRow extends LitElement implements LovelaceRow {
.min=${stateObj.state === UNKNOWN
? ""
: ("0" + stateObj.attributes.minute).slice(-2)}
- .amPm=${false}
@change=${this._selectedValueChanged}
@click=${this._stopEventPropagation}
hide-label
- format="24"
+ .format=${24}
>
`
: ``}
@@ -90,24 +94,14 @@ class HuiInputDatetimeEntityRow extends LitElement implements LovelaceRow {
ev.stopPropagation();
}
- private get _timeInputEl(): PaperTimeInput {
- return this.shadowRoot!.querySelector("paper-time-input")!;
- }
-
- private get _dateInputEl(): HaDateInput {
- return this.shadowRoot!.querySelector("ha-date-input")!;
- }
-
private _selectedValueChanged(ev): void {
const stateObj = this.hass!.states[this._config!.entity];
- const time =
- this._timeInputEl !== null
- ? this._timeInputEl.value.trim() + ":00"
- : undefined;
+ const time = this._timeInputEl
+ ? this._timeInputEl.value?.trim()
+ : undefined;
- const date =
- this._dateInputEl !== null ? this._dateInputEl.value : undefined;
+ const date = this._dateInputEl ? this._dateInputEl.value : undefined;
if (time !== stateObj.state) {
setInputDateTimeValue(this.hass!, stateObj.entity_id, time, date);
diff --git a/src/translations/en.json b/src/translations/en.json
index 86b06bb91b..d00b1e1933 100755
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -1453,7 +1453,7 @@
},
"confirm_delete_header": "Delete this blueprint?",
"confirm_delete_text": "Are you sure you want to delete this blueprint?",
- "add_blueprint": "Add blueprint",
+ "add_blueprint": "Import blueprint",
"use_blueprint": "Create automation",
"delete_blueprint": "Delete blueprint"
},
@@ -1462,6 +1462,7 @@
"import_header": "Import \"{name}\" (type: {domain})",
"import_introduction": "You can import blueprints of other users from Github and the community forums. Enter the URL of the blueprint below.",
"url": "URL of the blueprint",
+ "raw_blueprint": "Blueprint content",
"importing": "Importing blueprint...",
"import_btn": "Import blueprint",
"saving": "Saving blueprint...",