mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-20 07:46:37 +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,9 +141,11 @@ 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,
|
||||||
|
}).then(
|
||||||
|
(msg) => { this._registryInfo = msg.result; },
|
||||||
() => { this._registryInfo = false; }
|
() => { this._registryInfo = false; }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -93,13 +93,12 @@ 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)
|
|
||||||
.then(
|
|
||||||
(info) => { this.registryInfo = info; },
|
|
||||||
() => { alert('save failed!'); }
|
() => { alert('save failed!'); }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user