Add description and device class (#7816)

https://github.com/home-assistant/core/pull/43321
This commit is contained in:
Bram Kragten 2020-11-25 15:10:08 +01:00 committed by GitHub
parent fc48c59eb0
commit 89175f8e85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 32 deletions

View File

@ -56,6 +56,14 @@ export class HaEntitySelector extends SubscribeMixin(LitElement) {
return false;
}
}
if (this.selector.entity.device_class) {
if (
!entity.attributes.device_class ||
entity.attributes.device_class !== this.selector.entity.device_class
) {
return false;
}
}
if (this.selector.entity.integration) {
if (
!this._entities ||

View File

@ -11,6 +11,7 @@ export interface Blueprint {
export interface BlueprintMetaData {
domain: string;
name: string;
description?: string;
input: Record<string, BlueprintInput | null>;
}

View File

@ -4,6 +4,7 @@ export interface EntitySelector {
entity: {
integration?: string;
domain?: string;
device_class?: string;
};
}

View File

@ -156,7 +156,10 @@ export class HaBlueprintAutomationEditor extends LitElement {
? html`<p class="warning">
There is an error in this Blueprint: ${blueprint.error}
</p>`
: blueprint?.metadata?.input &&
: html`${blueprint?.metadata.description
? html`<p>${blueprint.metadata.description}</p>`
: ""}
${blueprint?.metadata?.input &&
Object.keys(blueprint.metadata.input).length
? html`<h3>
${this.hass.localize(
@ -188,7 +191,7 @@ export class HaBlueprintAutomationEditor extends LitElement {
)}`
: this.hass.localize(
"ui.panel.config.automation.editor.blueprint.no_inputs"
)
)}`
: ""}
</div>
</ha-card>