From 9b8922a6787c68dff094b67f55bd806e75731794 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 26 Jun 2024 10:36:54 +0200 Subject: [PATCH] Force alias when importing switch PLATFORM_SCHEMA (#120504) --- homeassistant/components/acer_projector/switch.py | 7 +++++-- homeassistant/components/ads/switch.py | 7 +++++-- homeassistant/components/anel_pwrctrl/switch.py | 7 +++++-- homeassistant/components/aqualogic/switch.py | 7 +++++-- homeassistant/components/arest/switch.py | 7 +++++-- homeassistant/components/aten_pe/switch.py | 4 ++-- homeassistant/components/digital_ocean/switch.py | 7 +++++-- homeassistant/components/edimax/switch.py | 7 +++++-- homeassistant/components/enocean/switch.py | 7 +++++-- homeassistant/components/gc100/switch.py | 7 +++++-- homeassistant/components/group/switch.py | 8 ++++++-- homeassistant/components/hikvisioncam/switch.py | 7 +++++-- homeassistant/components/kankun/switch.py | 7 +++++-- homeassistant/components/linode/switch.py | 7 +++++-- homeassistant/components/mfi/switch.py | 7 +++++-- homeassistant/components/netio/switch.py | 7 +++++-- homeassistant/components/orvibo/switch.py | 7 +++++-- homeassistant/components/pencom/switch.py | 7 +++++-- homeassistant/components/pilight/switch.py | 7 +++++-- homeassistant/components/pulseaudio_loopback/switch.py | 7 +++++-- homeassistant/components/raincloud/switch.py | 7 +++++-- homeassistant/components/raspyrfm/switch.py | 7 +++++-- homeassistant/components/recswitch/switch.py | 7 +++++-- homeassistant/components/remote_rpi_gpio/switch.py | 7 +++++-- homeassistant/components/rest/switch.py | 4 ++-- homeassistant/components/rflink/switch.py | 7 +++++-- homeassistant/components/scsgate/switch.py | 7 +++++-- homeassistant/components/snmp/switch.py | 7 +++++-- homeassistant/components/sony_projector/switch.py | 7 +++++-- homeassistant/components/switchmate/switch.py | 7 +++++-- homeassistant/components/telnet/switch.py | 4 ++-- homeassistant/components/template/switch.py | 4 ++-- homeassistant/components/thinkingcleaner/switch.py | 4 ++-- homeassistant/components/vultr/switch.py | 7 +++++-- homeassistant/components/wake_on_lan/switch.py | 4 ++-- homeassistant/components/wirelesstag/switch.py | 4 ++-- homeassistant/components/zoneminder/switch.py | 7 +++++-- 37 files changed, 165 insertions(+), 74 deletions(-) diff --git a/homeassistant/components/acer_projector/switch.py b/homeassistant/components/acer_projector/switch.py index b29bbf9fa3f..5c1c37df5d8 100644 --- a/homeassistant/components/acer_projector/switch.py +++ b/homeassistant/components/acer_projector/switch.py @@ -9,7 +9,10 @@ from typing import Any import serial import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import ( CONF_FILENAME, CONF_NAME, @@ -38,7 +41,7 @@ from .const import ( _LOGGER = logging.getLogger(__name__) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_FILENAME): cv.isdevice, vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, diff --git a/homeassistant/components/ads/switch.py b/homeassistant/components/ads/switch.py index a793a5996cf..803b95a7d8a 100644 --- a/homeassistant/components/ads/switch.py +++ b/homeassistant/components/ads/switch.py @@ -7,7 +7,10 @@ from typing import Any import pyads import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_NAME from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -18,7 +21,7 @@ from . import CONF_ADS_VAR, DATA_ADS, STATE_KEY_STATE, AdsEntity DEFAULT_NAME = "ADS Switch" -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_ADS_VAR): cv.string, vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, diff --git a/homeassistant/components/anel_pwrctrl/switch.py b/homeassistant/components/anel_pwrctrl/switch.py index 94cd0a59398..6b27a61e065 100644 --- a/homeassistant/components/anel_pwrctrl/switch.py +++ b/homeassistant/components/anel_pwrctrl/switch.py @@ -9,7 +9,10 @@ from typing import Any from anel_pwrctrl import Device, DeviceMaster, Switch import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -24,7 +27,7 @@ CONF_PORT_SEND = "port_send" MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=5) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_PORT_RECV): cv.port, vol.Required(CONF_PORT_SEND): cv.port, diff --git a/homeassistant/components/aqualogic/switch.py b/homeassistant/components/aqualogic/switch.py index 0f1a7e34b3c..ed0cc463263 100644 --- a/homeassistant/components/aqualogic/switch.py +++ b/homeassistant/components/aqualogic/switch.py @@ -7,7 +7,10 @@ from typing import Any from aqualogic.core import States import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_MONITORED_CONDITIONS from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -30,7 +33,7 @@ SWITCH_TYPES = { "aux_7": "Aux 7", } -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Optional(CONF_MONITORED_CONDITIONS, default=list(SWITCH_TYPES)): vol.All( cv.ensure_list, [vol.In(SWITCH_TYPES)] diff --git a/homeassistant/components/arest/switch.py b/homeassistant/components/arest/switch.py index 4b15e6726fe..bcdba36cb58 100644 --- a/homeassistant/components/arest/switch.py +++ b/homeassistant/components/arest/switch.py @@ -9,7 +9,10 @@ from typing import Any import requests import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_NAME, CONF_RESOURCE from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -31,7 +34,7 @@ PIN_FUNCTION_SCHEMA = vol.Schema( } ) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_RESOURCE): cv.url, vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, diff --git a/homeassistant/components/aten_pe/switch.py b/homeassistant/components/aten_pe/switch.py index 1349014d8fb..39b18089284 100644 --- a/homeassistant/components/aten_pe/switch.py +++ b/homeassistant/components/aten_pe/switch.py @@ -9,7 +9,7 @@ from atenpdu import AtenPE, AtenPEError import voluptuous as vol from homeassistant.components.switch import ( - PLATFORM_SCHEMA, + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, SwitchDeviceClass, SwitchEntity, ) @@ -30,7 +30,7 @@ DEFAULT_COMMUNITY = "private" DEFAULT_PORT = "161" DEFAULT_USERNAME = "administrator" -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_HOST): cv.string, vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port, diff --git a/homeassistant/components/digital_ocean/switch.py b/homeassistant/components/digital_ocean/switch.py index a01965e3667..856c9301cfd 100644 --- a/homeassistant/components/digital_ocean/switch.py +++ b/homeassistant/components/digital_ocean/switch.py @@ -7,7 +7,10 @@ from typing import Any import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -32,7 +35,7 @@ _LOGGER = logging.getLogger(__name__) DEFAULT_NAME = "Droplet" -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( {vol.Required(CONF_DROPLETS): vol.All(cv.ensure_list, [cv.string])} ) diff --git a/homeassistant/components/edimax/switch.py b/homeassistant/components/edimax/switch.py index 61f3e6f4538..e0d063eb9fd 100644 --- a/homeassistant/components/edimax/switch.py +++ b/homeassistant/components/edimax/switch.py @@ -7,7 +7,10 @@ from typing import Any from pyedimax.smartplug import SmartPlug import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -20,7 +23,7 @@ DEFAULT_NAME = "Edimax Smart Plug" DEFAULT_PASSWORD = "1234" DEFAULT_USERNAME = "admin" -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_HOST): cv.string, vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, diff --git a/homeassistant/components/enocean/switch.py b/homeassistant/components/enocean/switch.py index 4fa75ff9712..9bf8b8e775c 100644 --- a/homeassistant/components/enocean/switch.py +++ b/homeassistant/components/enocean/switch.py @@ -7,7 +7,10 @@ from typing import Any from enocean.utils import combine_hex import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_ID, CONF_NAME, Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv, entity_registry as er @@ -20,7 +23,7 @@ from .device import EnOceanEntity CONF_CHANNEL = "channel" DEFAULT_NAME = "EnOcean Switch" -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_ID): vol.All(cv.ensure_list, [vol.Coerce(int)]), vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, diff --git a/homeassistant/components/gc100/switch.py b/homeassistant/components/gc100/switch.py index ea90dde6abf..1bcdc7365cf 100644 --- a/homeassistant/components/gc100/switch.py +++ b/homeassistant/components/gc100/switch.py @@ -6,7 +6,10 @@ from typing import Any import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import DEVICE_DEFAULT_NAME from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -17,7 +20,7 @@ from . import CONF_PORTS, DATA_GC100 _SWITCH_SCHEMA = vol.Schema({cv.string: cv.string}) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( {vol.Required(CONF_PORTS): vol.All(cv.ensure_list, [_SWITCH_SCHEMA])} ) diff --git a/homeassistant/components/group/switch.py b/homeassistant/components/group/switch.py index 7be6b188e72..9db264c8041 100644 --- a/homeassistant/components/group/switch.py +++ b/homeassistant/components/group/switch.py @@ -7,7 +7,11 @@ from typing import Any import voluptuous as vol -from homeassistant.components.switch import DOMAIN, PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + DOMAIN, + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( ATTR_ENTITY_ID, @@ -33,7 +37,7 @@ CONF_ALL = "all" # No limit on parallel updates to enable a group calling another group PARALLEL_UPDATES = 0 -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_ENTITIES): cv.entities_domain(DOMAIN), vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, diff --git a/homeassistant/components/hikvisioncam/switch.py b/homeassistant/components/hikvisioncam/switch.py index c455fcb5bbc..653d5a07174 100644 --- a/homeassistant/components/hikvisioncam/switch.py +++ b/homeassistant/components/hikvisioncam/switch.py @@ -9,7 +9,10 @@ import hikvision.api from hikvision.error import HikvisionError, MissingParamError import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import ( CONF_HOST, CONF_NAME, @@ -33,7 +36,7 @@ DEFAULT_PASSWORD = "12345" DEFAULT_PORT = 80 DEFAULT_USERNAME = "admin" -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_HOST): cv.string, vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, diff --git a/homeassistant/components/kankun/switch.py b/homeassistant/components/kankun/switch.py index f650494b3b1..a86bed5eb9a 100644 --- a/homeassistant/components/kankun/switch.py +++ b/homeassistant/components/kankun/switch.py @@ -8,7 +8,10 @@ from typing import Any import requests import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import ( CONF_HOST, CONF_NAME, @@ -39,7 +42,7 @@ SWITCH_SCHEMA = vol.Schema( } ) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( {vol.Required(CONF_SWITCHES): cv.schema_with_slug_keys(SWITCH_SCHEMA)} ) diff --git a/homeassistant/components/linode/switch.py b/homeassistant/components/linode/switch.py index f2665671c0b..abaf77648ef 100644 --- a/homeassistant/components/linode/switch.py +++ b/homeassistant/components/linode/switch.py @@ -7,7 +7,10 @@ from typing import Any import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -30,7 +33,7 @@ _LOGGER = logging.getLogger(__name__) DEFAULT_NAME = "Node" -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( {vol.Required(CONF_NODES): vol.All(cv.ensure_list, [cv.string])} ) diff --git a/homeassistant/components/mfi/switch.py b/homeassistant/components/mfi/switch.py index fe0aeb902ee..833a2c21301 100644 --- a/homeassistant/components/mfi/switch.py +++ b/homeassistant/components/mfi/switch.py @@ -9,7 +9,10 @@ from mficlient.client import FailedToLogin, MFiClient import requests import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import ( CONF_HOST, CONF_PASSWORD, @@ -30,7 +33,7 @@ DEFAULT_VERIFY_SSL = True SWITCH_MODELS = ["Outlet", "Output 5v", "Output 12v", "Output 24v", "Dimmer Switch"] -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_HOST): cv.string, vol.Required(CONF_USERNAME): cv.string, diff --git a/homeassistant/components/netio/switch.py b/homeassistant/components/netio/switch.py index 4cc77e44ec4..f5627f5e56b 100644 --- a/homeassistant/components/netio/switch.py +++ b/homeassistant/components/netio/switch.py @@ -12,7 +12,10 @@ import voluptuous as vol from homeassistant import util from homeassistant.components.http import HomeAssistantView -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import ( CONF_HOST, CONF_PASSWORD, @@ -44,7 +47,7 @@ REQ_CONF = [CONF_HOST, CONF_OUTLETS] URL_API_NETIO_EP = "/api/netio/{host}" -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_HOST): cv.string, vol.Required(CONF_PORT, default=DEFAULT_PORT): cv.port, diff --git a/homeassistant/components/orvibo/switch.py b/homeassistant/components/orvibo/switch.py index ece833b7036..34bf63aaaab 100644 --- a/homeassistant/components/orvibo/switch.py +++ b/homeassistant/components/orvibo/switch.py @@ -8,7 +8,10 @@ from typing import Any from orvibo.s20 import S20, S20Exception, discover import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import ( CONF_DISCOVERY, CONF_HOST, @@ -26,7 +29,7 @@ _LOGGER = logging.getLogger(__name__) DEFAULT_NAME = "Orvibo S20 Switch" DEFAULT_DISCOVERY = True -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_SWITCHES, default=[]): vol.All( cv.ensure_list, diff --git a/homeassistant/components/pencom/switch.py b/homeassistant/components/pencom/switch.py index a1ec25a58e9..d16c7e1600c 100644 --- a/homeassistant/components/pencom/switch.py +++ b/homeassistant/components/pencom/switch.py @@ -8,7 +8,10 @@ from typing import Any from pencompy.pencompy import Pencompy import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT from homeassistant.core import HomeAssistant from homeassistant.exceptions import PlatformNotReady @@ -31,7 +34,7 @@ RELAY_SCHEMA = vol.Schema( } ) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_HOST): cv.string, vol.Required(CONF_PORT): cv.port, diff --git a/homeassistant/components/pilight/switch.py b/homeassistant/components/pilight/switch.py index 0d0023d9cd6..5be63064b4a 100644 --- a/homeassistant/components/pilight/switch.py +++ b/homeassistant/components/pilight/switch.py @@ -4,7 +4,10 @@ from __future__ import annotations import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_SWITCHES from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -13,7 +16,7 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .base_class import SWITCHES_SCHEMA, PilightBaseDevice -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( {vol.Required(CONF_SWITCHES): vol.Schema({cv.string: SWITCHES_SCHEMA})} ) diff --git a/homeassistant/components/pulseaudio_loopback/switch.py b/homeassistant/components/pulseaudio_loopback/switch.py index 553a1b4a283..4ab1f905068 100644 --- a/homeassistant/components/pulseaudio_loopback/switch.py +++ b/homeassistant/components/pulseaudio_loopback/switch.py @@ -8,7 +8,10 @@ from typing import Any from pulsectl import Pulse, PulseError import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -27,7 +30,7 @@ DEFAULT_PORT = 4713 IGNORED_SWITCH_WARN = "Switch is already in the desired state. Ignoring." -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_SINK_NAME): cv.string, vol.Required(CONF_SOURCE_NAME): cv.string, diff --git a/homeassistant/components/raincloud/switch.py b/homeassistant/components/raincloud/switch.py index d901f862133..45d0b4f0fc5 100644 --- a/homeassistant/components/raincloud/switch.py +++ b/homeassistant/components/raincloud/switch.py @@ -7,7 +7,10 @@ from typing import Any import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_MONITORED_CONDITIONS from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -25,7 +28,7 @@ from . import ( _LOGGER = logging.getLogger(__name__) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Optional(CONF_MONITORED_CONDITIONS, default=list(SWITCHES)): vol.All( cv.ensure_list, [vol.In(SWITCHES)] diff --git a/homeassistant/components/raspyrfm/switch.py b/homeassistant/components/raspyrfm/switch.py index ce69818beec..37835ecb40a 100644 --- a/homeassistant/components/raspyrfm/switch.py +++ b/homeassistant/components/raspyrfm/switch.py @@ -13,7 +13,10 @@ from raspyrfm_client.device_implementations.gateway.manufacturer.gateway_constan from raspyrfm_client.device_implementations.manufacturer_constants import Manufacturer import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import ( CONF_HOST, CONF_NAME, @@ -34,7 +37,7 @@ CONF_CHANNEL_CONFIG = "channel_config" DEFAULT_HOST = "127.0.0.1" # define configuration parameters -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Optional(CONF_HOST, default=DEFAULT_HOST): cv.string, vol.Optional(CONF_PORT): cv.port, diff --git a/homeassistant/components/recswitch/switch.py b/homeassistant/components/recswitch/switch.py index a0035d50582..78fc0a805f6 100644 --- a/homeassistant/components/recswitch/switch.py +++ b/homeassistant/components/recswitch/switch.py @@ -8,7 +8,10 @@ from typing import Any from pyrecswitch import RSNetwork, RSNetworkError import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -21,7 +24,7 @@ DEFAULT_NAME = "RecSwitch {0}" DATA_RSN = "RSN" -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_HOST): cv.string, vol.Required(CONF_MAC): vol.All(cv.string, vol.Upper), diff --git a/homeassistant/components/remote_rpi_gpio/switch.py b/homeassistant/components/remote_rpi_gpio/switch.py index 756e9dcfce9..ff9ecbcd97b 100644 --- a/homeassistant/components/remote_rpi_gpio/switch.py +++ b/homeassistant/components/remote_rpi_gpio/switch.py @@ -6,7 +6,10 @@ from typing import Any import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_HOST, DEVICE_DEFAULT_NAME from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -20,7 +23,7 @@ CONF_PORTS = "ports" _SENSORS_SCHEMA = vol.Schema({cv.positive_int: cv.string}) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_HOST): cv.string, vol.Required(CONF_PORTS): _SENSORS_SCHEMA, diff --git a/homeassistant/components/rest/switch.py b/homeassistant/components/rest/switch.py index 99aadce6620..d01aab2cf9f 100644 --- a/homeassistant/components/rest/switch.py +++ b/homeassistant/components/rest/switch.py @@ -11,7 +11,7 @@ import voluptuous as vol from homeassistant.components.switch import ( DEVICE_CLASSES_SCHEMA, - PLATFORM_SCHEMA, + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( @@ -64,7 +64,7 @@ DEFAULT_VERIFY_SSL = True SUPPORT_REST_METHODS = ["post", "put", "patch"] -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { **TEMPLATE_ENTITY_BASE_SCHEMA.schema, vol.Required(CONF_RESOURCE): cv.url, diff --git a/homeassistant/components/rflink/switch.py b/homeassistant/components/rflink/switch.py index fdf8f63ab7d..af4bbc43700 100644 --- a/homeassistant/components/rflink/switch.py +++ b/homeassistant/components/rflink/switch.py @@ -4,7 +4,10 @@ from __future__ import annotations import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_DEVICES, CONF_NAME from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -25,7 +28,7 @@ from . import ( PARALLEL_UPDATES = 0 -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Optional( CONF_DEVICE_DEFAULTS, default=DEVICE_DEFAULTS_SCHEMA({}) diff --git a/homeassistant/components/scsgate/switch.py b/homeassistant/components/scsgate/switch.py index 8ad31106cf7..abc906a5533 100644 --- a/homeassistant/components/scsgate/switch.py +++ b/homeassistant/components/scsgate/switch.py @@ -9,7 +9,10 @@ from scsgate.messages import ScenarioTriggeredMessage, StateMessage from scsgate.tasks import ToggleStatusTask import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import ATTR_ENTITY_ID, ATTR_STATE, CONF_DEVICES, CONF_NAME from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -23,7 +26,7 @@ ATTR_SCENARIO_ID = "scenario_id" CONF_TRADITIONAL = "traditional" CONF_SCENARIO = "scenario" -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( {vol.Required(CONF_DEVICES): cv.schema_with_slug_keys(SCSGATE_SCHEMA)} ) diff --git a/homeassistant/components/snmp/switch.py b/homeassistant/components/snmp/switch.py index 02a94aeb8c1..e3ce09cbf48 100644 --- a/homeassistant/components/snmp/switch.py +++ b/homeassistant/components/snmp/switch.py @@ -31,7 +31,10 @@ from pysnmp.proto.rfc1902 import ( ) import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import ( CONF_HOST, CONF_NAME, @@ -98,7 +101,7 @@ MAP_SNMP_VARTYPES = { "Unsigned32": Unsigned32, } -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_BASEOID): cv.string, vol.Optional(CONF_COMMAND_OID): cv.string, diff --git a/homeassistant/components/sony_projector/switch.py b/homeassistant/components/sony_projector/switch.py index 7ecff46d3bd..e018c06e050 100644 --- a/homeassistant/components/sony_projector/switch.py +++ b/homeassistant/components/sony_projector/switch.py @@ -8,7 +8,10 @@ from typing import Any import pysdcp import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_HOST, CONF_NAME, STATE_OFF, STATE_ON from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -19,7 +22,7 @@ _LOGGER = logging.getLogger(__name__) DEFAULT_NAME = "Sony Projector" -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_HOST): cv.string, vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, diff --git a/homeassistant/components/switchmate/switch.py b/homeassistant/components/switchmate/switch.py index ee8b65b47e2..8484eb5a2d1 100644 --- a/homeassistant/components/switchmate/switch.py +++ b/homeassistant/components/switchmate/switch.py @@ -8,7 +8,10 @@ from typing import Any from switchmate import Switchmate import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_MAC, CONF_NAME from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -20,7 +23,7 @@ DEFAULT_NAME = "Switchmate" SCAN_INTERVAL = timedelta(minutes=30) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_MAC): cv.string, vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, diff --git a/homeassistant/components/telnet/switch.py b/homeassistant/components/telnet/switch.py index 6a6f758ff79..805f037dbae 100644 --- a/homeassistant/components/telnet/switch.py +++ b/homeassistant/components/telnet/switch.py @@ -11,7 +11,7 @@ import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, - PLATFORM_SCHEMA, + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( @@ -49,7 +49,7 @@ SWITCH_SCHEMA = vol.Schema( } ) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( {vol.Required(CONF_SWITCHES): cv.schema_with_slug_keys(SWITCH_SCHEMA)} ) diff --git a/homeassistant/components/template/switch.py b/homeassistant/components/template/switch.py index f585cd929c0..3a7cfcde0f7 100644 --- a/homeassistant/components/template/switch.py +++ b/homeassistant/components/template/switch.py @@ -8,7 +8,7 @@ import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, - PLATFORM_SCHEMA, + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( @@ -55,7 +55,7 @@ SWITCH_SCHEMA = vol.All( ).extend(TEMPLATE_ENTITY_COMMON_SCHEMA_LEGACY.schema), ) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( {vol.Required(CONF_SWITCHES): cv.schema_with_slug_keys(SWITCH_SCHEMA)} ) diff --git a/homeassistant/components/thinkingcleaner/switch.py b/homeassistant/components/thinkingcleaner/switch.py index f99cda4347a..76c7cdb0db2 100644 --- a/homeassistant/components/thinkingcleaner/switch.py +++ b/homeassistant/components/thinkingcleaner/switch.py @@ -11,7 +11,7 @@ import voluptuous as vol from homeassistant import util from homeassistant.components.switch import ( - PLATFORM_SCHEMA, + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, SwitchEntity, SwitchEntityDescription, ) @@ -42,7 +42,7 @@ SWITCH_TYPES: tuple[SwitchEntityDescription, ...] = ( ), ) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Optional(CONF_HOST): cv.string}) +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend({vol.Optional(CONF_HOST): cv.string}) def setup_platform( diff --git a/homeassistant/components/vultr/switch.py b/homeassistant/components/vultr/switch.py index 6758748b9f3..b03d613895a 100644 --- a/homeassistant/components/vultr/switch.py +++ b/homeassistant/components/vultr/switch.py @@ -7,7 +7,10 @@ from typing import Any import voluptuous as vol -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_NAME from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -35,7 +38,7 @@ from . import ( _LOGGER = logging.getLogger(__name__) DEFAULT_NAME = "Vultr {}" -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_SUBSCRIPTION): cv.string, vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, diff --git a/homeassistant/components/wake_on_lan/switch.py b/homeassistant/components/wake_on_lan/switch.py index e5c3a055310..cf38d05de38 100644 --- a/homeassistant/components/wake_on_lan/switch.py +++ b/homeassistant/components/wake_on_lan/switch.py @@ -10,7 +10,7 @@ import voluptuous as vol import wakeonlan from homeassistant.components.switch import ( - PLATFORM_SCHEMA as PARENT_PLATFORM_SCHEMA, + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( @@ -36,7 +36,7 @@ CONF_OFF_ACTION = "turn_off" DEFAULT_NAME = "Wake on LAN" DEFAULT_PING_TIMEOUT = 1 -PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_MAC): cv.string, vol.Optional(CONF_BROADCAST_ADDRESS): cv.string, diff --git a/homeassistant/components/wirelesstag/switch.py b/homeassistant/components/wirelesstag/switch.py index 0eafea0699b..239461df4ea 100644 --- a/homeassistant/components/wirelesstag/switch.py +++ b/homeassistant/components/wirelesstag/switch.py @@ -7,7 +7,7 @@ from typing import Any import voluptuous as vol from homeassistant.components.switch import ( - PLATFORM_SCHEMA, + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, SwitchEntity, SwitchEntityDescription, ) @@ -48,7 +48,7 @@ SWITCH_TYPES: tuple[SwitchEntityDescription, ...] = ( SWITCH_KEYS: list[str] = [desc.key for desc in SWITCH_TYPES] -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_MONITORED_CONDITIONS, default=[]): vol.All( cv.ensure_list, [vol.In(SWITCH_KEYS)] diff --git a/homeassistant/components/zoneminder/switch.py b/homeassistant/components/zoneminder/switch.py index 48cbe58a876..23adf2f4c88 100644 --- a/homeassistant/components/zoneminder/switch.py +++ b/homeassistant/components/zoneminder/switch.py @@ -9,7 +9,10 @@ import voluptuous as vol from zoneminder.monitor import Monitor, MonitorState from zoneminder.zm import ZoneMinder -from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity +from homeassistant.components.switch import ( + PLATFORM_SCHEMA as SWITCH_PLATFORM_SCHEMA, + SwitchEntity, +) from homeassistant.const import CONF_COMMAND_OFF, CONF_COMMAND_ON from homeassistant.core import HomeAssistant from homeassistant.exceptions import PlatformNotReady @@ -21,7 +24,7 @@ from . import DOMAIN as ZONEMINDER_DOMAIN _LOGGER = logging.getLogger(__name__) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( +PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend( { vol.Required(CONF_COMMAND_ON): cv.string, vol.Required(CONF_COMMAND_OFF): cv.string,