mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-28 23:37:20 +00:00
Add description and device class (#7816)
https://github.com/home-assistant/core/pull/43321
This commit is contained in:
parent
fc48c59eb0
commit
89175f8e85
@ -56,6 +56,14 @@ export class HaEntitySelector extends SubscribeMixin(LitElement) {
|
|||||||
return false;
|
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.selector.entity.integration) {
|
||||||
if (
|
if (
|
||||||
!this._entities ||
|
!this._entities ||
|
||||||
|
@ -11,6 +11,7 @@ export interface Blueprint {
|
|||||||
export interface BlueprintMetaData {
|
export interface BlueprintMetaData {
|
||||||
domain: string;
|
domain: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
description?: string;
|
||||||
input: Record<string, BlueprintInput | null>;
|
input: Record<string, BlueprintInput | null>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ export interface EntitySelector {
|
|||||||
entity: {
|
entity: {
|
||||||
integration?: string;
|
integration?: string;
|
||||||
domain?: string;
|
domain?: string;
|
||||||
|
device_class?: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,39 +156,42 @@ export class HaBlueprintAutomationEditor extends LitElement {
|
|||||||
? html`<p class="warning">
|
? html`<p class="warning">
|
||||||
There is an error in this Blueprint: ${blueprint.error}
|
There is an error in this Blueprint: ${blueprint.error}
|
||||||
</p>`
|
</p>`
|
||||||
: blueprint?.metadata?.input &&
|
: html`${blueprint?.metadata.description
|
||||||
|
? html`<p>${blueprint.metadata.description}</p>`
|
||||||
|
: ""}
|
||||||
|
${blueprint?.metadata?.input &&
|
||||||
Object.keys(blueprint.metadata.input).length
|
Object.keys(blueprint.metadata.input).length
|
||||||
? html`<h3>
|
? html`<h3>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.blueprint.inputs"
|
"ui.panel.config.automation.editor.blueprint.inputs"
|
||||||
)}
|
)}
|
||||||
</h3>
|
</h3>
|
||||||
${Object.entries(blueprint.metadata.input).map(
|
${Object.entries(blueprint.metadata.input).map(
|
||||||
([key, value]) =>
|
([key, value]) =>
|
||||||
html`<div>
|
html`<div>
|
||||||
${value?.description}
|
${value?.description}
|
||||||
${value?.selector
|
${value?.selector
|
||||||
? html`<ha-selector
|
? html`<ha-selector
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.selector=${value.selector}
|
.selector=${value.selector}
|
||||||
.key=${key}
|
.key=${key}
|
||||||
.label=${value?.name || key}
|
.label=${value?.name || key}
|
||||||
.value=${this.config.use_blueprint.input &&
|
.value=${this.config.use_blueprint.input &&
|
||||||
this.config.use_blueprint.input[key]}
|
this.config.use_blueprint.input[key]}
|
||||||
@value-changed=${this._inputChanged}
|
@value-changed=${this._inputChanged}
|
||||||
></ha-selector>`
|
></ha-selector>`
|
||||||
: html`<paper-input
|
: html`<paper-input
|
||||||
.key=${key}
|
.key=${key}
|
||||||
.label=${value?.name || key}
|
.label=${value?.name || key}
|
||||||
.value=${this.config.use_blueprint.input &&
|
.value=${this.config.use_blueprint.input &&
|
||||||
this.config.use_blueprint.input[key]}
|
this.config.use_blueprint.input[key]}
|
||||||
@value-changed=${this._inputChanged}
|
@value-changed=${this._inputChanged}
|
||||||
></paper-input>`}
|
></paper-input>`}
|
||||||
</div>`
|
</div>`
|
||||||
)}`
|
)}`
|
||||||
: this.hass.localize(
|
: this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.blueprint.no_inputs"
|
"ui.panel.config.automation.editor.blueprint.no_inputs"
|
||||||
)
|
)}`
|
||||||
: ""}
|
: ""}
|
||||||
</div>
|
</div>
|
||||||
</ha-card>
|
</ha-card>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user