mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 23:06:40 +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') &&
|
||||
(!oldVal || oldVal.entity_id !== newVal.entity_id)) {
|
||||
this.hass.callApi('get', `config/entity_registry/${newVal.entity_id}`)
|
||||
.then(
|
||||
(info) => { this._registryInfo = info; },
|
||||
() => { this._registryInfo = false; }
|
||||
);
|
||||
this.hass.connection.sendMessagePromise({
|
||||
type: 'config/entity_registry/get',
|
||||
entity_id: newVal.entity_id,
|
||||
}).then(
|
||||
(msg) => { this._registryInfo = msg.result; },
|
||||
() => { this._registryInfo = false; }
|
||||
);
|
||||
}
|
||||
|
||||
requestAnimationFrame(() => requestAnimationFrame(() => {
|
||||
|
@ -93,15 +93,14 @@ class MoreInfoSettings extends EventsMixin(PolymerElement) {
|
||||
}
|
||||
|
||||
_save() {
|
||||
const data = {
|
||||
this.hass.connection.sendMessagePromise({
|
||||
type: 'config/entity_registry/update',
|
||||
entity_id: this.stateObj.entity_id,
|
||||
name: this._name,
|
||||
};
|
||||
|
||||
this.hass.callApi('post', `config/entity_registry/${this.stateObj.entity_id}`, data)
|
||||
.then(
|
||||
(info) => { this.registryInfo = info; },
|
||||
() => { alert('save failed!'); }
|
||||
);
|
||||
}).then(
|
||||
(msg) => { this.registryInfo = msg.result; },
|
||||
() => { alert('save failed!'); }
|
||||
);
|
||||
}
|
||||
}
|
||||
customElements.define('more-info-settings', MoreInfoSettings);
|
||||
|
Loading…
x
Reference in New Issue
Block a user