mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Adjust lifx to use local _ATTR_COLOR_TEMP constant (#132840)
This commit is contained in:
parent
05b23d081b
commit
1753382307
@ -64,3 +64,6 @@ DATA_LIFX_MANAGER = "lifx_manager"
|
|||||||
LIFX_CEILING_PRODUCT_IDS = {176, 177}
|
LIFX_CEILING_PRODUCT_IDS = {176, 177}
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__package__)
|
_LOGGER = logging.getLogger(__package__)
|
||||||
|
|
||||||
|
# _ATTR_COLOR_TEMP deprecated - to be removed in 2026.1
|
||||||
|
_ATTR_COLOR_TEMP = "color_temp"
|
||||||
|
@ -15,7 +15,6 @@ from homeassistant.components.light import (
|
|||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_BRIGHTNESS_PCT,
|
ATTR_BRIGHTNESS_PCT,
|
||||||
ATTR_COLOR_NAME,
|
ATTR_COLOR_NAME,
|
||||||
ATTR_COLOR_TEMP,
|
|
||||||
ATTR_COLOR_TEMP_KELVIN,
|
ATTR_COLOR_TEMP_KELVIN,
|
||||||
ATTR_HS_COLOR,
|
ATTR_HS_COLOR,
|
||||||
ATTR_RGB_COLOR,
|
ATTR_RGB_COLOR,
|
||||||
@ -30,7 +29,7 @@ from homeassistant.core import HomeAssistant, ServiceCall, callback
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.service import async_extract_referenced_entity_ids
|
from homeassistant.helpers.service import async_extract_referenced_entity_ids
|
||||||
|
|
||||||
from .const import ATTR_THEME, DATA_LIFX_MANAGER, DOMAIN
|
from .const import _ATTR_COLOR_TEMP, ATTR_THEME, DATA_LIFX_MANAGER, DOMAIN
|
||||||
from .coordinator import LIFXUpdateCoordinator, Light
|
from .coordinator import LIFXUpdateCoordinator, Light
|
||||||
from .util import convert_8_to_16, find_hsbk
|
from .util import convert_8_to_16, find_hsbk
|
||||||
|
|
||||||
@ -126,7 +125,8 @@ LIFX_EFFECT_PULSE_SCHEMA = cv.make_entity_service_schema(
|
|||||||
vol.Exclusive(ATTR_COLOR_TEMP_KELVIN, COLOR_GROUP): vol.All(
|
vol.Exclusive(ATTR_COLOR_TEMP_KELVIN, COLOR_GROUP): vol.All(
|
||||||
vol.Coerce(int), vol.Range(min=1500, max=9000)
|
vol.Coerce(int), vol.Range(min=1500, max=9000)
|
||||||
),
|
),
|
||||||
vol.Exclusive(ATTR_COLOR_TEMP, COLOR_GROUP): cv.positive_int,
|
# _ATTR_COLOR_TEMP deprecated - to be removed in 2026.1
|
||||||
|
vol.Exclusive(_ATTR_COLOR_TEMP, COLOR_GROUP): cv.positive_int,
|
||||||
ATTR_PERIOD: vol.All(vol.Coerce(float), vol.Range(min=0.05)),
|
ATTR_PERIOD: vol.All(vol.Coerce(float), vol.Range(min=0.05)),
|
||||||
ATTR_CYCLES: vol.All(vol.Coerce(float), vol.Range(min=1)),
|
ATTR_CYCLES: vol.All(vol.Coerce(float), vol.Range(min=1)),
|
||||||
ATTR_MODE: vol.In(PULSE_MODES),
|
ATTR_MODE: vol.In(PULSE_MODES),
|
||||||
|
@ -27,6 +27,7 @@ from homeassistant.helpers import device_registry as dr
|
|||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
|
_ATTR_COLOR_TEMP,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
DEFAULT_ATTEMPTS,
|
DEFAULT_ATTEMPTS,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
@ -112,13 +113,15 @@ def find_hsbk(hass: HomeAssistant, **kwargs: Any) -> list[float | int | None] |
|
|||||||
saturation = int(saturation / 100 * 65535)
|
saturation = int(saturation / 100 * 65535)
|
||||||
kelvin = 3500
|
kelvin = 3500
|
||||||
|
|
||||||
if "color_temp" in kwargs: # old ATTR_COLOR_TEMP
|
if _ATTR_COLOR_TEMP in kwargs:
|
||||||
# added in 2025.1, can be removed in 2026.1
|
# added in 2025.1, can be removed in 2026.1
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"The 'color_temp' parameter is deprecated. Please use 'color_temp_kelvin' for"
|
"The 'color_temp' parameter is deprecated. Please use 'color_temp_kelvin' for"
|
||||||
" all service calls"
|
" all service calls"
|
||||||
)
|
)
|
||||||
kelvin = color_util.color_temperature_mired_to_kelvin(kwargs.pop("color_temp"))
|
kelvin = color_util.color_temperature_mired_to_kelvin(
|
||||||
|
kwargs.pop(_ATTR_COLOR_TEMP)
|
||||||
|
)
|
||||||
saturation = 0
|
saturation = 0
|
||||||
|
|
||||||
if ATTR_COLOR_TEMP_KELVIN in kwargs:
|
if ATTR_COLOR_TEMP_KELVIN in kwargs:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user