diff --git a/src/panels/config/automation/thingtalk/dialog-thingtalk.ts b/src/panels/config/automation/thingtalk/dialog-thingtalk.ts index 09fa45a7f1..9aa87d029d 100644 --- a/src/panels/config/automation/thingtalk/dialog-thingtalk.ts +++ b/src/panels/config/automation/thingtalk/dialog-thingtalk.ts @@ -182,18 +182,19 @@ class DialogThingtalk extends LitElement { if (devices.length === 1) { Object.entries(devices[0]).forEach(([field, value]) => { this._config[type][index][field] = value; - return; }); + return; } const automation = { ...this._config[type][index] }; - delete this._config[type][index]; + const newAutomations: any[] = []; devices.forEach((fields) => { const newAutomation = { ...automation }; Object.entries(fields).forEach(([field, value]) => { newAutomation[field] = value; }); - this._config[type].push(newAutomation); + newAutomations.push(newAutomation); }); + this._config[type].splice(index, 1, ...newAutomations); }); }); this._sendConfig(this._value, this._config);