Use a global const for CONF_UUID (#84093)

This commit is contained in:
Michaël Arnauts 2022-12-19 12:16:30 +01:00 committed by GitHub
parent 2f19b56d5e
commit 627a208d9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 29 additions and 22 deletions

View File

@ -7,11 +7,12 @@ import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.components import onboarding, zeroconf from homeassistant.components import onboarding, zeroconf
from homeassistant.const import CONF_UUID
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResult from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from .const import CONF_IGNORE_CEC, CONF_KNOWN_HOSTS, CONF_UUID, DOMAIN from .const import CONF_IGNORE_CEC, CONF_KNOWN_HOSTS, DOMAIN
IGNORE_CEC_SCHEMA = vol.Schema(vol.All(cv.ensure_list, [cv.string])) IGNORE_CEC_SCHEMA = vol.Schema(vol.All(cv.ensure_list, [cv.string]))
KNOWN_HOSTS_SCHEMA = vol.Schema(vol.All(cv.ensure_list, [cv.string])) KNOWN_HOSTS_SCHEMA = vol.Schema(vol.All(cv.ensure_list, [cv.string]))

View File

@ -25,4 +25,3 @@ SIGNAL_HASS_CAST_SHOW_VIEW = "cast_show_view"
CONF_IGNORE_CEC = "ignore_cec" CONF_IGNORE_CEC = "ignore_cec"
CONF_KNOWN_HOSTS = "known_hosts" CONF_KNOWN_HOSTS = "known_hosts"
CONF_UUID = "uuid"

View File

@ -43,6 +43,7 @@ from homeassistant.components.media_player import (
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( from homeassistant.const import (
CAST_APP_ID_HOMEASSISTANT_LOVELACE, CAST_APP_ID_HOMEASSISTANT_LOVELACE,
CONF_UUID,
EVENT_HOMEASSISTANT_STOP, EVENT_HOMEASSISTANT_STOP,
) )
from homeassistant.core import CALLBACK_TYPE, Event, HomeAssistant, callback from homeassistant.core import CALLBACK_TYPE, Event, HomeAssistant, callback
@ -59,7 +60,6 @@ from .const import (
ADDED_CAST_DEVICES_KEY, ADDED_CAST_DEVICES_KEY,
CAST_MULTIZONE_MANAGER_KEY, CAST_MULTIZONE_MANAGER_KEY,
CONF_IGNORE_CEC, CONF_IGNORE_CEC,
CONF_UUID,
DOMAIN as CAST_DOMAIN, DOMAIN as CAST_DOMAIN,
SIGNAL_CAST_DISCOVERED, SIGNAL_CAST_DISCOVERED,
SIGNAL_CAST_REMOVED, SIGNAL_CAST_REMOVED,

View File

@ -8,7 +8,13 @@ from async_timeout import timeout
from pydaikin.daikin_base import Appliance from pydaikin.daikin_base import Appliance
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PASSWORD, Platform from homeassistant.const import (
CONF_API_KEY,
CONF_HOST,
CONF_PASSWORD,
CONF_UUID,
Platform,
)
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -17,7 +23,7 @@ from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo
from homeassistant.util import Throttle from homeassistant.util import Throttle
from .const import CONF_UUID, DOMAIN, KEY_MAC, TIMEOUT from .const import DOMAIN, KEY_MAC, TIMEOUT
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -11,11 +11,11 @@ import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.components import zeroconf from homeassistant.components import zeroconf
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PASSWORD from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PASSWORD, CONF_UUID
from homeassistant.data_entry_flow import FlowResult from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import CONF_UUID, DOMAIN, KEY_MAC, TIMEOUT from .const import DOMAIN, KEY_MAC, TIMEOUT
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -20,8 +20,6 @@ ATTR_TOTAL_ENERGY_TODAY = "total_energy_today"
ATTR_STATE_ON = "on" ATTR_STATE_ON = "on"
ATTR_STATE_OFF = "off" ATTR_STATE_OFF = "off"
CONF_UUID = "uuid"
KEY_MAC = "mac" KEY_MAC = "mac"
KEY_IP = "ip" KEY_IP = "ip"

View File

@ -22,13 +22,14 @@ from homeassistant.const import (
CONF_NAME, CONF_NAME,
CONF_PORT, CONF_PORT,
CONF_SSL, CONF_SSL,
CONF_UUID,
CONF_VERIFY_SSL, CONF_VERIFY_SSL,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResult from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import CONF_BASE_PATH, CONF_SERIAL, CONF_UUID, DOMAIN from .const import CONF_BASE_PATH, CONF_SERIAL, DOMAIN
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -18,4 +18,3 @@ ATTR_URI_SUPPORTED = "uri_supported"
CONF_BASE_PATH = "base_path" CONF_BASE_PATH = "base_path"
CONF_SERIAL = "serial" CONF_SERIAL = "serial"
CONF_TLS = "tls" CONF_TLS = "tls"
CONF_UUID = "uuid"

View File

@ -10,7 +10,7 @@ from pyatmo.const import ALL_SCOPES
import voluptuous as vol import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.const import CONF_SHOW_ON_MAP from homeassistant.const import CONF_SHOW_ON_MAP, CONF_UUID
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResult from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import config_entry_oauth2_flow, config_validation as cv from homeassistant.helpers import config_entry_oauth2_flow, config_validation as cv
@ -23,7 +23,6 @@ from .const import (
CONF_LON_SW, CONF_LON_SW,
CONF_NEW_AREA, CONF_NEW_AREA,
CONF_PUBLIC_MODE, CONF_PUBLIC_MODE,
CONF_UUID,
CONF_WEATHER_AREAS, CONF_WEATHER_AREAS,
DOMAIN, DOMAIN,
) )

View File

@ -50,7 +50,6 @@ CONF_LON_NE = "lon_ne"
CONF_LON_SW = "lon_sw" CONF_LON_SW = "lon_sw"
CONF_NEW_AREA = "new_area" CONF_NEW_AREA = "new_area"
CONF_PUBLIC_MODE = "mode" CONF_PUBLIC_MODE = "mode"
CONF_UUID = "uuid"
CONF_WEATHER_AREAS = "weather_areas" CONF_WEATHER_AREAS = "weather_areas"
OAUTH2_AUTHORIZE = "https://api.netatmo.com/oauth2/authorize" OAUTH2_AUTHORIZE = "https://api.netatmo.com/oauth2/authorize"

View File

@ -5,14 +5,13 @@ from typing import Any
from homeassistant.components.diagnostics import async_redact_data from homeassistant.components.diagnostics import async_redact_data
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, CONF_UUID
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from . import TileData from . import TileData
from .const import DOMAIN from .const import DOMAIN
CONF_ALTITUDE = "altitude" CONF_ALTITUDE = "altitude"
CONF_UUID = "uuid"
TO_REDACT = { TO_REDACT = {
CONF_ALTITUDE, CONF_ALTITUDE,

View File

@ -19,6 +19,7 @@ from homeassistant.const import (
CONF_MONITORED_CONDITIONS, CONF_MONITORED_CONDITIONS,
CONF_NAME, CONF_NAME,
CONF_PORT, CONF_PORT,
CONF_UUID,
UnitOfEnergy, UnitOfEnergy,
UnitOfPower, UnitOfPower,
) )
@ -32,8 +33,6 @@ from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
CONF_UUID = "uuid"
DEFAULT_HOST = "localhost" DEFAULT_HOST = "localhost"
DEFAULT_NAME = "Volkszaehler" DEFAULT_NAME = "Volkszaehler"
DEFAULT_PORT = 80 DEFAULT_PORT = 80

View File

@ -256,6 +256,7 @@ CONF_UNIT_SYSTEM: Final = "unit_system"
CONF_UNTIL: Final = "until" CONF_UNTIL: Final = "until"
CONF_URL: Final = "url" CONF_URL: Final = "url"
CONF_USERNAME: Final = "username" CONF_USERNAME: Final = "username"
CONF_UUID: Final = "uuid"
CONF_VALUE_TEMPLATE: Final = "value_template" CONF_VALUE_TEMPLATE: Final = "value_template"
CONF_VARIABLES: Final = "variables" CONF_VARIABLES: Final = "variables"
CONF_VERIFY_SSL: Final = "verify_ssl" CONF_VERIFY_SSL: Final = "verify_ssl"

View File

@ -3,8 +3,14 @@ import aiohttp
from pyipp import IPPConnectionUpgradeRequired, IPPError from pyipp import IPPConnectionUpgradeRequired, IPPError
from homeassistant.components import zeroconf from homeassistant.components import zeroconf
from homeassistant.components.ipp.const import CONF_BASE_PATH, CONF_UUID, DOMAIN from homeassistant.components.ipp.const import CONF_BASE_PATH, DOMAIN
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_SSL, CONF_VERIFY_SSL from homeassistant.const import (
CONF_HOST,
CONF_PORT,
CONF_SSL,
CONF_UUID,
CONF_VERIFY_SSL,
)
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry, get_fixture_path from tests.common import MockConfigEntry, get_fixture_path

View File

@ -2,9 +2,9 @@
import dataclasses import dataclasses
from unittest.mock import patch from unittest.mock import patch
from homeassistant.components.ipp.const import CONF_BASE_PATH, CONF_UUID, DOMAIN from homeassistant.components.ipp.const import CONF_BASE_PATH, DOMAIN
from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_SSL from homeassistant.const import CONF_HOST, CONF_NAME, CONF_SSL, CONF_UUID
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultType from homeassistant.data_entry_flow import FlowResultType