Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions custom_components/panasonic_cc/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ async def _async_handle_login(
otp_code = user_input.get(CONF_OTP_CODE)
try:
errors = await self._async_try_login(
user_input[CONF_USERNAME], user_input[CONF_PASSWORD], otp_code
user_input[CONF_USERNAME], user_input[CONF_PASSWORD], otp_code, origin
)
except MFARequiredError:
_LOGGER.debug("Account requires a 2FA code, asking the user for one")
Expand Down Expand Up @@ -179,7 +179,7 @@ async def _async_handle_login(
return await self._async_create_entry(user_input)

async def _async_try_login(
self, username: str, password: str, otp_code: str | None = None
self, username: str, password: str, otp_code: str | None = None, origin: str = "user"
) -> dict[str, str]:
"""Attempt to authenticate and fetch the account's devices.

Expand All @@ -188,12 +188,21 @@ async def _async_try_login(
supplied, or AgreementNotAcceptedError if Panasonic requires
acceptance of updated agreements — the caller is expected to
prompt for the missing input and retry.

For a "reauth_confirm" origin this forces a completely fresh login
via reauthenticate() rather than start_session(), which would
otherwise silently keep reusing a cached (and possibly stale/stuck)
session from the settings file instead of the credentials the user
just entered.
"""
client = async_get_clientsession(self.hass)
api = ApiClient(username, password, client)
errors: dict[str, str] = {}
try:
await api.start_session(otp_code)
if origin == "reauth_confirm":
await api.reauthenticate(otp_code)
else:
await api.start_session(otp_code)

if not api.has_devices:
errors["base"] = "no_devices"
Expand Down
4 changes: 2 additions & 2 deletions custom_components/panasonic_cc/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/sockless-coding/panasonic_cc/issues",
"requirements": [
"aio-panasonic-comfort-cloud==2026.8.7"
"aio-panasonic-comfort-cloud==2026.8.8"
],
"quality_scale": "silver",
"version": "2026.8.5"
"version": "2026.8.6"
}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
aiohttp
aio-panasonic-comfort-cloud==2026.8.7
aio-panasonic-comfort-cloud==2026.8.8