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
3 changes: 1 addition & 2 deletions homeassistant/components/apple_tv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from homeassistant.components.media_player import DOMAIN as MP_DOMAIN
from homeassistant.components.remote import DOMAIN as REMOTE_DOMAIN
from homeassistant.config_entries import SOURCE_REAUTH
from homeassistant.const import (
CONF_ADDRESS,
CONF_NAME,
Expand All @@ -34,8 +35,6 @@
NOTIFICATION_TITLE = "Apple TV Notification"
NOTIFICATION_ID = "apple_tv_notification"

SOURCE_REAUTH = "reauth"

SIGNAL_CONNECTED = "apple_tv_connected"
SIGNAL_DISCONNECTED = "apple_tv_disconnected"

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/august/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from yalexs.pubnub_activity import activities_from_pubnub_message
from yalexs.pubnub_async import AugustPubNub, async_create_pubnub

from homeassistant.config_entries import ConfigEntry
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntry
from homeassistant.const import CONF_PASSWORD, HTTP_UNAUTHORIZED
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady, HomeAssistantError
Expand Down Expand Up @@ -60,7 +60,7 @@ def _async_start_reauth(hass: HomeAssistant, entry: ConfigEntry):
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN,
context={"source": "reauth"},
context={"source": SOURCE_REAUTH},
data=entry.data,
)
)
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/awair/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from python_awair import Awair
from python_awair.exceptions import AuthError

from homeassistant.config_entries import SOURCE_REAUTH
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
Expand Down Expand Up @@ -74,7 +75,7 @@ async def _async_update_data(self) -> Any | None:
return {result.device.uuid: result for result in results}
except AuthError as err:
flow_context = {
"source": "reauth",
"source": SOURCE_REAUTH,
"unique_id": self._config_entry.unique_id,
}

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/azure_devops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
DATA_AZURE_DEVOPS_CLIENT,
DOMAIN,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntry
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
Expand All @@ -36,7 +36,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN,
context={"source": "reauth"},
context={"source": SOURCE_REAUTH},
data=entry.data,
)
)
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/blink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
SERVICE_SAVE_VIDEO,
SERVICE_SEND_PIN,
)
from homeassistant.config_entries import SOURCE_REAUTH
from homeassistant.const import CONF_FILENAME, CONF_NAME, CONF_PIN, CONF_SCAN_INTERVAL
from homeassistant.core import callback
from homeassistant.exceptions import ConfigEntryNotReady
Expand Down Expand Up @@ -49,7 +50,7 @@ def _reauth_flow_wrapper(hass, data):
"""Reauth flow wrapper."""
hass.add_job(
hass.config_entries.flow.async_init(
DOMAIN, context={"source": "reauth"}, data=data
DOMAIN, context={"source": SOURCE_REAUTH}, data=data
)
)
persistent_notification.async_create(
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/broadlink/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from homeassistant import config_entries, data_entry_flow
from homeassistant.components.dhcp import IP_ADDRESS, MAC_ADDRESS
from homeassistant.config_entries import SOURCE_REAUTH
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME, CONF_TIMEOUT, CONF_TYPE
from homeassistant.helpers import config_validation as cv

Expand Down Expand Up @@ -107,7 +108,7 @@ async def async_step_user(self, user_input=None):
else:
device.timeout = timeout

if self.source != "reauth":
if self.source != SOURCE_REAUTH:
await self.async_set_device(device)
self._abort_if_unique_id_configured(
updates={CONF_HOST: device.host[0], CONF_TIMEOUT: timeout}
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/broadlink/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
NetworkTimeoutError,
)

from homeassistant.config_entries import SOURCE_REAUTH
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME, CONF_TIMEOUT, CONF_TYPE
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import device_registry as dr
Expand Down Expand Up @@ -171,7 +172,7 @@ async def _async_handle_auth_error(self):
self.hass.async_create_task(
self.hass.config_entries.flow.async_init(
DOMAIN,
context={"source": "reauth"},
context={"source": SOURCE_REAUTH},
data={CONF_NAME: self.name, **self.config.data},
)
)
6 changes: 3 additions & 3 deletions homeassistant/components/ovo_energy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from ovoenergy import OVODailyUsage
from ovoenergy.ovoenergy import OVOEnergy

from homeassistant.config_entries import ConfigEntry
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
Expand Down Expand Up @@ -46,7 +46,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
if not authenticated:
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, context={"source": "reauth"}, data=entry.data
DOMAIN, context={"source": SOURCE_REAUTH}, data=entry.data
)
)
return False
Expand All @@ -63,7 +63,7 @@ async def async_update_data() -> OVODailyUsage:
if not authenticated:
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, context={"source": "reauth"}, data=entry.data
DOMAIN, context={"source": SOURCE_REAUTH}, data=entry.data
)
)
raise UpdateFailed("Not authenticated with OVO Energy")
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/powerwall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
PowerwallUnreachableError,
)

from homeassistant.config_entries import ConfigEntry
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntry
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady
Expand Down Expand Up @@ -185,7 +185,7 @@ def _async_start_reauth(hass: HomeAssistant, entry: ConfigEntry):
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN,
context={"source": "reauth"},
context={"source": SOURCE_REAUTH},
data=entry.data,
)
)
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/samsungtv/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
SUPPORT_VOLUME_MUTE,
SUPPORT_VOLUME_STEP,
)
from homeassistant.config_entries import SOURCE_REAUTH
from homeassistant.const import (
CONF_HOST,
CONF_ID,
Expand Down Expand Up @@ -124,7 +125,7 @@ def access_denied(self):
self.hass.add_job(
self.hass.config_entries.flow.async_init(
DOMAIN,
context={"source": "reauth"},
context={"source": SOURCE_REAUTH},
data=self._config_entry.data,
)
)
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sharkiq/update_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
SharkIqVacuum,
)

from homeassistant.config_entries import ConfigEntry
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed

Expand Down Expand Up @@ -76,7 +76,7 @@ async def _async_update_data(self) -> bool:
) as err:
_LOGGER.debug("Bad auth state. Attempting re-auth", exc_info=err)
flow_context = {
"source": "reauth",
"source": SOURCE_REAUTH,
"unique_id": self._config_entry.unique_id,
}

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/spotify/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from homeassistant.components.media_player import DOMAIN as MEDIA_PLAYER_DOMAIN
from homeassistant.components.spotify import config_flow
from homeassistant.config_entries import ConfigEntry
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntry
from homeassistant.const import ATTR_CREDENTIALS, CONF_CLIENT_ID, CONF_CLIENT_SECRET
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
Expand Down Expand Up @@ -87,7 +87,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN,
context={"source": "reauth"},
context={"source": SOURCE_REAUTH},
data=entry.data,
)
)
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/tesla/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from teslajsonpy.exceptions import IncompleteCredentials, TeslaException
import voluptuous as vol

from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_REAUTH, ConfigEntry
from homeassistant.const import (
ATTR_BATTERY_CHARGING,
ATTR_BATTERY_LEVEL,
Expand Down Expand Up @@ -220,7 +220,7 @@ def _async_start_reauth(hass: HomeAssistant, entry: ConfigEntry):
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN,
context={"source": "reauth"},
context={"source": SOURCE_REAUTH},
data=entry.data,
)
)
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/withings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.config_entries import ConfigEntry
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntry
from homeassistant.const import (
CONF_WEBHOOK_ID,
HTTP_UNAUTHORIZED,
Expand Down Expand Up @@ -740,7 +740,7 @@ async def async_get_all_data(self) -> dict[MeasureType, Any] | None:
context = {
const.PROFILE: self._profile,
"userid": self._user_id,
"source": "reauth",
"source": SOURCE_REAUTH,
}

# Check if reauth flow already exists.
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/withings/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from homeassistant import config_entries
from homeassistant.components.withings import const
from homeassistant.config_entries import SOURCE_REAUTH
from homeassistant.helpers import config_entry_oauth2_flow
from homeassistant.util import slugify

Expand Down Expand Up @@ -51,7 +52,7 @@ async def async_step_profile(self, data: dict) -> dict:
errors = {}
reauth_profile = (
self.context.get(const.PROFILE)
if self.context.get("source") == "reauth"
if self.context.get("source") == SOURCE_REAUTH
else None
)
profile = data.get(const.PROFILE) or reauth_profile
Expand Down