Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename SwitchDevice to SwitchEntity #34673

Merged
merged 1 commit into from Apr 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions homeassistant/components/abode/switch.py
@@ -1,7 +1,7 @@
"""Support for Abode Security System switches."""
import abodepy.helpers.constants as CONST

from homeassistant.components.switch import SwitchDevice
from homeassistant.components.switch import SwitchEntity
from homeassistant.helpers.dispatcher import async_dispatcher_connect

from . import AbodeAutomation, AbodeDevice
Expand All @@ -28,7 +28,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities)


class AbodeSwitch(AbodeDevice, SwitchDevice):
class AbodeSwitch(AbodeDevice, SwitchEntity):
"""Representation of an Abode switch."""

def turn_on(self, **kwargs):
Expand All @@ -45,7 +45,7 @@ def is_on(self):
return self._device.is_on


class AbodeAutomationSwitch(AbodeAutomation, SwitchDevice):
class AbodeAutomationSwitch(AbodeAutomation, SwitchEntity):
"""A switch implementation for Abode automations."""

async def async_added_to_hass(self):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/acer_projector/switch.py
Expand Up @@ -5,7 +5,7 @@
import serial
import voluptuous as vol

from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import (
CONF_FILENAME,
CONF_NAME,
Expand Down Expand Up @@ -69,7 +69,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([AcerSwitch(serial_port, name, timeout, write_timeout)], True)


class AcerSwitch(SwitchDevice):
class AcerSwitch(SwitchEntity):
"""Represents an Acer Projector as a switch."""

def __init__(self, serial_port, name, timeout, write_timeout, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/adguard/switch.py
Expand Up @@ -10,7 +10,7 @@
DATA_ADGUARD_VERION,
DOMAIN,
)
from homeassistant.components.switch import SwitchDevice
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.typing import HomeAssistantType
Expand Down Expand Up @@ -45,7 +45,7 @@ async def async_setup_entry(
async_add_entities(switches, True)


class AdGuardHomeSwitch(AdGuardHomeDeviceEntity, SwitchDevice):
class AdGuardHomeSwitch(AdGuardHomeDeviceEntity, SwitchEntity):
"""Defines a AdGuard Home switch."""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/ads/switch.py
Expand Up @@ -3,7 +3,7 @@

import voluptuous as vol

from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import CONF_NAME
import homeassistant.helpers.config_validation as cv

Expand Down Expand Up @@ -31,7 +31,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([AdsSwitch(ads_hub, name, ads_var)])


class AdsSwitch(AdsEntity, SwitchDevice):
class AdsSwitch(AdsEntity, SwitchEntity):
"""Representation of an ADS switch device."""

async def async_added_to_hass(self):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/android_ip_webcam/switch.py
@@ -1,5 +1,5 @@
"""Support for Android IP Webcam settings."""
from homeassistant.components.switch import SwitchDevice
from homeassistant.components.switch import SwitchEntity

from . import (
CONF_HOST,
Expand Down Expand Up @@ -30,7 +30,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(all_switches, True)


class IPWebcamSettingsSwitch(AndroidIPCamEntity, SwitchDevice):
class IPWebcamSettingsSwitch(AndroidIPCamEntity, SwitchEntity):
"""An abstract class for an IP Webcam setting."""

def __init__(self, name, host, ipcam, setting):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/anel_pwrctrl/switch.py
Expand Up @@ -5,7 +5,7 @@
from anel_pwrctrl import DeviceMaster
import voluptuous as vol

from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle
Expand Down Expand Up @@ -58,7 +58,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices)


class PwrCtrlSwitch(SwitchDevice):
class PwrCtrlSwitch(SwitchEntity):
"""Representation of a PwrCtrl switch."""

def __init__(self, port, parent_device):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/aqualogic/switch.py
Expand Up @@ -4,7 +4,7 @@
from aqualogic.core import States
import voluptuous as vol

from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import CONF_MONITORED_CONDITIONS
import homeassistant.helpers.config_validation as cv

Expand Down Expand Up @@ -45,7 +45,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(switches)


class AquaLogicSwitch(SwitchDevice):
class AquaLogicSwitch(SwitchEntity):
"""Switch implementation for the AquaLogic component."""

def __init__(self, processor, switch_type):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/arduino/switch.py
Expand Up @@ -3,7 +3,7 @@

import voluptuous as vol

from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import CONF_NAME
import homeassistant.helpers.config_validation as cv

Expand Down Expand Up @@ -41,7 +41,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(switches)


class ArduinoSwitch(SwitchDevice):
class ArduinoSwitch(SwitchEntity):
"""Representation of an Arduino switch."""

def __init__(self, pin, options, board):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/arest/switch.py
Expand Up @@ -5,7 +5,7 @@
import requests
import voluptuous as vol

from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import CONF_NAME, CONF_RESOURCE, HTTP_OK
import homeassistant.helpers.config_validation as cv

Expand Down Expand Up @@ -80,7 +80,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(dev)


class ArestSwitchBase(SwitchDevice):
class ArestSwitchBase(SwitchEntity):
"""Representation of an aREST switch."""

def __init__(self, resource, location, name):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/aten_pe/switch.py
Expand Up @@ -8,7 +8,7 @@
from homeassistant.components.switch import (
DEVICE_CLASS_OUTLET,
PLATFORM_SCHEMA,
SwitchDevice,
SwitchEntity,
)
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_USERNAME
from homeassistant.exceptions import PlatformNotReady
Expand Down Expand Up @@ -64,7 +64,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(switches)


class AtenSwitch(SwitchDevice):
class AtenSwitch(SwitchEntity):
"""Represents an ATEN PE switch."""

def __init__(self, device, mac, outlet, name):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/axis/switch.py
Expand Up @@ -2,7 +2,7 @@

from axis.event_stream import CLASS_OUTPUT

from homeassistant.components.switch import SwitchDevice
from homeassistant.components.switch import SwitchEntity
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect

Expand All @@ -27,7 +27,7 @@ def async_add_switch(event_id):
)


class AxisSwitch(AxisEventBase, SwitchDevice):
class AxisSwitch(AxisEventBase, SwitchEntity):
"""Representation of a Axis switch."""

@property
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/broadlink/switch.py
Expand Up @@ -7,7 +7,7 @@
import broadlink as blk
import voluptuous as vol

from homeassistant.components.switch import DOMAIN, PLATFORM_SCHEMA, SwitchDevice
from homeassistant.components.switch import DOMAIN, PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import (
CONF_COMMAND_OFF,
CONF_COMMAND_ON,
Expand Down Expand Up @@ -146,7 +146,7 @@ def get_mp1_slot_name(switch_friendly_name, slot):
add_entities(switches)


class BroadlinkRMSwitch(SwitchDevice, RestoreEntity):
class BroadlinkRMSwitch(SwitchEntity, RestoreEntity):
"""Representation of an Broadlink switch."""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/command_line/switch.py
Expand Up @@ -7,7 +7,7 @@
from homeassistant.components.switch import (
ENTITY_ID_FORMAT,
PLATFORM_SCHEMA,
SwitchDevice,
SwitchEntity,
)
from homeassistant.const import (
CONF_COMMAND_OFF,
Expand Down Expand Up @@ -66,7 +66,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(switches)


class CommandSwitch(SwitchDevice):
class CommandSwitch(SwitchEntity):
"""Representation a switch that can be toggled using shell commands."""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/danfoss_air/switch.py
Expand Up @@ -3,7 +3,7 @@

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

Expand Down Expand Up @@ -43,7 +43,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(dev)


class DanfossAir(SwitchDevice):
class DanfossAir(SwitchEntity):
"""Representation of a Danfoss Air HRV Switch."""

def __init__(self, data, name, state_command, on_command, off_command):
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/deconz/switch.py
@@ -1,5 +1,5 @@
"""Support for deCONZ switches."""
from homeassistant.components.switch import SwitchDevice
from homeassistant.components.switch import SwitchEntity
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect

Expand Down Expand Up @@ -43,7 +43,7 @@ def async_add_switch(lights):
async_add_switch(gateway.api.lights.values())


class DeconzPowerPlug(DeconzDevice, SwitchDevice):
class DeconzPowerPlug(DeconzDevice, SwitchEntity):
"""Representation of a deCONZ power plug."""

@property
Expand All @@ -62,7 +62,7 @@ async def async_turn_off(self, **kwargs):
await self._device.async_set_state(data)


class DeconzSiren(DeconzDevice, SwitchDevice):
class DeconzSiren(DeconzDevice, SwitchEntity):
"""Representation of a deCONZ siren."""

@property
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/demo/switch.py
@@ -1,5 +1,5 @@
"""Demo platform that has two fake switches."""
from homeassistant.components.switch import SwitchDevice
from homeassistant.components.switch import SwitchEntity
from homeassistant.const import DEVICE_DEFAULT_NAME

from . import DOMAIN
Expand Down Expand Up @@ -27,7 +27,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
await async_setup_platform(hass, {}, async_add_entities)


class DemoSwitch(SwitchDevice):
class DemoSwitch(SwitchEntity):
"""Representation of a demo switch."""

def __init__(self, unique_id, name, state, icon, assumed, device_class=None):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/digital_ocean/switch.py
Expand Up @@ -3,7 +3,7 @@

import voluptuous as vol

from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import ATTR_ATTRIBUTION
import homeassistant.helpers.config_validation as cv

Expand Down Expand Up @@ -50,7 +50,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(dev, True)


class DigitalOceanSwitch(SwitchDevice):
class DigitalOceanSwitch(SwitchEntity):
"""Representation of a Digital Ocean droplet switch."""

def __init__(self, do, droplet_id):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/digitalloggers/switch.py
Expand Up @@ -5,7 +5,7 @@
import dlipower
import voluptuous as vol

from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import (
CONF_HOST,
CONF_NAME,
Expand Down Expand Up @@ -72,7 +72,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(outlets)


class DINRelay(SwitchDevice):
class DINRelay(SwitchEntity):
"""Representation of an individual DIN III relay port."""

def __init__(self, controller_name, parent_device, outlet):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/dlink/switch.py
Expand Up @@ -6,7 +6,7 @@
from pyW215.pyW215 import SmartPlug
import voluptuous as vol

from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import (
ATTR_TEMPERATURE,
CONF_HOST,
Expand Down Expand Up @@ -56,7 +56,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([SmartPlugSwitch(hass, data, name)], True)


class SmartPlugSwitch(SwitchDevice):
class SmartPlugSwitch(SwitchEntity):
"""Representation of a D-Link Smart Plug switch."""

def __init__(self, hass, data, name):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/doorbird/switch.py
Expand Up @@ -2,7 +2,7 @@
import datetime
import logging

from homeassistant.components.switch import SwitchDevice
from homeassistant.components.switch import SwitchEntity
import homeassistant.util.dt as dt_util

from .const import DOMAIN, DOOR_STATION, DOOR_STATION_INFO
Expand Down Expand Up @@ -31,7 +31,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities)


class DoorBirdSwitch(DoorBirdEntity, SwitchDevice):
class DoorBirdSwitch(DoorBirdEntity, SwitchEntity):
"""A relay in a DoorBird device."""

def __init__(self, doorstation, doorstation_info, relay):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/dynalite/switch.py
@@ -1,7 +1,7 @@
"""Support for the Dynalite channels and presets as switches."""
from typing import Callable

from homeassistant.components.switch import SwitchDevice
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant

Expand All @@ -18,7 +18,7 @@ async def async_setup_entry(
)


class DynaliteSwitch(DynaliteBase, SwitchDevice):
class DynaliteSwitch(DynaliteBase, SwitchEntity):
"""Representation of a Dynalite Channel as a Home Assistant Switch."""

@property
Expand Down