From e4333a7a440f58721b4df7a2c828dd6fa168e750 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Sun, 26 Apr 2020 18:49:41 +0200 Subject: [PATCH] Rename Light to LightEntity (#34593) --- homeassistant/components/abode/light.py | 4 ++-- homeassistant/components/ads/light.py | 4 ++-- homeassistant/components/avea/light.py | 4 ++-- homeassistant/components/avion/light.py | 4 ++-- homeassistant/components/blinksticklight/light.py | 4 ++-- homeassistant/components/blinkt/light.py | 4 ++-- homeassistant/components/deconz/light.py | 4 ++-- homeassistant/components/decora/light.py | 4 ++-- homeassistant/components/decora_wifi/light.py | 4 ++-- homeassistant/components/demo/light.py | 4 ++-- homeassistant/components/dynalite/light.py | 4 ++-- homeassistant/components/elgato/light.py | 4 ++-- homeassistant/components/elkm1/light.py | 8 ++++++-- homeassistant/components/enocean/light.py | 4 ++-- homeassistant/components/esphome/light.py | 4 ++-- homeassistant/components/eufy/light.py | 4 ++-- homeassistant/components/everlights/light.py | 4 ++-- homeassistant/components/fibaro/light.py | 4 ++-- homeassistant/components/flux_led/light.py | 4 ++-- homeassistant/components/futurenow/light.py | 4 ++-- homeassistant/components/greenwave/light.py | 4 ++-- homeassistant/components/group/light.py | 2 +- homeassistant/components/hive/light.py | 4 ++-- .../components/homekit_controller/light.py | 4 ++-- homeassistant/components/homematic/light.py | 4 ++-- homeassistant/components/homematicip_cloud/light.py | 8 ++++---- homeassistant/components/homeworks/light.py | 8 ++++++-- homeassistant/components/hue/light.py | 4 ++-- homeassistant/components/hyperion/light.py | 4 ++-- homeassistant/components/iaqualink/light.py | 4 ++-- homeassistant/components/iglo/light.py | 4 ++-- homeassistant/components/ihc/light.py | 8 ++++++-- homeassistant/components/insteon/light.py | 8 ++++++-- homeassistant/components/isy994/light.py | 4 ++-- homeassistant/components/knx/light.py | 4 ++-- homeassistant/components/lcn/light.py | 6 +++--- homeassistant/components/lifx/light.py | 4 ++-- homeassistant/components/lifx_legacy/light.py | 4 ++-- homeassistant/components/light/__init__.py | 13 ++++++++++++- homeassistant/components/lightwave/light.py | 8 ++++++-- homeassistant/components/limitlessled/light.py | 4 ++-- homeassistant/components/litejet/light.py | 8 ++++++-- homeassistant/components/lutron/light.py | 8 ++++++-- homeassistant/components/lutron_caseta/light.py | 4 ++-- homeassistant/components/lw12wifi/light.py | 4 ++-- homeassistant/components/mochad/light.py | 4 ++-- homeassistant/components/mqtt/light/schema_basic.py | 6 +++--- homeassistant/components/mqtt/light/schema_json.py | 4 ++-- .../components/mqtt/light/schema_template.py | 4 ++-- homeassistant/components/mysensors/light.py | 4 ++-- homeassistant/components/mystrom/light.py | 4 ++-- homeassistant/components/nanoleaf/light.py | 4 ++-- homeassistant/components/niko_home_control/light.py | 4 ++-- homeassistant/components/opple/light.py | 4 ++-- homeassistant/components/osramlightify/light.py | 4 ++-- homeassistant/components/piglow/light.py | 4 ++-- homeassistant/components/pilight/light.py | 4 ++-- homeassistant/components/plum_lightpad/light.py | 6 +++--- homeassistant/components/qwikswitch/light.py | 4 ++-- homeassistant/components/rflink/light.py | 10 +++++----- homeassistant/components/rfxtrx/light.py | 4 ++-- homeassistant/components/ring/light.py | 4 ++-- homeassistant/components/scsgate/light.py | 4 ++-- homeassistant/components/sensehat/light.py | 4 ++-- homeassistant/components/sisyphus/light.py | 4 ++-- homeassistant/components/skybell/light.py | 4 ++-- homeassistant/components/smarthab/light.py | 4 ++-- homeassistant/components/smartthings/light.py | 4 ++-- homeassistant/components/switch/light.py | 4 ++-- homeassistant/components/tellduslive/light.py | 8 ++++++-- homeassistant/components/tellstick/light.py | 8 ++++++-- homeassistant/components/template/light.py | 4 ++-- homeassistant/components/tikteck/light.py | 4 ++-- homeassistant/components/tplink/light.py | 4 ++-- homeassistant/components/tradfri/light.py | 6 +++--- homeassistant/components/tuya/light.py | 4 ++-- homeassistant/components/unifiled/light.py | 4 ++-- homeassistant/components/velbus/light.py | 4 ++-- homeassistant/components/vera/light.py | 4 ++-- homeassistant/components/wemo/light.py | 6 +++--- homeassistant/components/wink/light.py | 4 ++-- homeassistant/components/wled/light.py | 4 ++-- homeassistant/components/x10/light.py | 4 ++-- homeassistant/components/xiaomi_aqara/light.py | 4 ++-- homeassistant/components/xiaomi_miio/light.py | 4 ++-- homeassistant/components/yeelight/light.py | 4 ++-- homeassistant/components/yeelightsunflower/light.py | 4 ++-- homeassistant/components/zengge/light.py | 4 ++-- homeassistant/components/zha/light.py | 2 +- homeassistant/components/zigbee/light.py | 4 ++-- homeassistant/components/zwave/light.py | 4 ++-- tests/components/light/test_init.py | 10 ++++++++++ .../testing_config/custom_components/test/light.py | 4 ++-- 93 files changed, 248 insertions(+), 191 deletions(-) diff --git a/homeassistant/components/abode/light.py b/homeassistant/components/abode/light.py index f15c10fc410..b756c79d9de 100644 --- a/homeassistant/components/abode/light.py +++ b/homeassistant/components/abode/light.py @@ -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): diff --git a/homeassistant/components/ads/light.py b/homeassistant/components/ads/light.py index 384bd2e83a6..74701066078 100644 --- a/homeassistant/components/ads/light.py +++ b/homeassistant/components/ads/light.py @@ -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): diff --git a/homeassistant/components/avea/light.py b/homeassistant/components/avea/light.py index 92d66a554da..8f57fb08e96 100644 --- a/homeassistant/components/avea/light.py +++ b/homeassistant/components/avea/light.py @@ -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): diff --git a/homeassistant/components/avion/light.py b/homeassistant/components/avion/light.py index 0c95b2bf736..e5281c13654 100644 --- a/homeassistant/components/avion/light.py +++ b/homeassistant/components/avion/light.py @@ -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): diff --git a/homeassistant/components/blinksticklight/light.py b/homeassistant/components/blinksticklight/light.py index 4eab2fc3d11..56009c90da3 100644 --- a/homeassistant/components/blinksticklight/light.py +++ b/homeassistant/components/blinksticklight/light.py @@ -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): diff --git a/homeassistant/components/blinkt/light.py b/homeassistant/components/blinkt/light.py index d9ef2ac6a7e..768ca92d9d2 100644 --- a/homeassistant/components/blinkt/light.py +++ b/homeassistant/components/blinkt/light.py @@ -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): diff --git a/homeassistant/components/deconz/light.py b/homeassistant/components/deconz/light.py index e836f1e4490..48d286266e4 100644 --- a/homeassistant/components/deconz/light.py +++ b/homeassistant/components/deconz/light.py @@ -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): diff --git a/homeassistant/components/decora/light.py b/homeassistant/components/decora/light.py index f4035352e51..5b6015b7c54 100644 --- a/homeassistant/components/decora/light.py +++ b/homeassistant/components/decora/light.py @@ -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): diff --git a/homeassistant/components/decora_wifi/light.py b/homeassistant/components/decora_wifi/light.py index 9071da9707d..6f716d3a5dc 100644 --- a/homeassistant/components/decora_wifi/light.py +++ b/homeassistant/components/decora_wifi/light.py @@ -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): diff --git a/homeassistant/components/demo/light.py b/homeassistant/components/demo/light.py index e6747fee2df..11b6a4812e8 100644 --- a/homeassistant/components/demo/light.py +++ b/homeassistant/components/demo/light.py @@ -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__( diff --git a/homeassistant/components/dynalite/light.py b/homeassistant/components/dynalite/light.py index 283b1ee2286..5e7069ab50b 100644 --- a/homeassistant/components/dynalite/light.py +++ b/homeassistant/components/dynalite/light.py @@ -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 diff --git a/homeassistant/components/elgato/light.py b/homeassistant/components/elgato/light.py index 99bca1ba20e..9dae0cd1f40 100644 --- a/homeassistant/components/elgato/light.py +++ b/homeassistant/components/elgato/light.py @@ -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__( diff --git a/homeassistant/components/elkm1/light.py b/homeassistant/components/elkm1/light.py index b7cfe20dfd8..19a09d13975 100644 --- a/homeassistant/components/elkm1/light.py +++ b/homeassistant/components/elkm1/light.py @@ -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): diff --git a/homeassistant/components/enocean/light.py b/homeassistant/components/enocean/light.py index a1d2b22cdb4..0df0c94775a 100644 --- a/homeassistant/components/enocean/light.py +++ b/homeassistant/components/enocean/light.py @@ -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): diff --git a/homeassistant/components/esphome/light.py b/homeassistant/components/esphome/light.py index 9a2a0ccd0bc..36c22f28016 100644 --- a/homeassistant/components/esphome/light.py +++ b/homeassistant/components/esphome/light.py @@ -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 diff --git a/homeassistant/components/eufy/light.py b/homeassistant/components/eufy/light.py index 570f690307f..2c23eca483f 100644 --- a/homeassistant/components/eufy/light.py +++ b/homeassistant/components/eufy/light.py @@ -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): diff --git a/homeassistant/components/everlights/light.py b/homeassistant/components/everlights/light.py index da9d5b88ae0..95571a825b2 100644 --- a/homeassistant/components/everlights/light.py +++ b/homeassistant/components/everlights/light.py @@ -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): diff --git a/homeassistant/components/fibaro/light.py b/homeassistant/components/fibaro/light.py index d14d9a195d9..f73347cf356 100644 --- a/homeassistant/components/fibaro/light.py +++ b/homeassistant/components/fibaro/light.py @@ -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): diff --git a/homeassistant/components/flux_led/light.py b/homeassistant/components/flux_led/light.py index 1acd58d8e43..4bfd0c0a26c 100644 --- a/homeassistant/components/flux_led/light.py +++ b/homeassistant/components/flux_led/light.py @@ -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): diff --git a/homeassistant/components/futurenow/light.py b/homeassistant/components/futurenow/light.py index 4da3bfd5bc3..2bccd38688a 100644 --- a/homeassistant/components/futurenow/light.py +++ b/homeassistant/components/futurenow/light.py @@ -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): diff --git a/homeassistant/components/greenwave/light.py b/homeassistant/components/greenwave/light.py index 8b85de598b0..41e4b99b6c6 100644 --- a/homeassistant/components/greenwave/light.py +++ b/homeassistant/components/greenwave/light.py @@ -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): diff --git a/homeassistant/components/group/light.py b/homeassistant/components/group/light.py index 3abca98bd2c..eb043177eba 100644 --- a/homeassistant/components/group/light.py +++ b/homeassistant/components/group/light.py @@ -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: diff --git a/homeassistant/components/hive/light.py b/homeassistant/components/hive/light.py index 33175de543d..d6a9d1f400b 100644 --- a/homeassistant/components/hive/light.py +++ b/homeassistant/components/hive/light.py @@ -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): diff --git a/homeassistant/components/homekit_controller/light.py b/homeassistant/components/homekit_controller/light.py index e78ed48ad0c..b024efe6121 100644 --- a/homeassistant/components/homekit_controller/light.py +++ b/homeassistant/components/homekit_controller/light.py @@ -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): diff --git a/homeassistant/components/homematic/light.py b/homeassistant/components/homematic/light.py index 6e6ccb78371..c7cfcc2ac8c 100644 --- a/homeassistant/components/homematic/light.py +++ b/homeassistant/components/homematic/light.py @@ -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 diff --git a/homeassistant/components/homematicip_cloud/light.py b/homeassistant/components/homematicip_cloud/light.py index 42c18239ac2..9ddcc44e8bd 100644 --- a/homeassistant/components/homematicip_cloud/light.py +++ b/homeassistant/components/homematicip_cloud/light.py @@ -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: diff --git a/homeassistant/components/homeworks/light.py b/homeassistant/components/homeworks/light.py index db72c87a4a3..a5a3b9ed077 100644 --- a/homeassistant/components/homeworks/light.py +++ b/homeassistant/components/homeworks/light.py @@ -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): diff --git a/homeassistant/components/hue/light.py b/homeassistant/components/hue/light.py index b808dd0594d..7b5b7e6e804 100644 --- a/homeassistant/components/hue/light.py +++ b/homeassistant/components/hue/light.py @@ -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): diff --git a/homeassistant/components/hyperion/light.py b/homeassistant/components/hyperion/light.py index fc96f672afb..d1baec315bf 100644 --- a/homeassistant/components/hyperion/light.py +++ b/homeassistant/components/hyperion/light.py @@ -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__( diff --git a/homeassistant/components/iaqualink/light.py b/homeassistant/components/iaqualink/light.py index 813af7863f1..362ef8b8b8e 100644 --- a/homeassistant/components/iaqualink/light.py +++ b/homeassistant/components/iaqualink/light.py @@ -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 diff --git a/homeassistant/components/iglo/light.py b/homeassistant/components/iglo/light.py index 59e6db2a81f..f6f681d8b60 100644 --- a/homeassistant/components/iglo/light.py +++ b/homeassistant/components/iglo/light.py @@ -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): diff --git a/homeassistant/components/ihc/light.py b/homeassistant/components/ihc/light.py index af6b62c42ff..c35cb2224cf 100644 --- a/homeassistant/components/ihc/light.py +++ b/homeassistant/components/ihc/light.py @@ -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 diff --git a/homeassistant/components/insteon/light.py b/homeassistant/components/insteon/light.py index 60a27b3acb8..afd575c363b 100644 --- a/homeassistant/components/insteon/light.py +++ b/homeassistant/components/insteon/light.py @@ -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 diff --git a/homeassistant/components/isy994/light.py b/homeassistant/components/isy994/light.py index a8c30220637..0d66a73571d 100644 --- a/homeassistant/components/isy994/light.py +++ b/homeassistant/components/isy994/light.py @@ -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: diff --git a/homeassistant/components/knx/light.py b/homeassistant/components/knx/light.py index 8570c2eb09a..bb82e86cd25 100644 --- a/homeassistant/components/knx/light.py +++ b/homeassistant/components/knx/light.py @@ -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): diff --git a/homeassistant/components/lcn/light.py b/homeassistant/components/lcn/light.py index 7f1cd547c02..e76becc0e9f 100644 --- a/homeassistant/components/lcn/light.py +++ b/homeassistant/components/lcn/light.py @@ -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): diff --git a/homeassistant/components/lifx/light.py b/homeassistant/components/lifx/light.py index ca04dbefb7f..f36b64f2397 100644 --- a/homeassistant/components/lifx/light.py +++ b/homeassistant/components/lifx/light.py @@ -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): diff --git a/homeassistant/components/lifx_legacy/light.py b/homeassistant/components/lifx_legacy/light.py index 7fb0e686b31..f0ed9105b99 100644 --- a/homeassistant/components/lifx_legacy/light.py +++ b/homeassistant/components/lifx_legacy/light.py @@ -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): diff --git a/homeassistant/components/light/__init__.py b/homeassistant/components/light/__init__.py index 7c33fdcb075..d25d6b961ed 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -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__, + ) diff --git a/homeassistant/components/lightwave/light.py b/homeassistant/components/lightwave/light.py index 78e4c43a0e7..d441e80b4fa 100644 --- a/homeassistant/components/lightwave/light.py +++ b/homeassistant/components/lightwave/light.py @@ -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): diff --git a/homeassistant/components/limitlessled/light.py b/homeassistant/components/limitlessled/light.py index e0ef635ae87..682d619a92c 100644 --- a/homeassistant/components/limitlessled/light.py +++ b/homeassistant/components/limitlessled/light.py @@ -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): diff --git a/homeassistant/components/litejet/light.py b/homeassistant/components/litejet/light.py index d99cf27852f..efc6830d775 100644 --- a/homeassistant/components/litejet/light.py +++ b/homeassistant/components/litejet/light.py @@ -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): diff --git a/homeassistant/components/lutron/light.py b/homeassistant/components/lutron/light.py index 938132259d9..2b5bff7d848 100644 --- a/homeassistant/components/lutron/light.py +++ b/homeassistant/components/lutron/light.py @@ -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): diff --git a/homeassistant/components/lutron_caseta/light.py b/homeassistant/components/lutron_caseta/light.py index 350c35fffa8..f6ec0369509 100644 --- a/homeassistant/components/lutron_caseta/light.py +++ b/homeassistant/components/lutron_caseta/light.py @@ -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 diff --git a/homeassistant/components/lw12wifi/light.py b/homeassistant/components/lw12wifi/light.py index abf75a1e318..907e6b898d6 100644 --- a/homeassistant/components/lw12wifi/light.py +++ b/homeassistant/components/lw12wifi/light.py @@ -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): diff --git a/homeassistant/components/mochad/light.py b/homeassistant/components/mochad/light.py index 1f5cbc6bb95..a2264a65b16 100644 --- a/homeassistant/components/mochad/light.py +++ b/homeassistant/components/mochad/light.py @@ -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): diff --git a/homeassistant/components/mqtt/light/schema_basic.py b/homeassistant/components/mqtt/light/schema_basic.py index e6a7f827f1e..2af63311e47 100644 --- a/homeassistant/components/mqtt/light/schema_basic.py +++ b/homeassistant/components/mqtt/light/schema_basic.py @@ -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.""" diff --git a/homeassistant/components/mqtt/light/schema_json.py b/homeassistant/components/mqtt/light/schema_json.py index 924559e3e90..ef311cbe8a7 100644 --- a/homeassistant/components/mqtt/light/schema_json.py +++ b/homeassistant/components/mqtt/light/schema_json.py @@ -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.""" diff --git a/homeassistant/components/mqtt/light/schema_template.py b/homeassistant/components/mqtt/light/schema_template.py index 25de6862bdb..fab6db4906f 100644 --- a/homeassistant/components/mqtt/light/schema_template.py +++ b/homeassistant/components/mqtt/light/schema_template.py @@ -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.""" diff --git a/homeassistant/components/mysensors/light.py b/homeassistant/components/mysensors/light.py index 1585de4b462..ffbcba6f032 100644 --- a/homeassistant/components/mysensors/light.py +++ b/homeassistant/components/mysensors/light.py @@ -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): diff --git a/homeassistant/components/mystrom/light.py b/homeassistant/components/mystrom/light.py index 72ec051b120..2762792e133 100644 --- a/homeassistant/components/mystrom/light.py +++ b/homeassistant/components/mystrom/light.py @@ -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): diff --git a/homeassistant/components/nanoleaf/light.py b/homeassistant/components/nanoleaf/light.py index 612e1b6ead9..5073a421e49 100644 --- a/homeassistant/components/nanoleaf/light.py +++ b/homeassistant/components/nanoleaf/light.py @@ -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): diff --git a/homeassistant/components/niko_home_control/light.py b/homeassistant/components/niko_home_control/light.py index 265e51d6e67..4875e2e1e57 100644 --- a/homeassistant/components/niko_home_control/light.py +++ b/homeassistant/components/niko_home_control/light.py @@ -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): diff --git a/homeassistant/components/opple/light.py b/homeassistant/components/opple/light.py index 9ee53704d10..bd0f40da20b 100644 --- a/homeassistant/components/opple/light.py +++ b/homeassistant/components/opple/light.py @@ -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): diff --git a/homeassistant/components/osramlightify/light.py b/homeassistant/components/osramlightify/light.py index ed79604a3f8..49c32da69bc 100644 --- a/homeassistant/components/osramlightify/light.py +++ b/homeassistant/components/osramlightify/light.py @@ -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): diff --git a/homeassistant/components/piglow/light.py b/homeassistant/components/piglow/light.py index 27bbb81d31f..1e6040f9d80 100644 --- a/homeassistant/components/piglow/light.py +++ b/homeassistant/components/piglow/light.py @@ -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): diff --git a/homeassistant/components/pilight/light.py b/homeassistant/components/pilight/light.py index 49ce3d9a124..12d175817d7 100644 --- a/homeassistant/components/pilight/light.py +++ b/homeassistant/components/pilight/light.py @@ -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): diff --git a/homeassistant/components/plum_lightpad/light.py b/homeassistant/components/plum_lightpad/light.py index 1ce76d9dc5f..737c6f2bfad 100644 --- a/homeassistant/components/plum_lightpad/light.py +++ b/homeassistant/components/plum_lightpad/light.py @@ -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): diff --git a/homeassistant/components/qwikswitch/light.py b/homeassistant/components/qwikswitch/light.py index 1adcef56ffa..43c6add6048 100644 --- a/homeassistant/components/qwikswitch/light.py +++ b/homeassistant/components/qwikswitch/light.py @@ -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 diff --git a/homeassistant/components/rflink/light.py b/homeassistant/components/rflink/light.py index 348fff0da9a..65d6acb3de9 100644 --- a/homeassistant/components/rflink/light.py +++ b/homeassistant/components/rflink/light.py @@ -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 diff --git a/homeassistant/components/rfxtrx/light.py b/homeassistant/components/rfxtrx/light.py index 437cce89c49..ea6c834f63b 100644 --- a/homeassistant/components/rfxtrx/light.py +++ b/homeassistant/components/rfxtrx/light.py @@ -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): diff --git a/homeassistant/components/ring/light.py b/homeassistant/components/ring/light.py index 3340e0ad603..8a5b75cfecd 100644 --- a/homeassistant/components/ring/light.py +++ b/homeassistant/components/ring/light.py @@ -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): diff --git a/homeassistant/components/scsgate/light.py b/homeassistant/components/scsgate/light.py index 8caa824d5fb..c8f5b720c70 100644 --- a/homeassistant/components/scsgate/light.py +++ b/homeassistant/components/scsgate/light.py @@ -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): diff --git a/homeassistant/components/sensehat/light.py b/homeassistant/components/sensehat/light.py index 462c4245cd4..5eda783bebf 100644 --- a/homeassistant/components/sensehat/light.py +++ b/homeassistant/components/sensehat/light.py @@ -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): diff --git a/homeassistant/components/sisyphus/light.py b/homeassistant/components/sisyphus/light.py index 271db41ac22..ce0c37174ef 100644 --- a/homeassistant/components/sisyphus/light.py +++ b/homeassistant/components/sisyphus/light.py @@ -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): diff --git a/homeassistant/components/skybell/light.py b/homeassistant/components/skybell/light.py index c9aa622ad0b..273cdfd079c 100644 --- a/homeassistant/components/skybell/light.py +++ b/homeassistant/components/skybell/light.py @@ -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): diff --git a/homeassistant/components/smarthab/light.py b/homeassistant/components/smarthab/light.py index 469d89011b8..8b608cfbd4f 100644 --- a/homeassistant/components/smarthab/light.py +++ b/homeassistant/components/smarthab/light.py @@ -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): diff --git a/homeassistant/components/smartthings/light.py b/homeassistant/components/smartthings/light.py index 7978d85505d..1e4161abd0f 100644 --- a/homeassistant/components/smartthings/light.py +++ b/homeassistant/components/smartthings/light.py @@ -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): diff --git a/homeassistant/components/switch/light.py b/homeassistant/components/switch/light.py index 92b64b36b93..f40ccde5b0b 100644 --- a/homeassistant/components/switch/light.py +++ b/homeassistant/components/switch/light.py @@ -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: diff --git a/homeassistant/components/tellduslive/light.py b/homeassistant/components/tellduslive/light.py index 3087c4cdf08..76d26a2fd94 100644 --- a/homeassistant/components/tellduslive/light.py +++ b/homeassistant/components/tellduslive/light.py @@ -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): diff --git a/homeassistant/components/tellstick/light.py b/homeassistant/components/tellstick/light.py index cb4fe9b37ec..15b15112d14 100644 --- a/homeassistant/components/tellstick/light.py +++ b/homeassistant/components/tellstick/light.py @@ -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): diff --git a/homeassistant/components/template/light.py b/homeassistant/components/template/light.py index 1c19dfb33a6..df0a095cdd1 100644 --- a/homeassistant/components/template/light.py +++ b/homeassistant/components/template/light.py @@ -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__( diff --git a/homeassistant/components/tikteck/light.py b/homeassistant/components/tikteck/light.py index 6c623f29f18..22e18d9697b 100644 --- a/homeassistant/components/tikteck/light.py +++ b/homeassistant/components/tikteck/light.py @@ -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): diff --git a/homeassistant/components/tplink/light.py b/homeassistant/components/tplink/light.py index 9910fe42e03..9c3d73b43b5 100644 --- a/homeassistant/components/tplink/light.py +++ b/homeassistant/components/tplink/light.py @@ -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: diff --git a/homeassistant/components/tradfri/light.py b/homeassistant/components/tradfri/light.py index 40fe7b01cb0..4e44b452d33 100644 --- a/homeassistant/components/tradfri/light.py +++ b/homeassistant/components/tradfri/light.py @@ -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): diff --git a/homeassistant/components/tuya/light.py b/homeassistant/components/tuya/light.py index 6c05f4f2cc7..2959b9239bd 100644 --- a/homeassistant/components/tuya/light.py +++ b/homeassistant/components/tuya/light.py @@ -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): diff --git a/homeassistant/components/unifiled/light.py b/homeassistant/components/unifiled/light.py index 6b0b1e2edf1..0281aa351d2 100644 --- a/homeassistant/components/unifiled/light.py +++ b/homeassistant/components/unifiled/light.py @@ -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): diff --git a/homeassistant/components/velbus/light.py b/homeassistant/components/velbus/light.py index d7654feab2d..4aebbb27953 100644 --- a/homeassistant/components/velbus/light.py +++ b/homeassistant/components/velbus/light.py @@ -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 diff --git a/homeassistant/components/vera/light.py b/homeassistant/components/vera/light.py index 877fdf51f0a..250842f1687 100644 --- a/homeassistant/components/vera/light.py +++ b/homeassistant/components/vera/light.py @@ -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): diff --git a/homeassistant/components/wemo/light.py b/homeassistant/components/wemo/light.py index b8c05ead076..02b5e79d1c6 100644 --- a/homeassistant/components/wemo/light.py +++ b/homeassistant/components/wemo/light.py @@ -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): diff --git a/homeassistant/components/wink/light.py b/homeassistant/components/wink/light.py index bd125e6a7c2..4d20cf4dd5a 100644 --- a/homeassistant/components/wink/light.py +++ b/homeassistant/components/wink/light.py @@ -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): diff --git a/homeassistant/components/wled/light.py b/homeassistant/components/wled/light.py index beda19b8101..6b86be6265b 100644 --- a/homeassistant/components/wled/light.py +++ b/homeassistant/components/wled/light.py @@ -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__( diff --git a/homeassistant/components/x10/light.py b/homeassistant/components/x10/light.py index 131cc61ed61..3943c081eef 100644 --- a/homeassistant/components/x10/light.py +++ b/homeassistant/components/x10/light.py @@ -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): diff --git a/homeassistant/components/xiaomi_aqara/light.py b/homeassistant/components/xiaomi_aqara/light.py index 5096bc25d24..f1cd17f9dee 100644 --- a/homeassistant/components/xiaomi_aqara/light.py +++ b/homeassistant/components/xiaomi_aqara/light.py @@ -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): diff --git a/homeassistant/components/xiaomi_miio/light.py b/homeassistant/components/xiaomi_miio/light.py index c4ea831ceeb..cc9343aa2c0 100644 --- a/homeassistant/components/xiaomi_miio/light.py +++ b/homeassistant/components/xiaomi_miio/light.py @@ -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): diff --git a/homeassistant/components/yeelight/light.py b/homeassistant/components/yeelight/light.py index ab49e46938c..49315117e72 100644 --- a/homeassistant/components/yeelight/light.py +++ b/homeassistant/components/yeelight/light.py @@ -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): diff --git a/homeassistant/components/yeelightsunflower/light.py b/homeassistant/components/yeelightsunflower/light.py index c49c874dc21..2e17b92c90a 100644 --- a/homeassistant/components/yeelightsunflower/light.py +++ b/homeassistant/components/yeelightsunflower/light.py @@ -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): diff --git a/homeassistant/components/zengge/light.py b/homeassistant/components/zengge/light.py index 42746c6bad3..fa2c7d50add 100644 --- a/homeassistant/components/zengge/light.py +++ b/homeassistant/components/zengge/light.py @@ -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): diff --git a/homeassistant/components/zha/light.py b/homeassistant/components/zha/light.py index b05e4b7bee0..efe95ae6604 100644 --- a/homeassistant/components/zha/light.py +++ b/homeassistant/components/zha/light.py @@ -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): diff --git a/homeassistant/components/zigbee/light.py b/homeassistant/components/zigbee/light.py index 54f6044c3dd..10bb87aa426 100644 --- a/homeassistant/components/zigbee/light.py +++ b/homeassistant/components/zigbee/light.py @@ -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.""" diff --git a/homeassistant/components/zwave/light.py b/homeassistant/components/zwave/light.py index 745400e5c44..1856aeb9623 100644 --- a/homeassistant/components/zwave/light.py +++ b/homeassistant/components/zwave/light.py @@ -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): diff --git a/tests/components/light/test_init.py b/tests/components/light/test_init.py index 2e2f74828d9..e53949ef518 100644 --- a/tests/components/light/test_init.py +++ b/tests/components/light/test_init.py @@ -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 diff --git a/tests/testing_config/custom_components/test/light.py b/tests/testing_config/custom_components/test/light.py index d3f96c367d8..863412fe747 100644 --- a/tests/testing_config/custom_components/test/light.py +++ b/tests/testing_config/custom_components/test/light.py @@ -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