|
|
@@ -1054,6 +1054,36 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
|
|
|
await async_migrate_entries(hass, entry.entry_id, update_unique_id13_23)
|
|
|
hass.config_entries.async_update_entry(entry, minor_version=23)
|
|
|
|
|
|
+ if entry.version == 13 and entry.minor_version < 24:
|
|
|
+ # Migrate unique ids of existing entities to new id taking into
|
|
|
+ # account translation_key, and standardising naming
|
|
|
+ device_id = get_device_unique_id(entry)
|
|
|
+ conf_file = await hass.async_add_executor_job(
|
|
|
+ get_config,
|
|
|
+ entry.data[CONF_TYPE],
|
|
|
+ )
|
|
|
+ if conf_file is None:
|
|
|
+ _LOGGER.error(
|
|
|
+ NOT_FOUND,
|
|
|
+ entry.data[CONF_TYPE],
|
|
|
+ )
|
|
|
+ return False
|
|
|
+
|
|
|
+ @callback
|
|
|
+ def update_unique_id13_24(entity_entry):
|
|
|
+ """Update the unique id of an entity entry."""
|
|
|
+ # Standardistion of entity naming to use translation_key
|
|
|
+ replacements = {
|
|
|
+ "sensor_inlet_water_temperature": "sensor_inlet_temperature",
|
|
|
+ "sensor_water_inlet_temperature": "sensor_inlet_temperature",
|
|
|
+ "sensor_outlet_water_temperature": "sensor_outlet_temperature",
|
|
|
+ "sensor_water_outlet_temperature": "sensor_outlet_temperature",
|
|
|
+ }
|
|
|
+ return replace_unique_ids(entity_entry, device_id, conf_file, replacements)
|
|
|
+
|
|
|
+ await async_migrate_entries(hass, entry.entry_id, update_unique_id13_24)
|
|
|
+ hass.config_entries.async_update_entry(entry, minor_version=24)
|
|
|
+
|
|
|
return True
|
|
|
|
|
|
|