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