mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Deprecate wled.preset service (#53383)
This commit is contained in:
parent
51e4f66b82
commit
fbe576e93a
@ -36,6 +36,7 @@ from .const import (
|
|||||||
ATTR_SEGMENT_ID,
|
ATTR_SEGMENT_ID,
|
||||||
ATTR_SPEED,
|
ATTR_SPEED,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
LOGGER,
|
||||||
SERVICE_EFFECT,
|
SERVICE_EFFECT,
|
||||||
SERVICE_PRESET,
|
SERVICE_PRESET,
|
||||||
)
|
)
|
||||||
@ -164,6 +165,13 @@ class WLEDMasterLight(WLEDEntity, LightEntity):
|
|||||||
preset: int,
|
preset: int,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set a WLED light to a saved preset."""
|
"""Set a WLED light to a saved preset."""
|
||||||
|
# The WLED preset service is replaced by a preset select entity
|
||||||
|
# and marked deprecated as of Home Assistant 2021.8
|
||||||
|
LOGGER.warning(
|
||||||
|
"The 'wled.preset' service is deprecated and replaced by a "
|
||||||
|
"dedicated preset select entity; Please use that entity to "
|
||||||
|
"change presets instead"
|
||||||
|
)
|
||||||
await self.coordinator.wled.preset(preset=preset)
|
await self.coordinator.wled.preset(preset=preset)
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,14 +34,13 @@ effect:
|
|||||||
max: 255
|
max: 255
|
||||||
reverse:
|
reverse:
|
||||||
name: Reverse effect
|
name: Reverse effect
|
||||||
description:
|
description: Reverse the effect. Either true to reverse or false otherwise.
|
||||||
Reverse the effect. Either true to reverse or false otherwise.
|
|
||||||
default: false
|
default: false
|
||||||
selector:
|
selector:
|
||||||
boolean:
|
boolean:
|
||||||
|
|
||||||
preset:
|
preset:
|
||||||
name: Set preset
|
name: Set preset (deprecated)
|
||||||
description: Set a preset for the WLED device.
|
description: Set a preset for the WLED device.
|
||||||
target:
|
target:
|
||||||
entity:
|
entity:
|
||||||
|
@ -566,7 +566,10 @@ async def test_effect_service_error(
|
|||||||
|
|
||||||
|
|
||||||
async def test_preset_service(
|
async def test_preset_service(
|
||||||
hass: HomeAssistant, init_integration: MockConfigEntry, mock_wled: MagicMock
|
hass: HomeAssistant,
|
||||||
|
init_integration: MockConfigEntry,
|
||||||
|
mock_wled: MagicMock,
|
||||||
|
caplog: pytest.LogCaptureFixture,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the preset service of a WLED light."""
|
"""Test the preset service of a WLED light."""
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
@ -595,6 +598,8 @@ async def test_preset_service(
|
|||||||
assert mock_wled.preset.call_count == 2
|
assert mock_wled.preset.call_count == 2
|
||||||
mock_wled.preset.assert_called_with(preset=2)
|
mock_wled.preset.assert_called_with(preset=2)
|
||||||
|
|
||||||
|
assert "The 'wled.preset' service is deprecated" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
async def test_preset_service_error(
|
async def test_preset_service_error(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user