mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 02:36:37 +00:00
Fix thingtalk automations creation (#4328)
This commit is contained in:
parent
393adacc9e
commit
b47ee1051c
@ -182,18 +182,19 @@ class DialogThingtalk extends LitElement {
|
|||||||
if (devices.length === 1) {
|
if (devices.length === 1) {
|
||||||
Object.entries(devices[0]).forEach(([field, value]) => {
|
Object.entries(devices[0]).forEach(([field, value]) => {
|
||||||
this._config[type][index][field] = value;
|
this._config[type][index][field] = value;
|
||||||
return;
|
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
const automation = { ...this._config[type][index] };
|
const automation = { ...this._config[type][index] };
|
||||||
delete this._config[type][index];
|
const newAutomations: any[] = [];
|
||||||
devices.forEach((fields) => {
|
devices.forEach((fields) => {
|
||||||
const newAutomation = { ...automation };
|
const newAutomation = { ...automation };
|
||||||
Object.entries(fields).forEach(([field, value]) => {
|
Object.entries(fields).forEach(([field, value]) => {
|
||||||
newAutomation[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);
|
this._sendConfig(this._value, this._config);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user