Convert Automation Action Choose to HA Form (#11597)

* Convert Auatomation Action Choose to HA Form

* remove log

* Remove Import
This commit is contained in:
Zack Barett 2022-02-07 17:45:16 -06:00 committed by GitHub
parent 6a51e2aaad
commit 9eea17b793
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,8 +10,8 @@ import { Condition } from "../../../../../data/automation";
import { Action, ChooseAction } from "../../../../../data/script";
import { haStyle } from "../../../../../resources/styles";
import { HomeAssistant } from "../../../../../types";
import "../ha-automation-action";
import { ActionElement } from "../ha-automation-action-row";
import "../../../../../components/ha-form/ha-form";
@customElement("ha-automation-action-choose")
export class HaChooseAction extends LitElement implements ActionElement {
@ -61,12 +61,13 @@ export class HaChooseAction extends LitElement implements ActionElement {
"ui.panel.config.automation.editor.actions.type.choose.sequence"
)}:
</h3>
<ha-automation-action
.actions=${option.sequence}
<ha-form
.hass=${this.hass}
.schema=${[{ name: "sequence", selector: { action: {} } }]}
.data=${option}
.idx=${idx}
@value-changed=${this._actionChanged}
></ha-automation-action>
></ha-form>
</div>
</ha-card>`
)}
@ -107,7 +108,7 @@ export class HaChooseAction extends LitElement implements ActionElement {
private _actionChanged(ev: CustomEvent) {
ev.stopPropagation();
const value = ev.detail.value as Action[];
const value = ev.detail.value.sequence as Action[];
const index = (ev.target as any).idx;
const choose = this.action.choose
? [...ensureArray(this.action.choose)]