From add0d9d3eb8243eeca1de8b2ab0e9d6756005386 Mon Sep 17 00:00:00 2001 From: tkdrob Date: Tue, 16 Feb 2021 09:00:09 -0500 Subject: [PATCH] Use core constants for yeelight (#46552) --- homeassistant/components/yeelight/__init__.py | 2 -- homeassistant/components/yeelight/config_flow.py | 3 +-- homeassistant/components/yeelight/light.py | 2 -- tests/components/yeelight/test_config_flow.py | 3 +-- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/yeelight/__init__.py b/homeassistant/components/yeelight/__init__.py index b61df3f810b..f24847a2d54 100644 --- a/homeassistant/components/yeelight/__init__.py +++ b/homeassistant/components/yeelight/__init__.py @@ -42,7 +42,6 @@ CONF_FLOW_PARAMS = "flow_params" CONF_CUSTOM_EFFECTS = "custom_effects" CONF_NIGHTLIGHT_SWITCH_TYPE = "nightlight_switch_type" CONF_NIGHTLIGHT_SWITCH = "nightlight_switch" -CONF_DEVICE = "device" DATA_CONFIG_ENTRIES = "config_entries" DATA_CUSTOM_EFFECTS = "custom_effects" @@ -423,7 +422,6 @@ class YeelightDevice: Uses brightness as it appears to be supported in both ceiling and other lights. """ - return self._nightlight_brightness is not None @property diff --git a/homeassistant/components/yeelight/config_flow.py b/homeassistant/components/yeelight/config_flow.py index 52f27932403..f186c897a21 100644 --- a/homeassistant/components/yeelight/config_flow.py +++ b/homeassistant/components/yeelight/config_flow.py @@ -5,12 +5,11 @@ import voluptuous as vol import yeelight from homeassistant import config_entries, exceptions -from homeassistant.const import CONF_HOST, CONF_ID, CONF_NAME +from homeassistant.const import CONF_DEVICE, CONF_HOST, CONF_ID, CONF_NAME from homeassistant.core import callback import homeassistant.helpers.config_validation as cv from . import ( - CONF_DEVICE, CONF_MODE_MUSIC, CONF_MODEL, CONF_NIGHTLIGHT_SWITCH, diff --git a/homeassistant/components/yeelight/light.py b/homeassistant/components/yeelight/light.py index c256cfb23e0..e4044303ef0 100644 --- a/homeassistant/components/yeelight/light.py +++ b/homeassistant/components/yeelight/light.py @@ -261,7 +261,6 @@ async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities ) -> None: """Set up Yeelight from a config entry.""" - custom_effects = _parse_custom_effects(hass.data[DOMAIN][DATA_CUSTOM_EFFECTS]) device = hass.data[DOMAIN][DATA_CONFIG_ENTRIES][config_entry.entry_id][DATA_DEVICE] @@ -563,7 +562,6 @@ class YeelightGenericLight(YeelightEntity, LightEntity): @property def device_state_attributes(self): """Return the device specific state attributes.""" - attributes = { "flowing": self.device.is_color_flow_enabled, "music_mode": self._bulb.music_mode, diff --git a/tests/components/yeelight/test_config_flow.py b/tests/components/yeelight/test_config_flow.py index 8fa1ba5c988..6a1508d7896 100644 --- a/tests/components/yeelight/test_config_flow.py +++ b/tests/components/yeelight/test_config_flow.py @@ -3,7 +3,6 @@ from unittest.mock import MagicMock, patch from homeassistant import config_entries from homeassistant.components.yeelight import ( - CONF_DEVICE, CONF_MODE_MUSIC, CONF_MODEL, CONF_NIGHTLIGHT_SWITCH, @@ -18,7 +17,7 @@ from homeassistant.components.yeelight import ( DOMAIN, NIGHTLIGHT_SWITCH_TYPE_LIGHT, ) -from homeassistant.const import CONF_HOST, CONF_ID, CONF_NAME +from homeassistant.const import CONF_DEVICE, CONF_HOST, CONF_ID, CONF_NAME from homeassistant.core import HomeAssistant from . import (