Skip to content

Commit 9fbf561

Browse files
committed
Add beta migration fix to HACS tree
1 parent 3da2a69 commit 9fbf561

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

homeassistant/components/teslemetry/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,22 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
7474
return True
7575

7676

77+
def beta_migration_fix(hass: HomeAssistant, entry: TeslemetryConfigEntry):
78+
"""Fix beta migration issues."""
79+
# This is needed to migrate beta users to the new OAuth credential system.
80+
if "auth_implementation" not in entry.data:
81+
hass.config_entries.async_update_entry(
82+
entry,
83+
data={**entry.data, "auth_implementation": DOMAIN},
84+
)
85+
86+
7787
async def async_setup_entry(hass: HomeAssistant, entry: TeslemetryConfigEntry) -> bool:
7888
"""Set up Teslemetry config."""
7989

8090
session = async_get_clientsession(hass)
8191

92+
beta_migration_fix(hass, entry)
8293
implementation = await async_get_config_entry_implementation(hass, entry)
8394
oauth_session = OAuth2Session(hass, entry, implementation)
8495

0 commit comments

Comments
 (0)