mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +00:00
Use websocket for entity registry update (#1261)
* Use websocket for entity registry update * Lint
This commit is contained in:
parent
bf4d0e6bc9
commit
cab53b3324
@ -141,11 +141,13 @@ class HaMoreInfoDialog extends DialogMixin(PolymerElement) {
|
|||||||
|
|
||||||
if (isComponentLoaded(this.hass, 'config.entity_registry') &&
|
if (isComponentLoaded(this.hass, 'config.entity_registry') &&
|
||||||
(!oldVal || oldVal.entity_id !== newVal.entity_id)) {
|
(!oldVal || oldVal.entity_id !== newVal.entity_id)) {
|
||||||
this.hass.callApi('get', `config/entity_registry/${newVal.entity_id}`)
|
this.hass.connection.sendMessagePromise({
|
||||||
.then(
|
type: 'config/entity_registry/get',
|
||||||
(info) => { this._registryInfo = info; },
|
entity_id: newVal.entity_id,
|
||||||
() => { this._registryInfo = false; }
|
}).then(
|
||||||
);
|
(msg) => { this._registryInfo = msg.result; },
|
||||||
|
() => { this._registryInfo = false; }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
requestAnimationFrame(() => requestAnimationFrame(() => {
|
requestAnimationFrame(() => requestAnimationFrame(() => {
|
||||||
|
@ -93,15 +93,14 @@ class MoreInfoSettings extends EventsMixin(PolymerElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_save() {
|
_save() {
|
||||||
const data = {
|
this.hass.connection.sendMessagePromise({
|
||||||
|
type: 'config/entity_registry/update',
|
||||||
|
entity_id: this.stateObj.entity_id,
|
||||||
name: this._name,
|
name: this._name,
|
||||||
};
|
}).then(
|
||||||
|
(msg) => { this.registryInfo = msg.result; },
|
||||||
this.hass.callApi('post', `config/entity_registry/${this.stateObj.entity_id}`, data)
|
() => { alert('save failed!'); }
|
||||||
.then(
|
);
|
||||||
(info) => { this.registryInfo = info; },
|
|
||||||
() => { alert('save failed!'); }
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
customElements.define('more-info-settings', MoreInfoSettings);
|
customElements.define('more-info-settings', MoreInfoSettings);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user