Replace duplicate constants in xthings_cloud with homeassistant.const imports (#172076)

This commit is contained in:
Max Michels
2026-05-24 19:25:39 +02:00
committed by GitHub
parent 3147104132
commit 31c9cdf742
6 changed files with 10 additions and 31 deletions
@@ -2,10 +2,11 @@
from ha_xthings_cloud import XthingsCloudApiClient
from homeassistant.const import CONF_TOKEN
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import CONF_TOKEN, PLATFORMS
from .const import PLATFORMS
from .coordinator import XthingsCloudConfigEntry, XthingsCloudCoordinator
@@ -10,17 +10,11 @@ from ha_xthings_cloud import (
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD, CONF_TOKEN
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.instance_id import async_get as async_get_instance_id
from .const import (
CONF_EMAIL,
CONF_PASSWORD,
CONF_REFRESH_TOKEN,
CONF_TOKEN,
DOMAIN,
LOGGER,
)
from .const import CONF_REFRESH_TOKEN, DOMAIN, LOGGER
ERROR_CODE_MAP: dict[int, str] = {
20001: "token_invalid",
@@ -7,15 +7,7 @@ from homeassistant.const import Platform
DOMAIN = "xthings_cloud"
LOGGER = logging.getLogger(__package__)
# pylint: disable-next=home-assistant-duplicate-const
CONF_EMAIL = "email"
# pylint: disable-next=home-assistant-duplicate-const
CONF_PASSWORD = "password"
# pylint: disable-next=home-assistant-duplicate-const
CONF_TOKEN = "token"
CONF_REFRESH_TOKEN = "refresh_token"
# pylint: disable-next=home-assistant-duplicate-const
CONF_CLIENT_ID = "client_id"
CONF_INSTANCE_ID = "instance_id"
# Polling interval (seconds)
@@ -11,12 +11,13 @@ from ha_xthings_cloud import (
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_TOKEN
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from .const import CONF_REFRESH_TOKEN, CONF_TOKEN, DEFAULT_SCAN_INTERVAL, DOMAIN, LOGGER
from .const import CONF_REFRESH_TOKEN, DEFAULT_SCAN_INTERVAL, DOMAIN, LOGGER
type XthingsCloudConfigEntry = ConfigEntry[XthingsCloudCoordinator]
+2 -6
View File
@@ -5,12 +5,8 @@ from unittest.mock import AsyncMock, patch
import pytest
from homeassistant.components.xthings_cloud.const import (
CONF_EMAIL,
CONF_REFRESH_TOKEN,
CONF_TOKEN,
DOMAIN,
)
from homeassistant.components.xthings_cloud.const import CONF_REFRESH_TOKEN, DOMAIN
from homeassistant.const import CONF_EMAIL, CONF_TOKEN
from .const import MOCK_EMAIL, MOCK_REFRESH_TOKEN, MOCK_TOKEN, MOCK_USER_ID
@@ -5,14 +5,9 @@ from unittest.mock import AsyncMock
from ha_xthings_cloud import XthingsCloudApiError, XthingsCloudAuthError
import pytest
from homeassistant.components.xthings_cloud.const import (
CONF_EMAIL,
CONF_PASSWORD,
CONF_REFRESH_TOKEN,
CONF_TOKEN,
DOMAIN,
)
from homeassistant.components.xthings_cloud.const import CONF_REFRESH_TOKEN, DOMAIN
from homeassistant.config_entries import SOURCE_USER
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD, CONF_TOKEN
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultType