Rename SwitchDevice to SwitchEntity (#34673)
This commit is contained in:
parent
e4333a7a44
commit
066e921a8b
121 changed files with 273 additions and 251 deletions
|
@ -1,7 +1,7 @@
|
|||
"""Support for Abode Security System switches."""
|
||||
import abodepy.helpers.constants as CONST
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
||||
from . import AbodeAutomation, AbodeDevice
|
||||
|
@ -28,7 +28,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class AbodeSwitch(AbodeDevice, SwitchDevice):
|
||||
class AbodeSwitch(AbodeDevice, SwitchEntity):
|
||||
"""Representation of an Abode switch."""
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
|
@ -45,7 +45,7 @@ class AbodeSwitch(AbodeDevice, SwitchDevice):
|
|||
return self._device.is_on
|
||||
|
||||
|
||||
class AbodeAutomationSwitch(AbodeAutomation, SwitchDevice):
|
||||
class AbodeAutomationSwitch(AbodeAutomation, SwitchEntity):
|
||||
"""A switch implementation for Abode automations."""
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
|
|
|
@ -5,7 +5,7 @@ import re
|
|||
import serial
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import (
|
||||
CONF_FILENAME,
|
||||
CONF_NAME,
|
||||
|
@ -69,7 +69,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([AcerSwitch(serial_port, name, timeout, write_timeout)], True)
|
||||
|
||||
|
||||
class AcerSwitch(SwitchDevice):
|
||||
class AcerSwitch(SwitchEntity):
|
||||
"""Represents an Acer Projector as a switch."""
|
||||
|
||||
def __init__(self, serial_port, name, timeout, write_timeout, **kwargs):
|
||||
|
|
|
@ -10,7 +10,7 @@ from homeassistant.components.adguard.const import (
|
|||
DATA_ADGUARD_VERION,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
@ -45,7 +45,7 @@ async def async_setup_entry(
|
|||
async_add_entities(switches, True)
|
||||
|
||||
|
||||
class AdGuardHomeSwitch(AdGuardHomeDeviceEntity, SwitchDevice):
|
||||
class AdGuardHomeSwitch(AdGuardHomeDeviceEntity, SwitchEntity):
|
||||
"""Defines a AdGuard Home switch."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -31,7 +31,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([AdsSwitch(ads_hub, name, ads_var)])
|
||||
|
||||
|
||||
class AdsSwitch(AdsEntity, SwitchDevice):
|
||||
class AdsSwitch(AdsEntity, SwitchEntity):
|
||||
"""Representation of an ADS switch device."""
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Support for Android IP Webcam settings."""
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import (
|
||||
CONF_HOST,
|
||||
|
@ -30,7 +30,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(all_switches, True)
|
||||
|
||||
|
||||
class IPWebcamSettingsSwitch(AndroidIPCamEntity, SwitchDevice):
|
||||
class IPWebcamSettingsSwitch(AndroidIPCamEntity, SwitchEntity):
|
||||
"""An abstract class for an IP Webcam setting."""
|
||||
|
||||
def __init__(self, name, host, ipcam, setting):
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
from anel_pwrctrl import DeviceMaster
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.util import Throttle
|
||||
|
@ -58,7 +58,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devices)
|
||||
|
||||
|
||||
class PwrCtrlSwitch(SwitchDevice):
|
||||
class PwrCtrlSwitch(SwitchEntity):
|
||||
"""Representation of a PwrCtrl switch."""
|
||||
|
||||
def __init__(self, port, parent_device):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
from aqualogic.core import States
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_MONITORED_CONDITIONS
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -45,7 +45,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(switches)
|
||||
|
||||
|
||||
class AquaLogicSwitch(SwitchDevice):
|
||||
class AquaLogicSwitch(SwitchEntity):
|
||||
"""Switch implementation for the AquaLogic component."""
|
||||
|
||||
def __init__(self, processor, switch_type):
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -41,7 +41,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(switches)
|
||||
|
||||
|
||||
class ArduinoSwitch(SwitchDevice):
|
||||
class ArduinoSwitch(SwitchEntity):
|
||||
"""Representation of an Arduino switch."""
|
||||
|
||||
def __init__(self, pin, options, board):
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
import requests
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_NAME, CONF_RESOURCE, HTTP_OK
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -80,7 +80,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(dev)
|
||||
|
||||
|
||||
class ArestSwitchBase(SwitchDevice):
|
||||
class ArestSwitchBase(SwitchEntity):
|
||||
"""Representation of an aREST switch."""
|
||||
|
||||
def __init__(self, resource, location, name):
|
||||
|
|
|
@ -8,7 +8,7 @@ import voluptuous as vol
|
|||
from homeassistant.components.switch import (
|
||||
DEVICE_CLASS_OUTLET,
|
||||
PLATFORM_SCHEMA,
|
||||
SwitchDevice,
|
||||
SwitchEntity,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_USERNAME
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
|
@ -64,7 +64,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(switches)
|
||||
|
||||
|
||||
class AtenSwitch(SwitchDevice):
|
||||
class AtenSwitch(SwitchEntity):
|
||||
"""Represents an ATEN PE switch."""
|
||||
|
||||
def __init__(self, device, mac, outlet, name):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from axis.event_stream import CLASS_OUTPUT
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
||||
|
@ -27,7 +27,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
)
|
||||
|
||||
|
||||
class AxisSwitch(AxisEventBase, SwitchDevice):
|
||||
class AxisSwitch(AxisEventBase, SwitchEntity):
|
||||
"""Representation of a Axis switch."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -7,7 +7,7 @@ import socket
|
|||
import broadlink as blk
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import DOMAIN, PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import DOMAIN, PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import (
|
||||
CONF_COMMAND_OFF,
|
||||
CONF_COMMAND_ON,
|
||||
|
@ -146,7 +146,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(switches)
|
||||
|
||||
|
||||
class BroadlinkRMSwitch(SwitchDevice, RestoreEntity):
|
||||
class BroadlinkRMSwitch(SwitchEntity, RestoreEntity):
|
||||
"""Representation of an Broadlink switch."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -7,7 +7,7 @@ import voluptuous as vol
|
|||
from homeassistant.components.switch import (
|
||||
ENTITY_ID_FORMAT,
|
||||
PLATFORM_SCHEMA,
|
||||
SwitchDevice,
|
||||
SwitchEntity,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_COMMAND_OFF,
|
||||
|
@ -66,7 +66,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(switches)
|
||||
|
||||
|
||||
class CommandSwitch(SwitchDevice):
|
||||
class CommandSwitch(SwitchEntity):
|
||||
"""Representation a switch that can be toggled using shell commands."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
|
||||
from pydanfossair.commands import ReadCommand, UpdateCommand
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import DOMAIN as DANFOSS_AIR_DOMAIN
|
||||
|
||||
|
@ -43,7 +43,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(dev)
|
||||
|
||||
|
||||
class DanfossAir(SwitchDevice):
|
||||
class DanfossAir(SwitchEntity):
|
||||
"""Representation of a Danfoss Air HRV Switch."""
|
||||
|
||||
def __init__(self, data, name, state_command, on_command, off_command):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Support for deCONZ switches."""
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
||||
|
@ -43,7 +43,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_switch(gateway.api.lights.values())
|
||||
|
||||
|
||||
class DeconzPowerPlug(DeconzDevice, SwitchDevice):
|
||||
class DeconzPowerPlug(DeconzDevice, SwitchEntity):
|
||||
"""Representation of a deCONZ power plug."""
|
||||
|
||||
@property
|
||||
|
@ -62,7 +62,7 @@ class DeconzPowerPlug(DeconzDevice, SwitchDevice):
|
|||
await self._device.async_set_state(data)
|
||||
|
||||
|
||||
class DeconzSiren(DeconzDevice, SwitchDevice):
|
||||
class DeconzSiren(DeconzDevice, SwitchEntity):
|
||||
"""Representation of a deCONZ siren."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Demo platform that has two fake switches."""
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.const import DEVICE_DEFAULT_NAME
|
||||
|
||||
from . import DOMAIN
|
||||
|
@ -27,7 +27,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
await async_setup_platform(hass, {}, async_add_entities)
|
||||
|
||||
|
||||
class DemoSwitch(SwitchDevice):
|
||||
class DemoSwitch(SwitchEntity):
|
||||
"""Representation of a demo switch."""
|
||||
|
||||
def __init__(self, unique_id, name, state, icon, assumed, device_class=None):
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -50,7 +50,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(dev, True)
|
||||
|
||||
|
||||
class DigitalOceanSwitch(SwitchDevice):
|
||||
class DigitalOceanSwitch(SwitchEntity):
|
||||
"""Representation of a Digital Ocean droplet switch."""
|
||||
|
||||
def __init__(self, do, droplet_id):
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
import dlipower
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_NAME,
|
||||
|
@ -72,7 +72,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(outlets)
|
||||
|
||||
|
||||
class DINRelay(SwitchDevice):
|
||||
class DINRelay(SwitchEntity):
|
||||
"""Representation of an individual DIN III relay port."""
|
||||
|
||||
def __init__(self, controller_name, parent_device, outlet):
|
||||
|
|
|
@ -6,7 +6,7 @@ import urllib
|
|||
from pyW215.pyW215 import SmartPlug
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_TEMPERATURE,
|
||||
CONF_HOST,
|
||||
|
@ -56,7 +56,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([SmartPlugSwitch(hass, data, name)], True)
|
||||
|
||||
|
||||
class SmartPlugSwitch(SwitchDevice):
|
||||
class SmartPlugSwitch(SwitchEntity):
|
||||
"""Representation of a D-Link Smart Plug switch."""
|
||||
|
||||
def __init__(self, hass, data, name):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import datetime
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from .const import DOMAIN, DOOR_STATION, DOOR_STATION_INFO
|
||||
|
@ -31,7 +31,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class DoorBirdSwitch(DoorBirdEntity, SwitchDevice):
|
||||
class DoorBirdSwitch(DoorBirdEntity, SwitchEntity):
|
||||
"""A relay in a DoorBird device."""
|
||||
|
||||
def __init__(self, doorstation, doorstation_info, relay):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for the Dynalite channels and presets as switches."""
|
||||
from typing import Callable
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
@ -18,7 +18,7 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
|
||||
class DynaliteSwitch(DynaliteBase, SwitchDevice):
|
||||
class DynaliteSwitch(DynaliteBase, SwitchEntity):
|
||||
"""Representation of a Dynalite Channel as a Home Assistant Switch."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import AVAILABLE_PUMPS, DATA_ECOAL_BOILER
|
||||
|
||||
|
@ -21,7 +21,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(switches, True)
|
||||
|
||||
|
||||
class EcoalSwitch(SwitchDevice):
|
||||
class EcoalSwitch(SwitchEntity):
|
||||
"""Representation of Ecoal switch."""
|
||||
|
||||
def __init__(self, ecoal_contr, name, state_attr):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
from pyedimax.smartplug import SmartPlug
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_USERNAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -35,7 +35,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([SmartPlugSwitch(SmartPlug(host, auth), name)], True)
|
||||
|
||||
|
||||
class SmartPlugSwitch(SwitchDevice):
|
||||
class SmartPlugSwitch(SwitchEntity):
|
||||
"""Representation an Edimax Smart Plug switch."""
|
||||
|
||||
def __init__(self, smartplug, name):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Support for control of ElkM1 outputs (relays)."""
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import ElkAttachedEntity, create_elk_entities
|
||||
from .const import DOMAIN
|
||||
|
@ -14,7 +14,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(entities, True)
|
||||
|
||||
|
||||
class ElkOutput(ElkAttachedEntity, SwitchDevice):
|
||||
class ElkOutput(ElkAttachedEntity, SwitchEntity):
|
||||
"""Elk output as switch."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
import pypca
|
||||
from serial import SerialException
|
||||
|
||||
from homeassistant.components.switch import ATTR_CURRENT_POWER_W, SwitchDevice
|
||||
from homeassistant.components.switch import ATTR_CURRENT_POWER_W, SwitchEntity
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -38,7 +38,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
pca.start_scan()
|
||||
|
||||
|
||||
class SmartPlugSwitch(SwitchDevice):
|
||||
class SmartPlugSwitch(SwitchEntity):
|
||||
"""Representation of a PCA Smart Plug switch."""
|
||||
|
||||
def __init__(self, pca, device_id):
|
||||
|
|
|
@ -4,7 +4,7 @@ from typing import Optional
|
|||
|
||||
from aioesphomeapi import SwitchInfo, SwitchState
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
|
@ -28,7 +28,7 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
|
||||
class EsphomeSwitch(EsphomeEntity, SwitchDevice):
|
||||
class EsphomeSwitch(EsphomeEntity, SwitchEntity):
|
||||
"""A switch implementation for ESPHome."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
|
||||
import lakeside
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -15,7 +15,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([EufySwitch(discovery_info)], True)
|
||||
|
||||
|
||||
class EufySwitch(SwitchDevice):
|
||||
class EufySwitch(SwitchEntity):
|
||||
"""Representation of a Eufy switch."""
|
||||
|
||||
def __init__(self, device):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for Fibaro switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import DOMAIN, SwitchDevice
|
||||
from homeassistant.components.switch import DOMAIN, SwitchEntity
|
||||
from homeassistant.util import convert
|
||||
|
||||
from . import FIBARO_DEVICES, FibaroDevice
|
||||
|
@ -19,7 +19,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
)
|
||||
|
||||
|
||||
class FibaroSwitch(FibaroDevice, SwitchDevice):
|
||||
class FibaroSwitch(FibaroDevice, SwitchEntity):
|
||||
"""Representation of a Fibaro Switch."""
|
||||
|
||||
def __init__(self, fibaro_device):
|
||||
|
|
|
@ -19,7 +19,7 @@ from homeassistant.components.light import (
|
|||
VALID_TRANSITION,
|
||||
is_on,
|
||||
)
|
||||
from homeassistant.components.switch import DOMAIN, SwitchDevice
|
||||
from homeassistant.components.switch import DOMAIN, SwitchEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
CONF_LIGHTS,
|
||||
|
@ -168,7 +168,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
hass.services.async_register(DOMAIN, service_name, async_update)
|
||||
|
||||
|
||||
class FluxSwitch(SwitchDevice, RestoreEntity):
|
||||
class FluxSwitch(SwitchEntity, RestoreEntity):
|
||||
"""Representation of a Flux switch."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -4,7 +4,7 @@ from typing import Dict
|
|||
|
||||
from aiofreepybox.exceptions import InsufficientPermissionsError
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
|
@ -22,7 +22,7 @@ async def async_setup_entry(
|
|||
async_add_entities([FreeboxWifiSwitch(router)], True)
|
||||
|
||||
|
||||
class FreeboxWifiSwitch(SwitchDevice):
|
||||
class FreeboxWifiSwitch(SwitchEntity):
|
||||
"""Representation of a freebox wifi switch."""
|
||||
|
||||
def __init__(self, router: FreeboxRouter) -> None:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for AVM Fritz!Box smarthome switch devices."""
|
||||
import requests
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_TEMPERATURE,
|
||||
CONF_DEVICES,
|
||||
|
@ -37,7 +37,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class FritzboxSwitch(SwitchDevice):
|
||||
class FritzboxSwitch(SwitchEntity):
|
||||
"""The switch class for Fritzbox switches."""
|
||||
|
||||
def __init__(self, device, fritz):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Support for Genius Hub switch/outlet devices."""
|
||||
from homeassistant.components.switch import DEVICE_CLASS_OUTLET, SwitchDevice
|
||||
from homeassistant.components.switch import DEVICE_CLASS_OUTLET, SwitchEntity
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
|
||||
from . import DOMAIN, GeniusZone
|
||||
|
@ -27,7 +27,7 @@ async def async_setup_platform(
|
|||
)
|
||||
|
||||
|
||||
class GeniusSwitch(GeniusZone, SwitchDevice):
|
||||
class GeniusSwitch(GeniusZone, SwitchEntity):
|
||||
"""Representation of a Genius Hub switch."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for HDMI CEC devices as switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import DOMAIN, SwitchDevice
|
||||
from homeassistant.components.switch import DOMAIN, SwitchEntity
|
||||
from homeassistant.const import STATE_OFF, STATE_ON, STATE_STANDBY
|
||||
|
||||
from . import ATTR_NEW, CecDevice
|
||||
|
@ -22,7 +22,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(entities, True)
|
||||
|
||||
|
||||
class CecSwitchDevice(CecDevice, SwitchDevice):
|
||||
class CecSwitchDevice(CecDevice, SwitchEntity):
|
||||
"""Representation of a HDMI device as a Switch."""
|
||||
|
||||
def __init__(self, device, logical) -> None:
|
||||
|
|
|
@ -5,7 +5,7 @@ import hikvision.api
|
|||
from hikvision.error import HikvisionError, MissingParamError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_NAME,
|
||||
|
@ -59,7 +59,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([HikvisionMotionSwitch(name, hikvision_cam)])
|
||||
|
||||
|
||||
class HikvisionMotionSwitch(SwitchDevice):
|
||||
class HikvisionMotionSwitch(SwitchEntity):
|
||||
"""Representation of a switch to toggle on/off motion detection."""
|
||||
|
||||
def __init__(self, name, hikvision_cam):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Support for the Hive switches."""
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import DATA_HIVE, DOMAIN, HiveEntity, refresh_system
|
||||
|
||||
|
@ -16,7 +16,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devs)
|
||||
|
||||
|
||||
class HiveDevicePlug(HiveEntity, SwitchDevice):
|
||||
class HiveDevicePlug(HiveEntity, SwitchEntity):
|
||||
"""Hive Active Plug."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -7,7 +7,7 @@ from aiohomekit.model.characteristics import (
|
|||
IsConfiguredValues,
|
||||
)
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.core import callback
|
||||
|
||||
from . import KNOWN_DEVICES, HomeKitEntity
|
||||
|
@ -21,7 +21,7 @@ ATTR_IS_CONFIGURED = "is_configured"
|
|||
ATTR_REMAINING_DURATION = "remaining_duration"
|
||||
|
||||
|
||||
class HomeKitSwitch(HomeKitEntity, SwitchDevice):
|
||||
class HomeKitSwitch(HomeKitEntity, SwitchEntity):
|
||||
"""Representation of a Homekit switch."""
|
||||
|
||||
def get_characteristic_types(self):
|
||||
|
@ -49,7 +49,7 @@ class HomeKitSwitch(HomeKitEntity, SwitchDevice):
|
|||
return {OUTLET_IN_USE: outlet_in_use}
|
||||
|
||||
|
||||
class HomeKitValve(HomeKitEntity, SwitchDevice):
|
||||
class HomeKitValve(HomeKitEntity, SwitchEntity):
|
||||
"""Represents a valve in an irrigation system."""
|
||||
|
||||
def get_characteristic_types(self):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for HomeMatic switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from .const import ATTR_DISCOVER_DEVICES
|
||||
from .entity import HMDevice
|
||||
|
@ -22,7 +22,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devices, True)
|
||||
|
||||
|
||||
class HMSwitch(HMDevice, SwitchDevice):
|
||||
class HMSwitch(HMDevice, SwitchEntity):
|
||||
"""Representation of a HomeMatic switch."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -15,7 +15,7 @@ from homematicip.aio.device import (
|
|||
)
|
||||
from homematicip.aio.group import AsyncExtendedLinkedSwitchingGroup, AsyncSwitchingGroup
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
|
@ -67,7 +67,7 @@ async def async_setup_entry(
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class HomematicipSwitch(HomematicipGenericDevice, SwitchDevice):
|
||||
class HomematicipSwitch(HomematicipGenericDevice, SwitchEntity):
|
||||
"""representation of a HomematicIP Cloud switch device."""
|
||||
|
||||
def __init__(self, hap: HomematicipHAP, device) -> None:
|
||||
|
@ -88,7 +88,7 @@ class HomematicipSwitch(HomematicipGenericDevice, SwitchDevice):
|
|||
await self._device.turn_off()
|
||||
|
||||
|
||||
class HomematicipGroupSwitch(HomematicipGenericDevice, SwitchDevice):
|
||||
class HomematicipGroupSwitch(HomematicipGenericDevice, SwitchEntity):
|
||||
"""representation of a HomematicIP switching group."""
|
||||
|
||||
def __init__(self, hap: HomematicipHAP, device, post: str = "Group") -> None:
|
||||
|
@ -145,7 +145,7 @@ class HomematicipSwitchMeasuring(HomematicipSwitch):
|
|||
return round(self._device.energyCounter)
|
||||
|
||||
|
||||
class HomematicipMultiSwitch(HomematicipGenericDevice, SwitchDevice):
|
||||
class HomematicipMultiSwitch(HomematicipGenericDevice, SwitchEntity):
|
||||
"""Representation of a HomematicIP Cloud multi switch device."""
|
||||
|
||||
def __init__(self, hap: HomematicipHAP, device, channel: int) -> None:
|
||||
|
|
|
@ -8,7 +8,7 @@ import attr
|
|||
from homeassistant.components.switch import (
|
||||
DEVICE_CLASS_SWITCH,
|
||||
DOMAIN as SWITCH_DOMAIN,
|
||||
SwitchDevice,
|
||||
SwitchEntity,
|
||||
)
|
||||
from homeassistant.const import CONF_URL
|
||||
|
||||
|
@ -30,7 +30,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
|
||||
|
||||
@attr.s
|
||||
class HuaweiLteBaseSwitch(HuaweiLteBaseEntity, SwitchDevice):
|
||||
class HuaweiLteBaseSwitch(HuaweiLteBaseEntity, SwitchEntity):
|
||||
"""Huawei LTE switch device base class."""
|
||||
|
||||
key: str
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_MONITORED_CONDITIONS
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -47,7 +47,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors, True)
|
||||
|
||||
|
||||
class HydrawiseSwitch(HydrawiseEntity, SwitchDevice):
|
||||
class HydrawiseSwitch(HydrawiseEntity, SwitchEntity):
|
||||
"""A switch implementation for Hydrawise device."""
|
||||
|
||||
def __init__(self, default_watering_timer, *args):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for Aqualink pool feature switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import DOMAIN, SwitchDevice
|
||||
from homeassistant.components.switch import DOMAIN, SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
|
@ -23,7 +23,7 @@ async def async_setup_entry(
|
|||
async_add_entities(devs, True)
|
||||
|
||||
|
||||
class HassAqualinkSwitch(AqualinkEntity, SwitchDevice):
|
||||
class HassAqualinkSwitch(AqualinkEntity, SwitchEntity):
|
||||
"""Representation of a switch."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Support for IHC switches."""
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import IHC_CONTROLLER, IHC_INFO
|
||||
from .const import CONF_OFF_ID, CONF_ON_ID
|
||||
|
@ -31,7 +31,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devices)
|
||||
|
||||
|
||||
class IHCSwitch(IHCDevice, SwitchDevice):
|
||||
class IHCSwitch(IHCDevice, SwitchEntity):
|
||||
"""Representation of an IHC switch."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for INSTEON dimmers via PowerLinc Modem."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from .insteon_entity import InsteonEntity
|
||||
|
||||
|
@ -32,7 +32,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities([new_entity])
|
||||
|
||||
|
||||
class InsteonSwitchDevice(InsteonEntity, SwitchDevice):
|
||||
class InsteonSwitchDevice(InsteonEntity, SwitchEntity):
|
||||
"""A Class for an Insteon device."""
|
||||
|
||||
@property
|
||||
|
@ -49,7 +49,7 @@ class InsteonSwitchDevice(InsteonEntity, SwitchDevice):
|
|||
self._insteon_device_state.off()
|
||||
|
||||
|
||||
class InsteonOpenClosedDevice(InsteonEntity, SwitchDevice):
|
||||
class InsteonOpenClosedDevice(InsteonEntity, SwitchEntity):
|
||||
"""A Class for an Insteon device."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import logging
|
||||
from typing import Callable
|
||||
|
||||
from homeassistant.components.switch import DOMAIN, SwitchDevice
|
||||
from homeassistant.components.switch import DOMAIN, SwitchEntity
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import ISY994_NODES, ISY994_PROGRAMS, ISYDevice
|
||||
|
@ -25,7 +25,7 @@ def setup_platform(
|
|||
add_entities(devices)
|
||||
|
||||
|
||||
class ISYSwitchDevice(ISYDevice, SwitchDevice):
|
||||
class ISYSwitchDevice(ISYDevice, SwitchEntity):
|
||||
"""Representation of an ISY994 switch device."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for monitoring juicenet/juicepoint/juicebox based EVSE switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import DOMAIN, JuicenetDevice
|
||||
|
||||
|
@ -19,7 +19,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devs)
|
||||
|
||||
|
||||
class JuicenetChargeNowSwitch(JuicenetDevice, SwitchDevice):
|
||||
class JuicenetChargeNowSwitch(JuicenetDevice, SwitchEntity):
|
||||
"""Implementation of a Juicenet switch."""
|
||||
|
||||
def __init__(self, device, hass):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
import requests
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_NAME,
|
||||
|
@ -58,7 +58,7 @@ def setup_platform(hass, config, add_entities_callback, discovery_info=None):
|
|||
add_entities_callback(devices)
|
||||
|
||||
|
||||
class KankunSwitch(SwitchDevice):
|
||||
class KankunSwitch(SwitchEntity):
|
||||
"""Representation of a Kankun Wifi switch."""
|
||||
|
||||
def __init__(self, hass, name, host, port, path, user, passwd):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import voluptuous as vol
|
||||
from xknx.devices import Switch as XknxSwitch
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_ADDRESS, CONF_NAME
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -52,7 +52,7 @@ def async_add_entities_config(hass, config, async_add_entities):
|
|||
async_add_entities([KNXSwitch(switch)])
|
||||
|
||||
|
||||
class KNXSwitch(SwitchDevice):
|
||||
class KNXSwitch(SwitchEntity):
|
||||
"""Representation of a KNX switch."""
|
||||
|
||||
def __init__(self, device):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for LCN switches."""
|
||||
import pypck
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.const import CONF_ADDRESS
|
||||
|
||||
from . import LcnDevice
|
||||
|
@ -34,7 +34,7 @@ async def async_setup_platform(
|
|||
async_add_entities(devices)
|
||||
|
||||
|
||||
class LcnOutputSwitch(LcnDevice, SwitchDevice):
|
||||
class LcnOutputSwitch(LcnDevice, SwitchEntity):
|
||||
"""Representation of a LCN switch for output ports."""
|
||||
|
||||
def __init__(self, config, address_connection):
|
||||
|
@ -79,7 +79,7 @@ class LcnOutputSwitch(LcnDevice, SwitchDevice):
|
|||
self.async_write_ha_state()
|
||||
|
||||
|
||||
class LcnRelaySwitch(LcnDevice, SwitchDevice):
|
||||
class LcnRelaySwitch(LcnDevice, SwitchEntity):
|
||||
"""Representation of a LCN switch for relay ports."""
|
||||
|
||||
def __init__(self, config, address_connection):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Support for LightwaveRF switches."""
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.const import CONF_NAME
|
||||
|
||||
from . import LIGHTWAVE_LINK
|
||||
|
@ -20,7 +20,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(switches)
|
||||
|
||||
|
||||
class LWRFSwitch(SwitchDevice):
|
||||
class LWRFSwitch(SwitchEntity):
|
||||
"""Representation of a LightWaveRF switch."""
|
||||
|
||||
def __init__(self, name, device_id, lwlink):
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from . import (
|
||||
|
@ -44,7 +44,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(dev, True)
|
||||
|
||||
|
||||
class LinodeSwitch(SwitchDevice):
|
||||
class LinodeSwitch(SwitchEntity):
|
||||
"""Representation of a Linode Node switch."""
|
||||
|
||||
def __init__(self, li, node_id):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import logging
|
||||
|
||||
from homeassistant.components import litejet
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
ATTR_NUMBER = "number"
|
||||
|
||||
|
@ -21,7 +21,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devices, True)
|
||||
|
||||
|
||||
class LiteJetSwitch(SwitchDevice):
|
||||
class LiteJetSwitch(SwitchEntity):
|
||||
"""Representation of a single LiteJet switch."""
|
||||
|
||||
def __init__(self, hass, lj, i, name):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
|
||||
import lupupy.constants as CONST
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import DOMAIN as LUPUSEC_DOMAIN, LupusecDevice
|
||||
|
||||
|
@ -29,7 +29,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devices)
|
||||
|
||||
|
||||
class LupusecSwitch(LupusecDevice, SwitchDevice):
|
||||
class LupusecSwitch(LupusecDevice, SwitchEntity):
|
||||
"""Representation of a Lupusec switch."""
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for Lutron switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice
|
||||
|
||||
|
@ -29,7 +29,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devs, True)
|
||||
|
||||
|
||||
class LutronSwitch(LutronDevice, SwitchDevice):
|
||||
class LutronSwitch(LutronDevice, SwitchEntity):
|
||||
"""Representation of a Lutron Switch."""
|
||||
|
||||
def __init__(self, area_name, lutron_device, controller):
|
||||
|
@ -63,7 +63,7 @@ class LutronSwitch(LutronDevice, SwitchDevice):
|
|||
self._prev_state = self._lutron_device.level > 0
|
||||
|
||||
|
||||
class LutronLed(LutronDevice, SwitchDevice):
|
||||
class LutronLed(LutronDevice, SwitchEntity):
|
||||
"""Representation of a Lutron Keypad LED."""
|
||||
|
||||
def __init__(self, area_name, keypad_name, scene_device, led_device, controller):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for Lutron Caseta switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import DOMAIN, SwitchDevice
|
||||
from homeassistant.components.switch import DOMAIN, SwitchEntity
|
||||
|
||||
from . import LUTRON_CASETA_SMARTBRIDGE, LutronCasetaDevice
|
||||
|
||||
|
@ -22,7 +22,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
return True
|
||||
|
||||
|
||||
class LutronCasetaLight(LutronCasetaDevice, SwitchDevice):
|
||||
class LutronCasetaLight(LutronCasetaDevice, SwitchEntity):
|
||||
"""Representation of a Lutron Caseta switch."""
|
||||
|
||||
async def async_turn_on(self, **kwargs):
|
||||
|
|
|
@ -5,7 +5,7 @@ from mficlient.client import FailedToLogin, MFiClient
|
|||
import requests
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_PASSWORD,
|
||||
|
@ -61,7 +61,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
)
|
||||
|
||||
|
||||
class MfiSwitch(SwitchDevice):
|
||||
class MfiSwitch(SwitchEntity):
|
||||
"""Representation of an mFi switch-able device."""
|
||||
|
||||
def __init__(self, port):
|
||||
|
|
|
@ -5,7 +5,7 @@ from pymochad import device
|
|||
from pymochad.exceptions import MochadException
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.const import CONF_ADDRESS, CONF_DEVICES, CONF_NAME, CONF_PLATFORM
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
|
||||
|
@ -36,7 +36,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
return True
|
||||
|
||||
|
||||
class MochadSwitch(SwitchDevice):
|
||||
class MochadSwitch(SwitchEntity):
|
||||
"""Representation of a X10 switch over Mochad."""
|
||||
|
||||
def __init__(self, hass, ctrl, dev):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import mqtt, switch
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE,
|
||||
CONF_ICON,
|
||||
|
@ -104,7 +104,7 @@ class MqttSwitch(
|
|||
MqttAvailability,
|
||||
MqttDiscoveryUpdate,
|
||||
MqttEntityDeviceInfo,
|
||||
SwitchDevice,
|
||||
SwitchEntity,
|
||||
RestoreEntity,
|
||||
):
|
||||
"""Representation of a switch that can be toggled using MQTT."""
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import mysensors
|
||||
from homeassistant.components.switch import DOMAIN, SwitchDevice
|
||||
from homeassistant.components.switch import DOMAIN, SwitchEntity
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -72,7 +72,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
)
|
||||
|
||||
|
||||
class MySensorsSwitch(mysensors.device.MySensorsEntity, SwitchDevice):
|
||||
class MySensorsSwitch(mysensors.device.MySensorsEntity, SwitchEntity):
|
||||
"""Representation of the value of a MySensors Switch child node."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -5,7 +5,7 @@ from pymystrom.exceptions import MyStromConnectionError
|
|||
from pymystrom.switch import MyStromSwitch as _MyStromSwitch
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -37,7 +37,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities([MyStromSwitch(plug, name)])
|
||||
|
||||
|
||||
class MyStromSwitch(SwitchDevice):
|
||||
class MyStromSwitch(SwitchEntity):
|
||||
"""Representation of a myStrom switch/plug."""
|
||||
|
||||
def __init__(self, plug, name):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for N26 switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import DEFAULT_SCAN_INTERVAL, DOMAIN
|
||||
from .const import CARD_STATE_ACTIVE, CARD_STATE_BLOCKED, DATA
|
||||
|
@ -26,7 +26,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(switch_entities)
|
||||
|
||||
|
||||
class N26CardSwitch(SwitchDevice):
|
||||
class N26CardSwitch(SwitchEntity):
|
||||
"""Representation of a N26 card block/unblock switch."""
|
||||
|
||||
def __init__(self, api_data, card: dict):
|
||||
|
|
|
@ -8,7 +8,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant import util
|
||||
from homeassistant.components.http import HomeAssistantView
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_PASSWORD,
|
||||
|
@ -125,7 +125,7 @@ class NetioApiView(HomeAssistantView):
|
|||
return self.json(True)
|
||||
|
||||
|
||||
class NetioSwitch(SwitchDevice):
|
||||
class NetioSwitch(SwitchEntity):
|
||||
"""Provide a Netio linked switch."""
|
||||
|
||||
def __init__(self, netio, outlet, name):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
from orvibo.s20 import S20, S20Exception, discover
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import (
|
||||
CONF_DISCOVERY,
|
||||
CONF_HOST,
|
||||
|
@ -62,7 +62,7 @@ def setup_platform(hass, config, add_entities_callback, discovery_info=None):
|
|||
add_entities_callback(switches)
|
||||
|
||||
|
||||
class S20Switch(SwitchDevice):
|
||||
class S20Switch(SwitchEntity):
|
||||
"""Representation of an S20 switch."""
|
||||
|
||||
def __init__(self, name, s20):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
from pcal9535a import PCAL9535A
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import DEVICE_DEFAULT_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -58,7 +58,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(switches)
|
||||
|
||||
|
||||
class PCAL9535ASwitch(SwitchDevice):
|
||||
class PCAL9535ASwitch(SwitchEntity):
|
||||
"""Representation of a PCAL9535A output pin."""
|
||||
|
||||
def __init__(self, name, pin, invert_logic):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
from pencompy.pencompy import Pencompy
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -59,7 +59,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devs, True)
|
||||
|
||||
|
||||
class PencomRelay(SwitchDevice):
|
||||
class PencomRelay(SwitchEntity):
|
||||
"""Representation of a pencom relay."""
|
||||
|
||||
def __init__(self, hub, board, addr, name):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
from pi4ioe5v9xxxx import pi4ioe5v9xxxx # pylint: disable=import-error
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import DEVICE_DEFAULT_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -51,7 +51,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(switches)
|
||||
|
||||
|
||||
class Pi4ioe5v9Switch(SwitchDevice):
|
||||
class Pi4ioe5v9Switch(SwitchEntity):
|
||||
"""Representation of a pi4ioe5v9 IO expansion IO."""
|
||||
|
||||
def __init__(self, name, pin, invert_logic):
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_SWITCHES
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -27,5 +27,5 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devices)
|
||||
|
||||
|
||||
class PilightSwitch(PilightBaseDevice, SwitchDevice):
|
||||
class PilightSwitch(PilightBaseDevice, SwitchEntity):
|
||||
"""Representation of a Pilight switch."""
|
||||
|
|
|
@ -7,7 +7,7 @@ import socket
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant import util
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -137,7 +137,7 @@ class PAServer:
|
|||
return -1
|
||||
|
||||
|
||||
class PALoopbackSwitch(SwitchDevice):
|
||||
class PALoopbackSwitch(SwitchEntity):
|
||||
"""Representation the presence or absence of a PA loopback module."""
|
||||
|
||||
def __init__(self, hass, name, pa_server, sink_name, source_name):
|
||||
|
|
|
@ -103,7 +103,7 @@ class QSToggleEntity(QSEntity):
|
|||
|
||||
Implemented:
|
||||
- QSLight extends QSToggleEntity and Light[2] (ToggleEntity[1])
|
||||
- QSSwitch extends QSToggleEntity and SwitchDevice[3] (ToggleEntity[1])
|
||||
- QSSwitch extends QSToggleEntity and SwitchEntity[3] (ToggleEntity[1])
|
||||
|
||||
[1] /helpers/entity.py
|
||||
[2] /components/light/__init__.py
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Support for Qwikswitch relays."""
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import DOMAIN as QWIKSWITCH, QSToggleEntity
|
||||
|
||||
|
@ -14,5 +14,5 @@ async def async_setup_platform(hass, _, add_entities, discovery_info=None):
|
|||
add_entities(devs)
|
||||
|
||||
|
||||
class QSSwitch(QSToggleEntity, SwitchDevice):
|
||||
class QSSwitch(QSToggleEntity, SwitchEntity):
|
||||
"""Switch based on a Qwikswitch relay module."""
|
||||
|
|
|
@ -3,7 +3,7 @@ from abc import abstractmethod
|
|||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
||||
|
@ -79,7 +79,7 @@ def _create_entities(hass, config_entry):
|
|||
return entities
|
||||
|
||||
|
||||
class RachioSwitch(RachioDevice, SwitchDevice):
|
||||
class RachioSwitch(RachioDevice, SwitchEntity):
|
||||
"""Represent a Rachio state that can be toggled."""
|
||||
|
||||
def __init__(self, controller, poll=True):
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
from pyrainbird import AvailableStations, RainbirdController
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.const import ATTR_ENTITY_ID, CONF_FRIENDLY_NAME, CONF_TRIGGER_TIME
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
|
||||
|
@ -67,7 +67,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
)
|
||||
|
||||
|
||||
class RainBirdSwitch(SwitchDevice):
|
||||
class RainBirdSwitch(SwitchEntity):
|
||||
"""Representation of a Rain Bird switch."""
|
||||
|
||||
def __init__(self, controller: RainbirdController, zone, time, name):
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_MONITORED_CONDITIONS
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -45,7 +45,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors, True)
|
||||
|
||||
|
||||
class RainCloudSwitch(RainCloudEntity, SwitchDevice):
|
||||
class RainCloudSwitch(RainCloudEntity, SwitchEntity):
|
||||
"""A switch implementation for raincloud device."""
|
||||
|
||||
def __init__(self, default_watering_timer, *args):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
|
||||
from regenmaschine.errors import RequestError
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.const import ATTR_ID
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
@ -111,7 +111,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
async_add_entities(entities, True)
|
||||
|
||||
|
||||
class RainMachineSwitch(RainMachineEntity, SwitchDevice):
|
||||
class RainMachineSwitch(RainMachineEntity, SwitchEntity):
|
||||
"""A class to represent a generic RainMachine switch."""
|
||||
|
||||
def __init__(self, rainmachine, switch_data):
|
||||
|
|
|
@ -12,7 +12,7 @@ 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, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_NAME,
|
||||
|
@ -87,7 +87,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(switch_entities)
|
||||
|
||||
|
||||
class RaspyRFMSwitch(SwitchDevice):
|
||||
class RaspyRFMSwitch(SwitchEntity):
|
||||
"""Representation of a RaspyRFM switch."""
|
||||
|
||||
def __init__(self, raspyrfm_client, name: str, gateway, controlunit):
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
from pyrecswitch import RSNetwork, RSNetworkError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -40,7 +40,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities([RecSwitchSwitch(device, device_name, mac_address)])
|
||||
|
||||
|
||||
class RecSwitchSwitch(SwitchDevice):
|
||||
class RecSwitchSwitch(SwitchEntity):
|
||||
"""Representation of a recswitch device."""
|
||||
|
||||
def __init__(self, device, device_name, mac_address):
|
||||
|
|
|
@ -6,7 +6,7 @@ import aiohttp
|
|||
import async_timeout
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import (
|
||||
CONF_HEADERS,
|
||||
CONF_METHOD,
|
||||
|
@ -109,7 +109,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
_LOGGER.error("No route to resource/endpoint: %s", resource)
|
||||
|
||||
|
||||
class RestSwitch(SwitchDevice):
|
||||
class RestSwitch(SwitchEntity):
|
||||
"""Representation of a switch that can be toggled using REST."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -69,5 +69,5 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(devices_from_config(config))
|
||||
|
||||
|
||||
class RflinkSwitch(SwitchableRflinkDevice, SwitchDevice):
|
||||
class RflinkSwitch(SwitchableRflinkDevice, SwitchEntity):
|
||||
"""Representation of a Rflink switch."""
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
import RFXtrx as rfxtrxmod
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_NAME, STATE_ON
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
|
@ -68,7 +68,7 @@ def setup_platform(hass, config, add_entities_callback, discovery_info=None):
|
|||
RECEIVED_EVT_SUBSCRIBERS.append(switch_update)
|
||||
|
||||
|
||||
class RfxtrxSwitch(RfxtrxDevice, SwitchDevice, RestoreEntity):
|
||||
class RfxtrxSwitch(RfxtrxDevice, SwitchEntity, RestoreEntity):
|
||||
"""Representation of a RFXtrx switch."""
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
|
||||
import requests
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
|
@ -36,7 +36,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(switches)
|
||||
|
||||
|
||||
class BaseRingSwitch(RingEntityMixin, SwitchDevice):
|
||||
class BaseRingSwitch(RingEntityMixin, SwitchEntity):
|
||||
"""Represents a switch for controlling an aspect of a ring device."""
|
||||
|
||||
def __init__(self, config_entry_id, device, device_type):
|
||||
|
|
|
@ -5,7 +5,7 @@ from threading import RLock
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_NAME, CONF_SWITCHES, EVENT_HOMEASSISTANT_STOP
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -73,7 +73,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, lambda event: rfdevice.cleanup())
|
||||
|
||||
|
||||
class RPiRFSwitch(SwitchDevice):
|
||||
class RPiRFSwitch(SwitchEntity):
|
||||
"""Representation of a GPIO RF switch."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for Satel Integra modifiable outputs represented as switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
||||
|
@ -39,7 +39,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(devices)
|
||||
|
||||
|
||||
class SatelIntegraSwitch(SwitchDevice):
|
||||
class SatelIntegraSwitch(SwitchEntity):
|
||||
"""Representation of an Satel switch."""
|
||||
|
||||
def __init__(self, controller, device_number, device_name, code):
|
||||
|
|
|
@ -5,7 +5,7 @@ from scsgate.messages import ScenarioTriggeredMessage, StateMessage
|
|||
from scsgate.tasks import ToggleStatusTask
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_STATE, CONF_DEVICES, CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -80,7 +80,7 @@ def _setup_scenario_switches(logger, config, scsgate, hass):
|
|||
scsgate.add_device(switch)
|
||||
|
||||
|
||||
class SCSGateSwitch(SwitchDevice):
|
||||
class SCSGateSwitch(SwitchEntity):
|
||||
"""Representation of a SCSGate switch."""
|
||||
|
||||
def __init__(self, scs_id, name, logger, scsgate):
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_ENTITY_NAMESPACE, CONF_MONITORED_CONDITIONS
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -41,7 +41,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors, True)
|
||||
|
||||
|
||||
class SkybellSwitch(SkybellDevice, SwitchDevice):
|
||||
class SkybellSwitch(SkybellDevice, SwitchEntity):
|
||||
"""A switch implementation for Skybell devices."""
|
||||
|
||||
def __init__(self, device, switch_type):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for interacting with Smappee Comport Plugs."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import DATA_SMAPPEE
|
||||
|
||||
|
@ -34,7 +34,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(dev)
|
||||
|
||||
|
||||
class SmappeeSwitch(SwitchDevice):
|
||||
class SmappeeSwitch(SwitchEntity):
|
||||
"""Representation of a Smappee Comport Plug."""
|
||||
|
||||
def __init__(self, smappee, name, location_id, switch_id):
|
||||
|
|
|
@ -3,7 +3,7 @@ from typing import Optional, Sequence
|
|||
|
||||
from pysmartthings import Attribute, Capability
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import SmartThingsEntity
|
||||
from .const import DATA_BROKERS, DOMAIN
|
||||
|
@ -29,7 +29,7 @@ def get_capabilities(capabilities: Sequence[str]) -> Optional[Sequence[str]]:
|
|||
return None
|
||||
|
||||
|
||||
class SmartThingsSwitch(SmartThingsEntity, SwitchDevice):
|
||||
class SmartThingsSwitch(SmartThingsEntity, SwitchEntity):
|
||||
"""Define a SmartThings switch."""
|
||||
|
||||
async def async_turn_off(self, **kwargs) -> None:
|
||||
|
|
|
@ -16,7 +16,7 @@ from pysnmp.hlapi.asyncio import (
|
|||
)
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_NAME,
|
||||
|
@ -126,7 +126,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
)
|
||||
|
||||
|
||||
class SnmpSwitch(SwitchDevice):
|
||||
class SnmpSwitch(SwitchEntity):
|
||||
"""Representation of a SNMP switch."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from pymfy.api.devices.camera_protect import CameraProtect
|
||||
from pymfy.api.devices.category import Category
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import API, DEVICES, DOMAIN, SomfyEntity
|
||||
|
||||
|
@ -23,7 +23,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(await hass.async_add_executor_job(get_shutters), True)
|
||||
|
||||
|
||||
class SomfyCameraShutter(SomfyEntity, SwitchDevice):
|
||||
class SomfyCameraShutter(SomfyEntity, SwitchEntity):
|
||||
"""Representation of a Somfy Camera Shutter device."""
|
||||
|
||||
def __init__(self, device, api):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
import pysdcp
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, STATE_OFF, STATE_ON
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -38,7 +38,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
return True
|
||||
|
||||
|
||||
class SonyProjector(SwitchDevice):
|
||||
class SonyProjector(SwitchEntity):
|
||||
"""Represents a Sony Projector as a switch."""
|
||||
|
||||
def __init__(self, sdcp_connection, name):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for Spider switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from . import DOMAIN as SPIDER_DOMAIN
|
||||
|
||||
|
@ -21,7 +21,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devices, True)
|
||||
|
||||
|
||||
class SpiderPowerPlug(SwitchDevice):
|
||||
class SpiderPowerPlug(SwitchEntity):
|
||||
"""Representation of a Spider Power Plug."""
|
||||
|
||||
def __init__(self, api, power_plug):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Support for StarLine switch."""
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
from .account import StarlineAccount, StarlineDevice
|
||||
from .const import DOMAIN
|
||||
|
@ -30,7 +30,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class StarlineSwitch(StarlineEntity, SwitchDevice):
|
||||
class StarlineSwitch(StarlineEntity, SwitchEntity):
|
||||
"""Representation of a StarLine switch."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
from pprint import pformat
|
||||
|
||||
from homeassistant.components.supla import SuplaChannel
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -18,7 +18,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([SuplaSwitch(device) for device in discovery_info])
|
||||
|
||||
|
||||
class SuplaSwitch(SuplaChannel, SwitchDevice):
|
||||
class SuplaSwitch(SuplaChannel, SwitchEntity):
|
||||
"""Representation of a Supla Switch."""
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
|
|
|
@ -78,7 +78,7 @@ async def async_unload_entry(hass, entry):
|
|||
return await hass.data[DOMAIN].async_unload_entry(entry)
|
||||
|
||||
|
||||
class SwitchDevice(ToggleEntity):
|
||||
class SwitchEntity(ToggleEntity):
|
||||
"""Representation of a switch."""
|
||||
|
||||
@property
|
||||
|
@ -112,3 +112,15 @@ class SwitchDevice(ToggleEntity):
|
|||
def device_class(self):
|
||||
"""Return the class of this device, from component DEVICE_CLASSES."""
|
||||
return None
|
||||
|
||||
|
||||
class SwitchDevice(SwitchEntity):
|
||||
"""Representation of a switch (for backwards compatibility)."""
|
||||
|
||||
def __init_subclass__(cls, **kwargs):
|
||||
"""Print deprecation warning."""
|
||||
super().__init_subclass__(**kwargs)
|
||||
_LOGGER.warning(
|
||||
"SwitchDevice is deprecated, modify %s to extend SwitchEntity",
|
||||
cls.__name__,
|
||||
)
|
||||
|
|
|
@ -6,7 +6,7 @@ from typing import Any, Dict
|
|||
import switchbot
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_MAC, CONF_NAME, CONF_PASSWORD
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
|
@ -32,7 +32,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([SwitchBot(mac_addr, name, password)])
|
||||
|
||||
|
||||
class SwitchBot(SwitchDevice, RestoreEntity):
|
||||
class SwitchBot(SwitchEntity, RestoreEntity):
|
||||
"""Representation of a Switchbot."""
|
||||
|
||||
def __init__(self, mac, name, password) -> None:
|
||||
|
|
|
@ -12,7 +12,7 @@ from aioswitcher.consts import (
|
|||
WAITING_TEXT,
|
||||
)
|
||||
|
||||
from homeassistant.components.switch import ATTR_CURRENT_POWER_W, SwitchDevice
|
||||
from homeassistant.components.switch import ATTR_CURRENT_POWER_W, SwitchEntity
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
|
@ -53,7 +53,7 @@ async def async_setup_platform(
|
|||
async_add_entities([SwitcherControl(hass.data[DOMAIN][DATA_DEVICE])])
|
||||
|
||||
|
||||
class SwitcherControl(SwitchDevice):
|
||||
class SwitcherControl(SwitchEntity):
|
||||
"""Home Assistant switch entity."""
|
||||
|
||||
def __init__(self, device_data: "SwitcherV2Device") -> None:
|
||||
|
|
|
@ -6,7 +6,7 @@ import logging
|
|||
import switchmate
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_MAC, CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -34,7 +34,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None) -> None:
|
|||
add_entities([SwitchmateEntity(mac_addr, name, flip_on_off)], True)
|
||||
|
||||
|
||||
class SwitchmateEntity(SwitchDevice):
|
||||
class SwitchmateEntity(SwitchEntity):
|
||||
"""Representation of a Switchmate."""
|
||||
|
||||
def __init__(self, mac, name, flip_on_off) -> None:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for Tahoma switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.const import STATE_OFF, STATE_ON
|
||||
|
||||
from . import DOMAIN as TAHOMA_DOMAIN, TahomaDevice
|
||||
|
@ -22,7 +22,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devices, True)
|
||||
|
||||
|
||||
class TahomaSwitch(TahomaDevice, SwitchDevice):
|
||||
class TahomaSwitch(TahomaDevice, SwitchEntity):
|
||||
"""Representation a Tahoma Switch."""
|
||||
|
||||
def __init__(self, tahoma_device, controller):
|
||||
|
|
|
@ -8,7 +8,7 @@ import voluptuous as vol
|
|||
from homeassistant.components.switch import (
|
||||
ENTITY_ID_FORMAT,
|
||||
PLATFORM_SCHEMA,
|
||||
SwitchDevice,
|
||||
SwitchEntity,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_COMMAND_OFF,
|
||||
|
@ -81,7 +81,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(switches)
|
||||
|
||||
|
||||
class TelnetSwitch(SwitchDevice):
|
||||
class TelnetSwitch(SwitchEntity):
|
||||
"""Representation of a switch that can be toggled using telnet commands."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -6,7 +6,7 @@ import voluptuous as vol
|
|||
from homeassistant.components.switch import (
|
||||
ENTITY_ID_FORMAT,
|
||||
PLATFORM_SCHEMA,
|
||||
SwitchDevice,
|
||||
SwitchEntity,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
@ -96,7 +96,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(switches)
|
||||
|
||||
|
||||
class SwitchTemplate(SwitchDevice):
|
||||
class SwitchTemplate(SwitchEntity):
|
||||
"""Representation of a Template switch."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for Tesla charger switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.const import STATE_OFF, STATE_ON
|
||||
|
||||
from . import DOMAIN as TESLA_DOMAIN, TeslaDevice
|
||||
|
@ -24,7 +24,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(entities, True)
|
||||
|
||||
|
||||
class ChargerSwitch(TeslaDevice, SwitchDevice):
|
||||
class ChargerSwitch(TeslaDevice, SwitchEntity):
|
||||
"""Representation of a Tesla charger switch."""
|
||||
|
||||
def __init__(self, tesla_device, controller, config_entry):
|
||||
|
@ -54,7 +54,7 @@ class ChargerSwitch(TeslaDevice, SwitchDevice):
|
|||
self._state = STATE_ON if self.tesla_device.is_charging() else STATE_OFF
|
||||
|
||||
|
||||
class RangeSwitch(TeslaDevice, SwitchDevice):
|
||||
class RangeSwitch(TeslaDevice, SwitchEntity):
|
||||
"""Representation of a Tesla max range charging switch."""
|
||||
|
||||
def __init__(self, tesla_device, controller, config_entry):
|
||||
|
@ -84,7 +84,7 @@ class RangeSwitch(TeslaDevice, SwitchDevice):
|
|||
self._state = bool(self.tesla_device.is_maxrange())
|
||||
|
||||
|
||||
class UpdateSwitch(TeslaDevice, SwitchDevice):
|
||||
class UpdateSwitch(TeslaDevice, SwitchEntity):
|
||||
"""Representation of a Tesla update switch."""
|
||||
|
||||
def __init__(self, tesla_device, controller, config_entry):
|
||||
|
@ -118,7 +118,7 @@ class UpdateSwitch(TeslaDevice, SwitchDevice):
|
|||
self._state = bool(self.controller.get_updates(car_id))
|
||||
|
||||
|
||||
class SentryModeSwitch(TeslaDevice, SwitchDevice):
|
||||
class SentryModeSwitch(TeslaDevice, SwitchEntity):
|
||||
"""Representation of a Tesla sentry mode switch."""
|
||||
|
||||
async def async_turn_on(self, **kwargs):
|
||||
|
|
|
@ -7,7 +7,7 @@ from pyHS100 import SmartDeviceException, SmartPlug
|
|||
from homeassistant.components.switch import (
|
||||
ATTR_CURRENT_POWER_W,
|
||||
ATTR_TODAY_ENERGY_KWH,
|
||||
SwitchDevice,
|
||||
SwitchEntity,
|
||||
)
|
||||
from homeassistant.const import ATTR_VOLTAGE
|
||||
import homeassistant.helpers.device_registry as dr
|
||||
|
@ -43,7 +43,7 @@ async def async_setup_entry(hass: HomeAssistantType, config_entry, async_add_ent
|
|||
return True
|
||||
|
||||
|
||||
class SmartPlugSwitch(SwitchDevice):
|
||||
class SmartPlugSwitch(SwitchEntity):
|
||||
"""Representation of a TPLink Smart Plug switch."""
|
||||
|
||||
def __init__(self, smartplug: SmartPlug):
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue