mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Migrate ps4 to use async_update_entry to alter config entries (#110373)
This commit is contained in:
parent
df8a168c97
commit
e2ec23955e
@ -108,8 +108,8 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
if country in COUNTRIES:
|
if country in COUNTRIES:
|
||||||
for device in data["devices"]:
|
for device in data["devices"]:
|
||||||
device[CONF_REGION] = country
|
device[CONF_REGION] = country
|
||||||
version = entry.version = 2
|
version = 2
|
||||||
config_entries.async_update_entry(entry, data=data)
|
config_entries.async_update_entry(entry, data=data, version=2)
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
"PlayStation 4 Config Updated: Region changed to: %s",
|
"PlayStation 4 Config Updated: Region changed to: %s",
|
||||||
country,
|
country,
|
||||||
@ -142,12 +142,11 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
config_entry=entry,
|
config_entry=entry,
|
||||||
device_id=e_entry.device_id,
|
device_id=e_entry.device_id,
|
||||||
)
|
)
|
||||||
entry.version = 3
|
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
"PlayStation 4 identifier for entity: %s has changed",
|
"PlayStation 4 identifier for entity: %s has changed",
|
||||||
entity_id,
|
entity_id,
|
||||||
)
|
)
|
||||||
config_entries.async_update_entry(entry)
|
config_entries.async_update_entry(entry, version=3)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
msg = f"""{reason[version]} for the PlayStation 4 Integration.
|
msg = f"""{reason[version]} for the PlayStation 4 Integration.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user