Rename Light to LightEntity (#34593)

This commit is contained in:
Erik Montnemery 2020-04-26 18:49:41 +02:00 committed by GitHub
parent 8402363568
commit e4333a7a44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
93 changed files with 248 additions and 191 deletions

View File

@ -10,7 +10,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
Light,
LightEntity,
)
from homeassistant.util.color import (
color_temperature_kelvin_to_mired,
@ -33,7 +33,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities)
class AbodeLight(AbodeDevice, Light):
class AbodeLight(AbodeDevice, LightEntity):
"""Representation of an Abode light."""
def turn_on(self, **kwargs):

View File

@ -7,7 +7,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
Light,
LightEntity,
)
from homeassistant.const import CONF_NAME
import homeassistant.helpers.config_validation as cv
@ -43,7 +43,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([AdsLight(ads_hub, ads_var_enable, ads_var_brightness, name)])
class AdsLight(AdsEntity, Light):
class AdsLight(AdsEntity, LightEntity):
"""Representation of ADS light."""
def __init__(self, ads_hub, ads_var_enable, ads_var_brightness, name):

View File

@ -8,7 +8,7 @@ from homeassistant.components.light import (
ATTR_HS_COLOR,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
Light,
LightEntity,
)
from homeassistant.exceptions import PlatformNotReady
import homeassistant.util.color as color_util
@ -31,7 +31,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(AveaLight(bulb) for bulb in nearby_bulbs)
class AveaLight(Light):
class AveaLight(LightEntity):
"""Representation of an Avea."""
def __init__(self, light):

View File

@ -9,7 +9,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
Light,
LightEntity,
)
from homeassistant.const import (
CONF_API_KEY,
@ -66,7 +66,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(lights)
class AvionLight(Light):
class AvionLight(LightEntity):
"""Representation of an Avion light."""
def __init__(self, device):

View File

@ -10,7 +10,7 @@ from homeassistant.components.light import (
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
Light,
LightEntity,
)
from homeassistant.const import CONF_NAME
import homeassistant.helpers.config_validation as cv
@ -43,7 +43,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([BlinkStickLight(stick, name)], True)
class BlinkStickLight(Light):
class BlinkStickLight(LightEntity):
"""Representation of a BlinkStick light."""
def __init__(self, stick, name):

View File

@ -10,7 +10,7 @@ from homeassistant.components.light import (
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
Light,
LightEntity,
)
from homeassistant.const import CONF_NAME
import homeassistant.helpers.config_validation as cv
@ -42,7 +42,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
)
class BlinktLight(Light):
class BlinktLight(LightEntity):
"""Representation of a Blinkt! Light."""
def __init__(self, blinkt, name, index):

View File

@ -15,7 +15,7 @@ from homeassistant.components.light import (
SUPPORT_EFFECT,
SUPPORT_FLASH,
SUPPORT_TRANSITION,
Light,
LightEntity,
)
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -82,7 +82,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_group(gateway.api.groups.values())
class DeconzLight(DeconzDevice, Light):
class DeconzLight(DeconzDevice, LightEntity):
"""Representation of a deCONZ light."""
def __init__(self, device, gateway):

View File

@ -12,7 +12,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
Light,
LightEntity,
)
from homeassistant.const import CONF_API_KEY, CONF_DEVICES, CONF_NAME
import homeassistant.helpers.config_validation as cv
@ -84,7 +84,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(lights)
class DecoraLight(Light):
class DecoraLight(LightEntity):
"""Representation of an Decora light."""
def __init__(self, device):

View File

@ -15,7 +15,7 @@ from homeassistant.components.light import (
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_TRANSITION,
Light,
LightEntity,
)
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, EVENT_HOMEASSISTANT_STOP
import homeassistant.helpers.config_validation as cv
@ -80,7 +80,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
hass.bus.listen(EVENT_HOMEASSISTANT_STOP, logout)
class DecoraWifiLight(Light):
class DecoraWifiLight(LightEntity):
"""Representation of a Decora WiFi switch."""
def __init__(self, switch):

View File

@ -12,7 +12,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR_TEMP,
SUPPORT_EFFECT,
SUPPORT_WHITE_VALUE,
Light,
LightEntity,
)
from . import DOMAIN
@ -57,7 +57,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
await async_setup_platform(hass, {}, async_add_entities)
class DemoLight(Light):
class DemoLight(LightEntity):
"""Representation of a demo light."""
def __init__(

View File

@ -1,7 +1,7 @@
"""Support for Dynalite channels as lights."""
from typing import Callable
from homeassistant.components.light import SUPPORT_BRIGHTNESS, Light
from homeassistant.components.light import SUPPORT_BRIGHTNESS, LightEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
@ -18,7 +18,7 @@ async def async_setup_entry(
)
class DynaliteLight(DynaliteBase, Light):
class DynaliteLight(DynaliteBase, LightEntity):
"""Representation of a Dynalite Channel as a Home Assistant Light."""
@property

View File

@ -10,7 +10,7 @@ from homeassistant.components.light import (
ATTR_COLOR_TEMP,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR_TEMP,
Light,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_NAME
@ -45,7 +45,7 @@ async def async_setup_entry(
async_add_entities([ElgatoLight(entry.entry_id, elgato, info)], True)
class ElgatoLight(Light):
class ElgatoLight(LightEntity):
"""Defines a Elgato Key Light."""
def __init__(

View File

@ -1,6 +1,10 @@
"""Support for control of ElkM1 lighting (X10, UPB, etc)."""
from homeassistant.components.light import ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
LightEntity,
)
from . import ElkEntity, create_elk_entities
from .const import DOMAIN
@ -15,7 +19,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities, True)
class ElkLight(ElkEntity, Light):
class ElkLight(ElkEntity, LightEntity):
"""Representation of an Elk lighting device."""
def __init__(self, element, elk, elk_data):

View File

@ -9,7 +9,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
Light,
LightEntity,
)
from homeassistant.const import CONF_ID, CONF_NAME
import homeassistant.helpers.config_validation as cv
@ -39,7 +39,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([EnOceanLight(sender_id, dev_id, dev_name)])
class EnOceanLight(enocean.EnOceanDevice, Light):
class EnOceanLight(enocean.EnOceanDevice, LightEntity):
"""Representation of an EnOcean light source."""
def __init__(self, sender_id, dev_id, dev_name):

View File

@ -21,7 +21,7 @@ from homeassistant.components.light import (
SUPPORT_FLASH,
SUPPORT_TRANSITION,
SUPPORT_WHITE_VALUE,
Light,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
@ -50,7 +50,7 @@ async def async_setup_entry(
)
class EsphomeLight(EsphomeEntity, Light):
class EsphomeLight(EsphomeEntity, LightEntity):
"""A switch implementation for ESPHome."""
@property

View File

@ -10,7 +10,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
Light,
LightEntity,
)
import homeassistant.util.color as color_util
from homeassistant.util.color import (
@ -31,7 +31,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([EufyLight(discovery_info)], True)
class EufyLight(Light):
class EufyLight(LightEntity):
"""Representation of a Eufy light."""
def __init__(self, device):

View File

@ -14,7 +14,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_EFFECT,
Light,
LightEntity,
)
from homeassistant.const import CONF_HOSTS
from homeassistant.exceptions import PlatformNotReady
@ -65,7 +65,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(lights)
class EverLightsLight(Light):
class EverLightsLight(LightEntity):
"""Representation of a Flux light."""
def __init__(self, api, channel, status, effects):

View File

@ -11,7 +11,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_WHITE_VALUE,
Light,
LightEntity,
)
from homeassistant.const import CONF_WHITE_VALUE
import homeassistant.util.color as color_util
@ -48,7 +48,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
)
class FibaroLight(FibaroDevice, Light):
class FibaroLight(FibaroDevice, LightEntity):
"""Representation of a Fibaro Light, including dimmable."""
def __init__(self, fibaro_device):

View File

@ -19,7 +19,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR_TEMP,
SUPPORT_EFFECT,
SUPPORT_WHITE_VALUE,
Light,
LightEntity,
)
from homeassistant.const import ATTR_MODE, CONF_DEVICES, CONF_NAME, CONF_PROTOCOL
import homeassistant.helpers.config_validation as cv
@ -176,7 +176,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(lights, True)
class FluxLight(Light):
class FluxLight(LightEntity):
"""Representation of a Flux light."""
def __init__(self, device):

View File

@ -9,7 +9,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
Light,
LightEntity,
)
from homeassistant.const import CONF_DEVICES, CONF_HOST, CONF_NAME, CONF_PORT
import homeassistant.helpers.config_validation as cv
@ -64,7 +64,7 @@ def to_hass_level(level):
return int((level * 255) / 100)
class FutureNowLight(Light):
class FutureNowLight(LightEntity):
"""Representation of an FutureNow light."""
def __init__(self, device):

View File

@ -10,7 +10,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
Light,
LightEntity,
)
from homeassistant.const import CONF_HOST
import homeassistant.helpers.config_validation as cv
@ -54,7 +54,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
)
class GreenwaveLight(Light):
class GreenwaveLight(LightEntity):
"""Representation of an Greenwave Reality Light."""
def __init__(self, light, host, token, gatewaydata):

View File

@ -76,7 +76,7 @@ async def async_setup_platform(
)
class LightGroup(light.Light):
class LightGroup(light.LightEntity):
"""Representation of a light group."""
def __init__(self, name: str, entity_ids: List[str]) -> None:

View File

@ -6,7 +6,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
Light,
LightEntity,
)
import homeassistant.util.color as color_util
@ -25,7 +25,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devs)
class HiveDeviceLight(HiveEntity, Light):
class HiveDeviceLight(HiveEntity, LightEntity):
"""Hive Active Light Device."""
def __init__(self, hive_session, hive_device):

View File

@ -10,7 +10,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
Light,
LightEntity,
)
from homeassistant.core import callback
@ -35,7 +35,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
conn.add_listener(async_add_service)
class HomeKitLight(HomeKitEntity, Light):
class HomeKitLight(HomeKitEntity, LightEntity):
"""Representation of a Homekit light."""
def get_characteristic_types(self):

View File

@ -11,7 +11,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
SUPPORT_EFFECT,
Light,
LightEntity,
)
from .const import ATTR_DISCOVER_DEVICES
@ -35,7 +35,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices, True)
class HMLight(HMDevice, Light):
class HMLight(HMDevice, LightEntity):
"""Representation of a Homematic light."""
@property

View File

@ -21,7 +21,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_TRANSITION,
Light,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
@ -64,7 +64,7 @@ async def async_setup_entry(
async_add_entities(entities)
class HomematicipLight(HomematicipGenericDevice, Light):
class HomematicipLight(HomematicipGenericDevice, LightEntity):
"""Representation of a HomematicIP Cloud light device."""
def __init__(self, hap: HomematicipHAP, device) -> None:
@ -110,7 +110,7 @@ class HomematicipLightMeasuring(HomematicipLight):
return state_attr
class HomematicipDimmer(HomematicipGenericDevice, Light):
class HomematicipDimmer(HomematicipGenericDevice, LightEntity):
"""Representation of HomematicIP Cloud dimmer light device."""
def __init__(self, hap: HomematicipHAP, device) -> None:
@ -144,7 +144,7 @@ class HomematicipDimmer(HomematicipGenericDevice, Light):
await self._device.set_dim_level(0)
class HomematicipNotificationLight(HomematicipGenericDevice, Light):
class HomematicipNotificationLight(HomematicipGenericDevice, LightEntity):
"""Representation of HomematicIP Cloud dimmer light device."""
def __init__(self, hap: HomematicipHAP, device, channel: int) -> None:

View File

@ -3,7 +3,11 @@ import logging
from pyhomeworks.pyhomeworks import HW_LIGHT_CHANGED
from homeassistant.components.light import ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
LightEntity,
)
from homeassistant.const import CONF_NAME
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -28,7 +32,7 @@ def setup_platform(hass, config, add_entities, discover_info=None):
add_entities(devs, True)
class HomeworksLight(HomeworksDevice, Light):
class HomeworksLight(HomeworksDevice, LightEntity):
"""Homeworks Light."""
def __init__(self, controller, addr, name, rate):

View File

@ -24,7 +24,7 @@ from homeassistant.components.light import (
SUPPORT_EFFECT,
SUPPORT_FLASH,
SUPPORT_TRANSITION,
Light,
LightEntity,
)
from homeassistant.core import callback
from homeassistant.exceptions import PlatformNotReady
@ -194,7 +194,7 @@ def hass_to_hue_brightness(value):
return max(1, round((value / 255) * 254))
class HueLight(Light):
class HueLight(LightEntity):
"""Representation of a Hue light."""
def __init__(self, coordinator, bridge, is_group, light, supported_features):

View File

@ -13,7 +13,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_EFFECT,
Light,
LightEntity,
)
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT
import homeassistant.helpers.config_validation as cv
@ -103,7 +103,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([device])
class Hyperion(Light):
class Hyperion(LightEntity):
"""Representation of a Hyperion remote."""
def __init__(

View File

@ -9,7 +9,7 @@ from homeassistant.components.light import (
DOMAIN,
SUPPORT_BRIGHTNESS,
SUPPORT_EFFECT,
Light,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
@ -32,7 +32,7 @@ async def async_setup_entry(
async_add_entities(devs, True)
class HassAqualinkLight(AqualinkEntity, Light):
class HassAqualinkLight(AqualinkEntity, LightEntity):
"""Representation of a light."""
@property

View File

@ -15,7 +15,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
SUPPORT_EFFECT,
Light,
LightEntity,
)
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT
import homeassistant.helpers.config_validation as cv
@ -43,7 +43,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([IGloLamp(name, host, port)], True)
class IGloLamp(Light):
class IGloLamp(LightEntity):
"""Representation of an iGlo light."""
def __init__(self, name, host, port):

View File

@ -1,7 +1,11 @@
"""Support for IHC lights."""
import logging
from homeassistant.components.light import ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
LightEntity,
)
from . import IHC_CONTROLLER, IHC_INFO
from .const import CONF_DIMMABLE, CONF_OFF_ID, CONF_ON_ID
@ -35,7 +39,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices)
class IhcLight(IHCDevice, Light):
class IhcLight(IHCDevice, LightEntity):
"""Representation of a IHC light.
For dimmable lights, the associated IHC resource should be a light

View File

@ -1,7 +1,11 @@
"""Support for Insteon lights via PowerLinc Modem."""
import logging
from homeassistant.components.light import ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
LightEntity,
)
from .insteon_entity import InsteonEntity
@ -29,7 +33,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([new_entity])
class InsteonDimmerDevice(InsteonEntity, Light):
class InsteonDimmerDevice(InsteonEntity, LightEntity):
"""A Class for an Insteon device."""
@property

View File

@ -2,7 +2,7 @@
import logging
from typing import Callable
from homeassistant.components.light import DOMAIN, SUPPORT_BRIGHTNESS, Light
from homeassistant.components.light import DOMAIN, SUPPORT_BRIGHTNESS, LightEntity
from homeassistant.helpers.typing import ConfigType
from . import ISY994_NODES, ISYDevice
@ -21,7 +21,7 @@ def setup_platform(
add_entities(devices)
class ISYLightDevice(ISYDevice, Light):
class ISYLightDevice(ISYDevice, LightEntity):
"""Representation of an ISY994 light device."""
def __init__(self, node) -> None:

View File

@ -14,7 +14,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
SUPPORT_WHITE_VALUE,
Light,
LightEntity,
)
from homeassistant.const import CONF_ADDRESS, CONF_NAME
from homeassistant.core import callback
@ -132,7 +132,7 @@ def async_add_entities_config(hass, config, async_add_entities):
async_add_entities([KNXLight(light)])
class KNXLight(Light):
class KNXLight(LightEntity):
"""Representation of a KNX light."""
def __init__(self, device):

View File

@ -6,7 +6,7 @@ from homeassistant.components.light import (
ATTR_TRANSITION,
SUPPORT_BRIGHTNESS,
SUPPORT_TRANSITION,
Light,
LightEntity,
)
from homeassistant.const import CONF_ADDRESS
@ -47,7 +47,7 @@ async def async_setup_platform(
async_add_entities(devices)
class LcnOutputLight(LcnDevice, Light):
class LcnOutputLight(LcnDevice, LightEntity):
"""Representation of a LCN light for output ports."""
def __init__(self, config, address_connection):
@ -135,7 +135,7 @@ class LcnOutputLight(LcnDevice, Light):
self.async_write_ha_state()
class LcnRelayLight(LcnDevice, Light):
class LcnRelayLight(LcnDevice, LightEntity):
"""Representation of a LCN light for relay ports."""
def __init__(self, config, address_connection):

View File

@ -32,7 +32,7 @@ from homeassistant.components.light import (
SUPPORT_TRANSITION,
VALID_BRIGHTNESS,
VALID_BRIGHTNESS_PCT,
Light,
LightEntity,
preprocess_turn_on_alternatives,
)
from homeassistant.const import ATTR_ENTITY_ID, ATTR_MODE, EVENT_HOMEASSISTANT_STOP
@ -438,7 +438,7 @@ def convert_16_to_8(value):
return value >> 8
class LIFXLight(Light):
class LIFXLight(LightEntity):
"""Representation of a LIFX light."""
def __init__(self, bulb, effects_conductor):

View File

@ -19,7 +19,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
SUPPORT_TRANSITION,
Light,
LightEntity,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import track_time_change
@ -137,7 +137,7 @@ class LIFX:
self._liffylights.probe(address)
class LIFXLight(Light):
class LIFXLight(LightEntity):
"""Representation of a LIFX light."""
def __init__(self, liffy, ipaddr, name, power, hue, saturation, brightness, kelvin):

View File

@ -332,7 +332,7 @@ class Profiles:
return None
class Light(ToggleEntity):
class LightEntity(ToggleEntity):
"""Representation of a light."""
@property
@ -428,3 +428,14 @@ class Light(ToggleEntity):
def supported_features(self):
"""Flag supported features."""
return 0
class Light(LightEntity):
"""Representation of a light (for backwards compatibility)."""
def __init_subclass__(cls, **kwargs):
"""Print deprecation warning."""
super().__init_subclass__(**kwargs)
_LOGGER.warning(
"Light is deprecated, modify %s to extend LightEntity", cls.__name__,
)

View File

@ -1,5 +1,9 @@
"""Support for LightwaveRF lights."""
from homeassistant.components.light import ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
LightEntity,
)
from homeassistant.const import CONF_NAME
from . import LIGHTWAVE_LINK
@ -22,7 +26,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(lights)
class LWRFLight(Light):
class LWRFLight(LightEntity):
"""Representation of a LightWaveRF light."""
def __init__(self, name, device_id, lwlink):

View File

@ -28,7 +28,7 @@ from homeassistant.components.light import (
SUPPORT_EFFECT,
SUPPORT_FLASH,
SUPPORT_TRANSITION,
Light,
LightEntity,
)
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, CONF_TYPE, STATE_ON
import homeassistant.helpers.config_validation as cv
@ -200,7 +200,7 @@ def state(new_state):
return decorator
class LimitlessLEDGroup(Light, RestoreEntity):
class LimitlessLEDGroup(LightEntity, RestoreEntity):
"""Representation of a LimitessLED group."""
def __init__(self, group, config):

View File

@ -2,7 +2,11 @@
import logging
from homeassistant.components import litejet
from homeassistant.components.light import ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
LightEntity,
)
_LOGGER = logging.getLogger(__name__)
@ -21,7 +25,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices, True)
class LiteJetLight(Light):
class LiteJetLight(LightEntity):
"""Representation of a single LiteJet light."""
def __init__(self, hass, lj, i, name):

View File

@ -1,7 +1,11 @@
"""Support for Lutron lights."""
import logging
from homeassistant.components.light import ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
LightEntity,
)
from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice
@ -28,7 +32,7 @@ def to_hass_level(level):
return int((level * 255) / 100)
class LutronLight(LutronDevice, Light):
class LutronLight(LutronDevice, LightEntity):
"""Representation of a Lutron Light, including dimmable."""
def __init__(self, area_name, lutron_device, controller):

View File

@ -5,7 +5,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
DOMAIN,
SUPPORT_BRIGHTNESS,
Light,
LightEntity,
)
from . import LUTRON_CASETA_SMARTBRIDGE, LutronCasetaDevice
@ -35,7 +35,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(entities, True)
class LutronCasetaLight(LutronCasetaDevice, Light):
class LutronCasetaLight(LutronCasetaDevice, LightEntity):
"""Representation of a Lutron Light, including dimmable."""
@property

View File

@ -15,7 +15,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR,
SUPPORT_EFFECT,
SUPPORT_TRANSITION,
Light,
LightEntity,
)
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT
import homeassistant.helpers.config_validation as cv
@ -47,7 +47,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([LW12WiFi(name, lw12_light)])
class LW12WiFi(Light):
class LW12WiFi(LightEntity):
"""LW-12 WiFi LED Controller."""
def __init__(self, name, lw12_light):

View File

@ -8,7 +8,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
Light,
LightEntity,
)
from homeassistant.const import CONF_ADDRESS, CONF_DEVICES, CONF_NAME, CONF_PLATFORM
from homeassistant.helpers import config_validation as cv
@ -44,7 +44,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
return True
class MochadLight(Light):
class MochadLight(LightEntity):
"""Representation of a X10 dimmer over Mochad."""
def __init__(self, hass, ctrl, dev):

View File

@ -15,7 +15,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR_TEMP,
SUPPORT_EFFECT,
SUPPORT_WHITE_VALUE,
Light,
LightEntity,
)
from homeassistant.components.mqtt import (
CONF_COMMAND_TOPIC,
@ -86,7 +86,7 @@ CONF_WHITE_VALUE_TEMPLATE = "white_value_template"
CONF_ON_COMMAND_TYPE = "on_command_type"
DEFAULT_BRIGHTNESS_SCALE = 255
DEFAULT_NAME = "MQTT Light"
DEFAULT_NAME = "MQTT LightEntity"
DEFAULT_OPTIMISTIC = False
DEFAULT_PAYLOAD_OFF = "OFF"
DEFAULT_PAYLOAD_ON = "ON"
@ -160,7 +160,7 @@ class MqttLight(
MqttAvailability,
MqttDiscoveryUpdate,
MqttEntityDeviceInfo,
Light,
LightEntity,
RestoreEntity,
):
"""Representation of a MQTT light."""

View File

@ -22,7 +22,7 @@ from homeassistant.components.light import (
SUPPORT_FLASH,
SUPPORT_TRANSITION,
SUPPORT_WHITE_VALUE,
Light,
LightEntity,
)
from homeassistant.components.mqtt import (
CONF_COMMAND_TOPIC,
@ -131,7 +131,7 @@ class MqttLightJson(
MqttAvailability,
MqttDiscoveryUpdate,
MqttEntityDeviceInfo,
Light,
LightEntity,
RestoreEntity,
):
"""Representation of a MQTT JSON light."""

View File

@ -19,7 +19,7 @@ from homeassistant.components.light import (
SUPPORT_FLASH,
SUPPORT_TRANSITION,
SUPPORT_WHITE_VALUE,
Light,
LightEntity,
)
from homeassistant.components.mqtt import (
CONF_COMMAND_TOPIC,
@ -105,7 +105,7 @@ class MqttTemplate(
MqttAvailability,
MqttDiscoveryUpdate,
MqttEntityDeviceInfo,
Light,
LightEntity,
RestoreEntity,
):
"""Representation of a MQTT Template light."""

View File

@ -8,7 +8,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_WHITE_VALUE,
Light,
LightEntity,
)
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.core import callback
@ -34,7 +34,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
)
class MySensorsLight(mysensors.device.MySensorsEntity, Light):
class MySensorsLight(mysensors.device.MySensorsEntity, LightEntity):
"""Representation of a MySensors Light child node."""
def __init__(self, *args):

View File

@ -14,7 +14,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR,
SUPPORT_EFFECT,
SUPPORT_FLASH,
Light,
LightEntity,
)
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME
from homeassistant.exceptions import PlatformNotReady
@ -59,7 +59,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([MyStromLight(bulb, name, mac)], True)
class MyStromLight(Light):
class MyStromLight(LightEntity):
"""Representation of the myStrom WiFi bulb."""
def __init__(self, bulb, name, mac):

View File

@ -16,7 +16,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR_TEMP,
SUPPORT_EFFECT,
SUPPORT_TRANSITION,
Light,
LightEntity,
)
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_TOKEN
import homeassistant.helpers.config_validation as cv
@ -103,7 +103,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([NanoleafLight(nanoleaf_light, name)], True)
class NanoleafLight(Light):
class NanoleafLight(LightEntity):
"""Representation of a Nanoleaf Light."""
def __init__(self, light, name):

View File

@ -6,7 +6,7 @@ import nikohomecontrol
import voluptuous as vol
# Import the device class from the component that you want to support
from homeassistant.components.light import ATTR_BRIGHTNESS, PLATFORM_SCHEMA, Light
from homeassistant.components.light import ATTR_BRIGHTNESS, PLATFORM_SCHEMA, LightEntity
from homeassistant.const import CONF_HOST
from homeassistant.exceptions import PlatformNotReady
import homeassistant.helpers.config_validation as cv
@ -38,7 +38,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
)
class NikoHomeControlLight(Light):
class NikoHomeControlLight(LightEntity):
"""Representation of an Niko Light."""
def __init__(self, light, data):

View File

@ -10,7 +10,7 @@ from homeassistant.components.light import (
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR_TEMP,
Light,
LightEntity,
)
from homeassistant.const import CONF_HOST, CONF_NAME
import homeassistant.helpers.config_validation as cv
@ -42,7 +42,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
_LOGGER.debug("Init light %s %s", host, entity.unique_id)
class OppleLight(Light):
class OppleLight(LightEntity):
"""Opple light device."""
def __init__(self, name, host):

View File

@ -18,7 +18,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR_TEMP,
SUPPORT_EFFECT,
SUPPORT_TRANSITION,
Light,
LightEntity,
)
from homeassistant.const import CONF_HOST
import homeassistant.helpers.config_validation as cv
@ -168,7 +168,7 @@ def setup_bridge(bridge, add_entities, config):
update_groups()
class Luminary(Light):
class Luminary(LightEntity):
"""Representation of Luminary Lights and Groups."""
def __init__(self, luminary, update_func, changed):

View File

@ -11,7 +11,7 @@ from homeassistant.components.light import (
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
Light,
LightEntity,
)
from homeassistant.const import CONF_NAME
import homeassistant.helpers.config_validation as cv
@ -39,7 +39,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([PiglowLight(name)])
class PiglowLight(Light):
class PiglowLight(LightEntity):
"""Representation of an Piglow Light."""
def __init__(self, name):

View File

@ -7,7 +7,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
Light,
LightEntity,
)
from homeassistant.const import CONF_LIGHTS
import homeassistant.helpers.config_validation as cv
@ -40,7 +40,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices)
class PilightLight(PilightBaseDevice, Light):
class PilightLight(PilightBaseDevice, LightEntity):
"""Representation of a Pilight switch."""
def __init__(self, hass, name, config):

View File

@ -4,7 +4,7 @@ from homeassistant.components.light import (
ATTR_HS_COLOR,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
Light,
LightEntity,
)
import homeassistant.util.color as color_util
@ -32,7 +32,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(entities)
class PlumLight(Light):
class PlumLight(LightEntity):
"""Representation of a Plum Lightpad dimmer."""
def __init__(self, load):
@ -88,7 +88,7 @@ class PlumLight(Light):
await self._load.turn_off()
class GlowRing(Light):
class GlowRing(LightEntity):
"""Representation of a Plum Lightpad dimmer glow ring."""
def __init__(self, lightpad):

View File

@ -1,5 +1,5 @@
"""Support for Qwikswitch Relays and Dimmers."""
from homeassistant.components.light import SUPPORT_BRIGHTNESS, Light
from homeassistant.components.light import SUPPORT_BRIGHTNESS, LightEntity
from . import DOMAIN as QWIKSWITCH, QSToggleEntity
@ -14,7 +14,7 @@ async def async_setup_platform(hass, _, add_entities, discovery_info=None):
add_entities(devs)
class QSLight(QSToggleEntity, Light):
class QSLight(QSToggleEntity, LightEntity):
"""Light based on a Qwikswitch relay/dimmer module."""
@property

View File

@ -7,7 +7,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
Light,
LightEntity,
)
from homeassistant.const import CONF_NAME, CONF_TYPE
import homeassistant.helpers.config_validation as cv
@ -159,11 +159,11 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
hass.data[DATA_DEVICE_REGISTER][EVENT_KEY_COMMAND] = add_new_device
class RflinkLight(SwitchableRflinkDevice, Light):
class RflinkLight(SwitchableRflinkDevice, LightEntity):
"""Representation of a Rflink light."""
class DimmableRflinkLight(SwitchableRflinkDevice, Light):
class DimmableRflinkLight(SwitchableRflinkDevice, LightEntity):
"""Rflink light device that support dimming."""
_brightness = 255
@ -208,7 +208,7 @@ class DimmableRflinkLight(SwitchableRflinkDevice, Light):
return SUPPORT_BRIGHTNESS
class HybridRflinkLight(SwitchableRflinkDevice, Light):
class HybridRflinkLight(SwitchableRflinkDevice, LightEntity):
"""Rflink light device that sends out both dim and on/off commands.
Used for protocols which support lights that are not exclusively on/off
@ -271,7 +271,7 @@ class HybridRflinkLight(SwitchableRflinkDevice, Light):
return SUPPORT_BRIGHTNESS
class ToggleRflinkLight(SwitchableRflinkDevice, Light):
class ToggleRflinkLight(SwitchableRflinkDevice, LightEntity):
"""Rflink light device which sends out only 'on' commands.
Some switches like for example Livolo light switches use the

View File

@ -8,7 +8,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
Light,
LightEntity,
)
from homeassistant.const import CONF_NAME, STATE_ON
from homeassistant.helpers import config_validation as cv
@ -73,7 +73,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
RECEIVED_EVT_SUBSCRIBERS.append(light_update)
class RfxtrxLight(RfxtrxDevice, Light, RestoreEntity):
class RfxtrxLight(RfxtrxDevice, LightEntity, RestoreEntity):
"""Representation of a RFXtrx light."""
async def async_added_to_hass(self):

View File

@ -4,7 +4,7 @@ import logging
import requests
from homeassistant.components.light import Light
from homeassistant.components.light import LightEntity
from homeassistant.core import callback
import homeassistant.util.dt as dt_util
@ -38,7 +38,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(lights)
class RingLight(RingEntityMixin, Light):
class RingLight(RingEntityMixin, LightEntity):
"""Creates a switch to turn the ring cameras light on and off."""
def __init__(self, config_entry_id, device):

View File

@ -4,7 +4,7 @@ import logging
from scsgate.tasks import ToggleStatusTask
import voluptuous as vol
from homeassistant.components.light import PLATFORM_SCHEMA, Light
from homeassistant.components.light import PLATFORM_SCHEMA, LightEntity
from homeassistant.const import ATTR_ENTITY_ID, ATTR_STATE, CONF_DEVICES, CONF_NAME
import homeassistant.helpers.config_validation as cv
@ -43,7 +43,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
scsgate.add_devices_to_register(lights)
class SCSGateLight(Light):
class SCSGateLight(LightEntity):
"""Representation of a SCSGate light."""
def __init__(self, scs_id, name, logger, scsgate):

View File

@ -10,7 +10,7 @@ from homeassistant.components.light import (
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
Light,
LightEntity,
)
from homeassistant.const import CONF_NAME
import homeassistant.helpers.config_validation as cv
@ -37,7 +37,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([SenseHatLight(sensehat, name)])
class SenseHatLight(Light):
class SenseHatLight(LightEntity):
"""Representation of an Sense Hat Light."""
def __init__(self, sensehat, name):

View File

@ -3,7 +3,7 @@ import logging
import aiohttp
from homeassistant.components.light import SUPPORT_BRIGHTNESS, Light
from homeassistant.components.light import SUPPORT_BRIGHTNESS, LightEntity
from homeassistant.const import CONF_HOST
from homeassistant.exceptions import PlatformNotReady
@ -26,7 +26,7 @@ async def async_setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([SisyphusLight(table_holder.name, table)], update_before_add=True)
class SisyphusLight(Light):
class SisyphusLight(LightEntity):
"""Representation of a Sisyphus table as a light."""
def __init__(self, name, table):

View File

@ -6,7 +6,7 @@ from homeassistant.components.light import (
ATTR_HS_COLOR,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
Light,
LightEntity,
)
import homeassistant.util.color as color_util
@ -36,7 +36,7 @@ def _to_hass_level(level):
return int((level * 255) / 100)
class SkybellLight(SkybellDevice, Light):
class SkybellLight(SkybellDevice, LightEntity):
"""A binary sensor implementation for Skybell devices."""
def __init__(self, device):

View File

@ -5,7 +5,7 @@ import logging
import pysmarthab
from requests.exceptions import Timeout
from homeassistant.components.light import Light
from homeassistant.components.light import LightEntity
from . import DATA_HUB, DOMAIN
@ -29,7 +29,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(entities, True)
class SmartHabLight(Light):
class SmartHabLight(LightEntity):
"""Representation of a SmartHab Light."""
def __init__(self, light):

View File

@ -13,7 +13,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
SUPPORT_TRANSITION,
Light,
LightEntity,
)
import homeassistant.util.color as color_util
@ -61,7 +61,7 @@ def convert_scale(value, value_scale, target_scale, round_digits=4):
return round(value * target_scale / value_scale, round_digits)
class SmartThingsLight(SmartThingsEntity, Light):
class SmartThingsLight(SmartThingsEntity, LightEntity):
"""Define a SmartThings Light."""
def __init__(self, device):

View File

@ -5,7 +5,7 @@ from typing import Callable, Optional, Sequence, cast
import voluptuous as vol
from homeassistant.components import switch
from homeassistant.components.light import PLATFORM_SCHEMA, Light
from homeassistant.components.light import PLATFORM_SCHEMA, LightEntity
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_ENTITY_ID,
@ -49,7 +49,7 @@ async def async_setup_platform(
)
class LightSwitch(Light):
class LightSwitch(LightEntity):
"""Represents a Switch as a Light."""
def __init__(self, name: str, switch_entity_id: str) -> None:

View File

@ -2,7 +2,11 @@
import logging
from homeassistant.components import light, tellduslive
from homeassistant.components.light import ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
LightEntity,
)
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .entry import TelldusLiveEntity
@ -25,7 +29,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
)
class TelldusLiveLight(TelldusLiveEntity, Light):
class TelldusLiveLight(TelldusLiveEntity, LightEntity):
"""Representation of a Tellstick Net light."""
def __init__(self, client, device_id):

View File

@ -1,5 +1,9 @@
"""Support for Tellstick lights."""
from homeassistant.components.light import ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
LightEntity,
)
from . import (
ATTR_DISCOVER_CONFIG,
@ -30,7 +34,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
)
class TellstickLight(TellstickDevice, Light):
class TellstickLight(TellstickDevice, LightEntity):
"""Representation of a Tellstick light."""
def __init__(self, tellcore_device, signal_repetitions):

View File

@ -13,7 +13,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
SUPPORT_WHITE_VALUE,
Light,
LightEntity,
)
from homeassistant.const import (
CONF_ENTITY_ID,
@ -146,7 +146,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(lights)
class LightTemplate(Light):
class LightTemplate(LightEntity):
"""Representation of a templated Light, including dimmable."""
def __init__(

View File

@ -10,7 +10,7 @@ from homeassistant.components.light import (
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
Light,
LightEntity,
)
from homeassistant.const import CONF_DEVICES, CONF_NAME, CONF_PASSWORD
import homeassistant.helpers.config_validation as cv
@ -44,7 +44,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(lights)
class TikteckLight(Light):
class TikteckLight(LightEntity):
"""Representation of a Tikteck light."""
def __init__(self, device):

View File

@ -13,7 +13,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
Light,
LightEntity,
)
from homeassistant.exceptions import HomeAssistantError
import homeassistant.helpers.device_registry as dr
@ -120,7 +120,7 @@ class LightFeatures(NamedTuple):
has_emeter: bool
class TPLinkSmartBulb(Light):
class TPLinkSmartBulb(LightEntity):
"""Representation of a TPLink Smart Bulb."""
def __init__(self, smartbulb: SmartBulb) -> None:

View File

@ -9,7 +9,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
Light,
LightEntity,
)
import homeassistant.util.color as color_util
@ -49,7 +49,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(TradfriGroup(group, api, gateway_id) for group in groups)
class TradfriGroup(TradfriBaseClass, Light):
class TradfriGroup(TradfriBaseClass, LightEntity):
"""The platform class for light groups required by hass."""
def __init__(self, device, api, gateway_id):
@ -106,7 +106,7 @@ class TradfriGroup(TradfriBaseClass, Light):
await self._api(self._device.set_state(1))
class TradfriLight(TradfriBaseDevice, Light):
class TradfriLight(TradfriBaseDevice, LightEntity):
"""The platform class required by Home Assistant."""
def __init__(self, device, api, gateway_id):

View File

@ -7,7 +7,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
Light,
LightEntity,
)
from homeassistant.util import color as colorutil
@ -31,7 +31,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices)
class TuyaLight(TuyaDevice, Light):
class TuyaLight(TuyaDevice, LightEntity):
"""Tuya light device."""
def __init__(self, tuya):

View File

@ -8,7 +8,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
Light,
LightEntity,
)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
import homeassistant.helpers.config_validation as cv
@ -46,7 +46,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(UnifiLedLight(light, api) for light in api.getlights())
class UnifiLedLight(Light):
class UnifiLedLight(LightEntity):
"""Representation of an unifiled Light."""
def __init__(self, light, api):

View File

@ -12,7 +12,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_FLASH,
SUPPORT_TRANSITION,
Light,
LightEntity,
)
from . import VelbusEntity
@ -32,7 +32,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
async_add_entities(entities)
class VelbusLight(VelbusEntity, Light):
class VelbusLight(VelbusEntity, LightEntity):
"""Representation of a Velbus light."""
@property

View File

@ -9,7 +9,7 @@ from homeassistant.components.light import (
ENTITY_ID_FORMAT,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
Light,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
@ -37,7 +37,7 @@ async def async_setup_entry(
)
class VeraLight(VeraDevice, Light):
class VeraLight(VeraDevice, LightEntity):
"""Representation of a Vera Light, including dimmable."""
def __init__(self, vera_device, controller):

View File

@ -15,7 +15,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
SUPPORT_TRANSITION,
Light,
LightEntity,
)
from homeassistant.helpers.dispatcher import async_dispatcher_connect
import homeassistant.util.color as color_util
@ -76,7 +76,7 @@ def setup_bridge(hass, bridge, async_add_entities):
update_lights()
class WemoLight(Light):
class WemoLight(LightEntity):
"""Representation of a WeMo light."""
def __init__(self, device, update_lights):
@ -209,7 +209,7 @@ class WemoLight(Light):
await self.hass.async_add_executor_job(self._update, force_update)
class WemoDimmer(Light):
class WemoDimmer(LightEntity):
"""Representation of a WeMo dimmer."""
def __init__(self, device):

View File

@ -8,7 +8,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
Light,
LightEntity,
)
from homeassistant.util import color as color_util
from homeassistant.util.color import (
@ -31,7 +31,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([WinkLight(light, hass)])
class WinkLight(WinkDevice, Light):
class WinkLight(WinkDevice, LightEntity):
"""Representation of a Wink light."""
async def async_added_to_hass(self):

View File

@ -17,7 +17,7 @@ from homeassistant.components.light import (
SUPPORT_EFFECT,
SUPPORT_TRANSITION,
SUPPORT_WHITE_VALUE,
Light,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers import config_validation as cv, entity_platform
@ -78,7 +78,7 @@ async def async_setup_entry(
async_add_entities(lights, True)
class WLEDLight(Light, WLEDDeviceEntity):
class WLEDLight(LightEntity, WLEDDeviceEntity):
"""Defines a WLED light."""
def __init__(

View File

@ -8,7 +8,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
Light,
LightEntity,
)
from homeassistant.const import CONF_DEVICES, CONF_ID, CONF_NAME
import homeassistant.helpers.config_validation as cv
@ -50,7 +50,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(X10Light(light, is_cm11a) for light in config[CONF_DEVICES])
class X10Light(Light):
class X10Light(LightEntity):
"""Representation of an X10 Light."""
def __init__(self, light, is_cm11a):

View File

@ -8,7 +8,7 @@ from homeassistant.components.light import (
ATTR_HS_COLOR,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
Light,
LightEntity,
)
import homeassistant.util.color as color_util
@ -28,7 +28,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices)
class XiaomiGatewayLight(XiaomiDevice, Light):
class XiaomiGatewayLight(XiaomiDevice, LightEntity):
"""Representation of a XiaomiGatewayLight."""
def __init__(self, device, name, xiaomi_hub):

View File

@ -24,7 +24,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
Light,
LightEntity,
)
from homeassistant.const import ATTR_ENTITY_ID, CONF_HOST, CONF_NAME, CONF_TOKEN
from homeassistant.exceptions import PlatformNotReady
@ -236,7 +236,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
)
class XiaomiPhilipsAbstractLight(Light):
class XiaomiPhilipsAbstractLight(LightEntity):
"""Representation of a Abstract Xiaomi Philips Light."""
def __init__(self, name, light, model, unique_id):

View File

@ -29,7 +29,7 @@ from homeassistant.components.light import (
SUPPORT_EFFECT,
SUPPORT_FLASH,
SUPPORT_TRANSITION,
Light,
LightEntity,
)
from homeassistant.const import ATTR_ENTITY_ID, ATTR_MODE, CONF_HOST, CONF_NAME
from homeassistant.core import callback
@ -426,7 +426,7 @@ def setup_services(hass):
)
class YeelightGenericLight(Light):
class YeelightGenericLight(LightEntity):
"""Representation of a Yeelight generic light."""
def __init__(self, device, custom_effects=None):

View File

@ -10,7 +10,7 @@ from homeassistant.components.light import (
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
Light,
LightEntity,
)
from homeassistant.const import CONF_HOST
import homeassistant.helpers.config_validation as cv
@ -36,7 +36,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(SunflowerBulb(light) for light in hub.get_lights())
class SunflowerBulb(Light):
class SunflowerBulb(LightEntity):
"""Representation of a Yeelight Sunflower Light."""
def __init__(self, light):

View File

@ -12,7 +12,7 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_WHITE_VALUE,
Light,
LightEntity,
)
from homeassistant.const import CONF_DEVICES, CONF_NAME
import homeassistant.helpers.config_validation as cv
@ -43,7 +43,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(lights, True)
class ZenggeLight(Light):
class ZenggeLight(LightEntity):
"""Representation of a Zengge light."""
def __init__(self, device):

View File

@ -97,7 +97,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
hass.data[DATA_ZHA][DATA_ZHA_DISPATCHERS].append(unsub)
class BaseLight(LogMixin, light.Light):
class BaseLight(LogMixin, light.LightEntity):
"""Operations common to all light entities."""
def __init__(self, *args, **kwargs):

View File

@ -1,7 +1,7 @@
"""Support for Zigbee lights."""
import voluptuous as vol
from homeassistant.components.light import Light
from homeassistant.components.light import LightEntity
from . import DOMAIN, PLATFORM_SCHEMA, ZigBeeDigitalOut, ZigBeeDigitalOutConfig
@ -21,5 +21,5 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([ZigBeeLight(ZigBeeDigitalOutConfig(config), zigbee_device)])
class ZigBeeLight(ZigBeeDigitalOut, Light):
class ZigBeeLight(ZigBeeDigitalOut, LightEntity):
"""Use ZigBeeDigitalOut as light."""

View File

@ -14,7 +14,7 @@ from homeassistant.components.light import (
SUPPORT_COLOR_TEMP,
SUPPORT_TRANSITION,
SUPPORT_WHITE_VALUE,
Light,
LightEntity,
)
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.core import callback
@ -118,7 +118,7 @@ def ct_to_hs(temp):
return [int(val) for val in colorlist]
class ZwaveDimmer(ZWaveDeviceEntity, Light):
class ZwaveDimmer(ZWaveDeviceEntity, LightEntity):
"""Representation of a Z-Wave dimmer."""
def __init__(self, values, refresh, delay):

View File

@ -548,3 +548,13 @@ async def test_light_brightness_pct_conversion(hass):
_, data = entity.last_call("turn_on")
assert data["brightness"] == 255, data
def test_deprecated_base_class(caplog):
"""Test deprecated base class."""
class CustomLight(light.Light):
pass
CustomLight()
assert "Light is deprecated, modify CustomLight" in caplog.text

View File

@ -3,7 +3,7 @@ Provide a mock light platform.
Call init before using it in your tests to ensure clean test data.
"""
from homeassistant.components.light import Light
from homeassistant.components.light import LightEntity
from homeassistant.const import STATE_OFF, STATE_ON
from tests.common import MockToggleEntity
@ -33,7 +33,7 @@ async def async_setup_platform(
async_add_entities_callback(ENTITIES)
class MockLight(MockToggleEntity, Light):
class MockLight(MockToggleEntity, LightEntity):
"""Mock light class."""
brightness = None