diff --git a/homeassistant/components/min_max/__init__.py b/homeassistant/components/min_max/__init__.py index b3b12b0eb662..75121b070696 100644 --- a/homeassistant/components/min_max/__init__.py +++ b/homeassistant/components/min_max/__init__.py @@ -20,7 +20,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: is_persistent=False, severity=IssueSeverity.WARNING, translation_key="migrate_to_group_sensor", - translation_placeholders={"title": entry.title}, data={"entry_id": entry.entry_id}, ) await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) diff --git a/homeassistant/components/min_max/repairs.py b/homeassistant/components/min_max/repairs.py index 0bbb4d7f89b2..30423677a831 100644 --- a/homeassistant/components/min_max/repairs.py +++ b/homeassistant/components/min_max/repairs.py @@ -43,6 +43,12 @@ class MigrateToGroupSensorFlow(RepairsFlow): ) -> data_entry_flow.FlowResult: """Handle the migration step of a fix flow.""" errors: dict[str, str] = {} + entity_reg = er.async_get(self.hass) + old_entity = entity_reg.async_get_entity_id( + SENSOR_DOMAIN, DOMAIN, self.entry.entry_id + ) + assert old_entity + if user_input is not None: config = dict(self.entry.options) config[CONF_ENTITIES] = config.pop(CONF_ENTITY_IDS) @@ -65,25 +71,30 @@ class MigrateToGroupSensorFlow(RepairsFlow): version=1, ) - entity_reg = er.async_get(self.hass) - if old_entity := entity_reg.async_get_entity_id( - SENSOR_DOMAIN, DOMAIN, self.entry.entry_id - ): + await self.hass.config_entries.async_unload_platforms( + self.entry, [SENSOR_DOMAIN] + ) + await self.hass.config_entries.async_unload(self.entry.entry_id) + await self.hass.config_entries.async_add(new_config_entry) + if old_entity: entity_reg.async_update_entity_platform( old_entity, GROUP_DOMAIN, new_config_entry_id=new_config_entry.entry_id, ) - - await self.hass.config_entries.async_add(new_config_entry) await self.hass.config_entries.async_remove(self.entry.entry_id) return self.async_create_entry(data={}) + entity_info = entity_reg.async_get(old_entity) + assert entity_info + title = er.async_get_full_entity_name(self.hass, entity_info) + return self.async_show_form( step_id="migrate", data_schema=vol.Schema({}), errors=errors, + description_placeholders={"title": title}, ) diff --git a/homeassistant/components/min_max/strings.json b/homeassistant/components/min_max/strings.json index 58912b337d7f..1b262dc71ab5 100644 --- a/homeassistant/components/min_max/strings.json +++ b/homeassistant/components/min_max/strings.json @@ -25,12 +25,12 @@ "step": { "migrate": { "data": {}, - "description": "The integration has been deprecated and your configuration for {title} will be migrated to a group sensor when you click submit on this repair.", + "description": "The Min/Max helper has been deprecated and {title} will be migrated to a group sensor when you click submit on this repair.", "title": "[%key:component::min_max::issues::migrate_to_group_sensor::title%]" } } }, - "title": "Combine the state of several sensors has been deprecated" + "title": "Min/Max sensors has been deprecated" }, "yaml_deprecated": { "description": "The min/max integration has been migrated to use group sensor.\n\nReplace your Min/MaxYAML configuration with this converted configuration:\n{yaml_config}\n\nTo use the new configuration and replace your sensor with a group sensor, restart your Home Assistant.\n\nGroup sensors have more configuration possibilities, refer to the documentation by clicking on learn more.",