Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/components/ha-selector/ha-selector-entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down
1 change: 1 addition & 0 deletions src/data/blueprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface Blueprint {
export interface BlueprintMetaData {
domain: string;
name: string;
description?: string;
input: Record<string, BlueprintInput | null>;
}

Expand Down
1 change: 1 addition & 0 deletions src/data/selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export interface EntitySelector {
entity: {
integration?: string;
domain?: string;
device_class?: string;
};
}

Expand Down
67 changes: 35 additions & 32 deletions src/panels/config/automation/blueprint-automation-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,39 +156,42 @@ 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(
"ui.panel.config.automation.editor.blueprint.inputs"
)}
</h3>
${Object.entries(blueprint.metadata.input).map(
([key, value]) =>
html`<div>
${value?.description}
${value?.selector
? html`<ha-selector
.hass=${this.hass}
.selector=${value.selector}
.key=${key}
.label=${value?.name || key}
.value=${this.config.use_blueprint.input &&
this.config.use_blueprint.input[key]}
@value-changed=${this._inputChanged}
></ha-selector>`
: html`<paper-input
.key=${key}
.label=${value?.name || key}
.value=${this.config.use_blueprint.input &&
this.config.use_blueprint.input[key]}
@value-changed=${this._inputChanged}
></paper-input>`}
</div>`
)}`
: this.hass.localize(
"ui.panel.config.automation.editor.blueprint.no_inputs"
)
? html`<h3>
${this.hass.localize(
"ui.panel.config.automation.editor.blueprint.inputs"
)}
</h3>
${Object.entries(blueprint.metadata.input).map(
([key, value]) =>
html`<div>
${value?.description}
${value?.selector
? html`<ha-selector
.hass=${this.hass}
.selector=${value.selector}
.key=${key}
.label=${value?.name || key}
.value=${this.config.use_blueprint.input &&
this.config.use_blueprint.input[key]}
@value-changed=${this._inputChanged}
></ha-selector>`
: html`<paper-input
.key=${key}
.label=${value?.name || key}
.value=${this.config.use_blueprint.input &&
this.config.use_blueprint.input[key]}
@value-changed=${this._inputChanged}
></paper-input>`}
</div>`
)}`
: this.hass.localize(
"ui.panel.config.automation.editor.blueprint.no_inputs"
)}`
: ""}
</div>
</ha-card>
Expand Down