diff --git a/src/dialogs/more-info/more-info-settings.js b/src/dialogs/more-info/more-info-settings.js
index 7e3f448ffd..e6974d8861 100644
--- a/src/dialogs/more-info/more-info-settings.js
+++ b/src/dialogs/more-info/more-info-settings.js
@@ -48,7 +48,14 @@ class MoreInfoSettings extends LocalizeMixin(EventsMixin(PolymerElement)) {
`;
}
@@ -70,6 +77,7 @@ class MoreInfoSettings extends LocalizeMixin(EventsMixin(PolymerElement)) {
},
_name: String,
+ _entityId: String,
};
}
@@ -84,9 +92,15 @@ class MoreInfoSettings extends LocalizeMixin(EventsMixin(PolymerElement)) {
_registryInfoChanged(newVal) {
if (newVal) {
- this._name = newVal.name;
+ this.setProperties({
+ _name: newVal.name,
+ _entityId: newVal.entity_id,
+ });
} else {
- this._name = '';
+ this.setProperties({
+ _name: '',
+ _entityId: '',
+ });
}
}
@@ -100,10 +114,17 @@ class MoreInfoSettings extends LocalizeMixin(EventsMixin(PolymerElement)) {
type: 'config/entity_registry/update',
entity_id: this.stateObj.entity_id,
name: this._name,
+ new_entity_id: this._entityId,
});
+
this.registryInfo = info;
+
+ // Keep the more info dialog open at the new entity.
+ if (this.stateObj.entity_id !== this._entityId) {
+ this.fire('hass-more-info', { entityId: this._entityId });
+ }
} catch (err) {
- alert('save failed!');
+ alert(`save failed: ${err.message}`);
}
}
}
diff --git a/src/translations/en.json b/src/translations/en.json
index fb0e0f8031..0ec6eb32bc 100644
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -437,7 +437,8 @@
"dialogs": {
"more_info_settings": {
"save": "Save",
- "name": "Name"
+ "name": "Name",
+ "entity_id": "Entity ID"
}
},
"duration": {