convert default options to Ha-Form

This commit is contained in:
Zack 2022-02-07 20:04:17 -06:00
parent 9eea17b793
commit 7a0e77c3b1

View File

@ -85,11 +85,12 @@ export class HaChooseAction extends LitElement implements ActionElement {
"ui.panel.config.automation.editor.actions.type.choose.default" "ui.panel.config.automation.editor.actions.type.choose.default"
)}: )}:
</h2> </h2>
<ha-automation-action <ha-form
.actions=${action.default || []}
@value-changed=${this._defaultChanged}
.hass=${this.hass} .hass=${this.hass}
></ha-automation-action> .schema=${[{ name: "default", selector: { action: {} } }]}
.data=${action.default ? action : { default: [] }}
@value-changed=${this._defaultChanged}
></ha-form>
`; `;
} }
@ -142,7 +143,7 @@ export class HaChooseAction extends LitElement implements ActionElement {
private _defaultChanged(ev: CustomEvent) { private _defaultChanged(ev: CustomEvent) {
ev.stopPropagation(); ev.stopPropagation();
const value = ev.detail.value as Action[]; const value = ev.detail.value.default as Action[];
fireEvent(this, "value-changed", { fireEvent(this, "value-changed", {
value: { value: {
...this.action, ...this.action,