mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-30 05:13:40 +00:00
fix: handle missing entry_id in reauth flow and ensure integration version is a string
This commit is contained in:
parent
da5a723777
commit
ae82e4637c
1 changed files with 4 additions and 2 deletions
|
|
@ -120,7 +120,9 @@ class TibberPricesFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
async def async_step_reauth(self, entry_data: dict[str, Any]) -> ConfigFlowResult: # noqa: ARG002
|
async def async_step_reauth(self, entry_data: dict[str, Any]) -> ConfigFlowResult: # noqa: ARG002
|
||||||
"""Handle reauth flow when access token becomes invalid."""
|
"""Handle reauth flow when access token becomes invalid."""
|
||||||
self._reauth_entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
entry_id = self.context.get("entry_id")
|
||||||
|
if entry_id:
|
||||||
|
self._reauth_entry = self.hass.config_entries.async_get_entry(entry_id)
|
||||||
return await self.async_step_reauth_confirm()
|
return await self.async_step_reauth_confirm()
|
||||||
|
|
||||||
async def async_step_reauth_confirm(self, user_input: dict | None = None) -> ConfigFlowResult:
|
async def async_step_reauth_confirm(self, user_input: dict | None = None) -> ConfigFlowResult:
|
||||||
|
|
@ -337,7 +339,7 @@ class TibberPricesFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||||
client = TibberPricesApiClient(
|
client = TibberPricesApiClient(
|
||||||
access_token=access_token,
|
access_token=access_token,
|
||||||
session=async_create_clientsession(self.hass),
|
session=async_create_clientsession(self.hass),
|
||||||
version=integration.version,
|
version=str(integration.version) if integration.version else "unknown",
|
||||||
)
|
)
|
||||||
result = await client.async_get_viewer_details()
|
result = await client.async_get_viewer_details()
|
||||||
return result["viewer"]
|
return result["viewer"]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue