mirror of
https://github.com/home-assistant/core
synced 2024-08-02 23:40:32 +02:00
Remove white_value support from group light (#76924)
This commit is contained in:
parent
d034ed1fc2
commit
05e33821fd
@ -25,10 +25,8 @@ from homeassistant.components.light import (
|
||||
ATTR_SUPPORTED_COLOR_MODES,
|
||||
ATTR_TRANSITION,
|
||||
ATTR_WHITE,
|
||||
ATTR_WHITE_VALUE,
|
||||
ATTR_XY_COLOR,
|
||||
PLATFORM_SCHEMA,
|
||||
SUPPORT_WHITE_VALUE,
|
||||
ColorMode,
|
||||
LightEntity,
|
||||
LightEntityFeature,
|
||||
@ -71,10 +69,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
)
|
||||
|
||||
SUPPORT_GROUP_LIGHT = (
|
||||
LightEntityFeature.EFFECT
|
||||
| LightEntityFeature.FLASH
|
||||
| LightEntityFeature.TRANSITION
|
||||
| SUPPORT_WHITE_VALUE
|
||||
LightEntityFeature.EFFECT | LightEntityFeature.FLASH | LightEntityFeature.TRANSITION
|
||||
)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -128,7 +123,6 @@ FORWARDED_ATTRIBUTES = frozenset(
|
||||
ATTR_RGBWW_COLOR,
|
||||
ATTR_TRANSITION,
|
||||
ATTR_WHITE,
|
||||
ATTR_WHITE_VALUE,
|
||||
ATTR_XY_COLOR,
|
||||
}
|
||||
)
|
||||
@ -148,7 +142,6 @@ class LightGroup(GroupEntity, LightEntity):
|
||||
) -> None:
|
||||
"""Initialize a light group."""
|
||||
self._entity_ids = entity_ids
|
||||
self._white_value: int | None = None
|
||||
|
||||
self._attr_name = name
|
||||
self._attr_extra_state_attributes = {ATTR_ENTITY_ID: entity_ids}
|
||||
@ -174,11 +167,6 @@ class LightGroup(GroupEntity, LightEntity):
|
||||
|
||||
await super().async_added_to_hass()
|
||||
|
||||
@property
|
||||
def white_value(self) -> int | None:
|
||||
"""Return the white value of this light group between 0..255."""
|
||||
return self._white_value
|
||||
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Forward the turn_on command to all lights in the light group."""
|
||||
data = {
|
||||
@ -251,8 +239,6 @@ class LightGroup(GroupEntity, LightEntity):
|
||||
on_states, ATTR_XY_COLOR, reduce=mean_tuple
|
||||
)
|
||||
|
||||
self._white_value = reduce_attribute(on_states, ATTR_WHITE_VALUE)
|
||||
|
||||
self._attr_color_temp = reduce_attribute(on_states, ATTR_COLOR_TEMP)
|
||||
self._attr_min_mireds = reduce_attribute(
|
||||
states, ATTR_MIN_MIREDS, default=154, reduce=min
|
||||
|
@ -618,48 +618,6 @@ async def test_color_rgbww(hass, enable_custom_integrations):
|
||||
assert state.attributes[ATTR_SUPPORTED_FEATURES] == 0
|
||||
|
||||
|
||||
async def test_white_value(hass):
|
||||
"""Test white value reporting."""
|
||||
await async_setup_component(
|
||||
hass,
|
||||
LIGHT_DOMAIN,
|
||||
{
|
||||
LIGHT_DOMAIN: {
|
||||
"platform": DOMAIN,
|
||||
"entities": ["light.test1", "light.test2"],
|
||||
"all": "false",
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_start()
|
||||
await hass.async_block_till_done()
|
||||
|
||||
hass.states.async_set(
|
||||
"light.test1", STATE_ON, {ATTR_WHITE_VALUE: 255, ATTR_SUPPORTED_FEATURES: 128}
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get("light.light_group")
|
||||
assert state.attributes[ATTR_SUPPORTED_FEATURES] == 128
|
||||
assert state.attributes[ATTR_WHITE_VALUE] == 255
|
||||
|
||||
hass.states.async_set(
|
||||
"light.test2", STATE_ON, {ATTR_WHITE_VALUE: 100, ATTR_SUPPORTED_FEATURES: 128}
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get("light.light_group")
|
||||
assert state.attributes[ATTR_SUPPORTED_FEATURES] == 128
|
||||
assert state.attributes[ATTR_WHITE_VALUE] == 177
|
||||
|
||||
hass.states.async_set(
|
||||
"light.test1", STATE_OFF, {ATTR_WHITE_VALUE: 255, ATTR_SUPPORTED_FEATURES: 128}
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get("light.light_group")
|
||||
assert state.attributes[ATTR_SUPPORTED_FEATURES] == 128
|
||||
assert state.attributes[ATTR_WHITE_VALUE] == 100
|
||||
|
||||
|
||||
async def test_white(hass, enable_custom_integrations):
|
||||
"""Test white reporting."""
|
||||
platform = getattr(hass.components, "test.light")
|
||||
@ -1493,7 +1451,6 @@ async def test_invalid_service_calls(hass):
|
||||
ATTR_XY_COLOR: (0.5, 0.42),
|
||||
ATTR_RGB_COLOR: (80, 120, 50),
|
||||
ATTR_COLOR_TEMP: 1234,
|
||||
ATTR_WHITE_VALUE: 1,
|
||||
ATTR_EFFECT: "Sunshine",
|
||||
ATTR_TRANSITION: 4,
|
||||
ATTR_FLASH: "long",
|
||||
|
Loading…
Reference in New Issue
Block a user