Migrate ps4 to use async_update_entry to alter config entries (#110373)

This commit is contained in:
J. Nick Koston 2024-02-12 12:52:04 -06:00 committed by GitHub
parent df8a168c97
commit e2ec23955e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -108,8 +108,8 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
if country in COUNTRIES:
for device in data["devices"]:
device[CONF_REGION] = country
version = entry.version = 2
config_entries.async_update_entry(entry, data=data)
version = 2
config_entries.async_update_entry(entry, data=data, version=2)
_LOGGER.info(
"PlayStation 4 Config Updated: Region changed to: %s",
country,
@ -142,12 +142,11 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
config_entry=entry,
device_id=e_entry.device_id,
)
entry.version = 3
_LOGGER.info(
"PlayStation 4 identifier for entity: %s has changed",
entity_id,
)
config_entries.async_update_entry(entry)
config_entries.async_update_entry(entry, version=3)
return True
msg = f"""{reason[version]} for the PlayStation 4 Integration.