mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 07:05:48 +01:00
Remove bluesound sleep timer service (#161120)
This commit is contained in:
committed by
GitHub
parent
18bda2dbbe
commit
825da95550
@@ -13,14 +13,7 @@ from homeassistant.helpers import config_validation as cv, service
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import (
|
||||
ATTR_MASTER,
|
||||
DOMAIN,
|
||||
SERVICE_CLEAR_TIMER,
|
||||
SERVICE_JOIN,
|
||||
SERVICE_SET_TIMER,
|
||||
SERVICE_UNJOIN,
|
||||
)
|
||||
from .const import ATTR_MASTER, DOMAIN, SERVICE_JOIN, SERVICE_UNJOIN
|
||||
from .coordinator import (
|
||||
BluesoundConfigEntry,
|
||||
BluesoundCoordinator,
|
||||
@@ -37,22 +30,6 @@ PLATFORMS = [
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Bluesound."""
|
||||
service.async_register_platform_entity_service(
|
||||
hass,
|
||||
DOMAIN,
|
||||
SERVICE_SET_TIMER,
|
||||
entity_domain=MEDIA_PLAYER_DOMAIN,
|
||||
schema=None,
|
||||
func="async_increase_timer",
|
||||
)
|
||||
service.async_register_platform_entity_service(
|
||||
hass,
|
||||
DOMAIN,
|
||||
SERVICE_CLEAR_TIMER,
|
||||
entity_domain=MEDIA_PLAYER_DOMAIN,
|
||||
schema=None,
|
||||
func="async_clear_timer",
|
||||
)
|
||||
service.async_register_platform_entity_service(
|
||||
hass,
|
||||
DOMAIN,
|
||||
|
||||
@@ -5,7 +5,5 @@ INTEGRATION_TITLE = "Bluesound"
|
||||
ATTR_BLUESOUND_GROUP = "bluesound_group"
|
||||
ATTR_MASTER = "master"
|
||||
|
||||
SERVICE_CLEAR_TIMER = "clear_sleep_timer"
|
||||
SERVICE_JOIN = "join"
|
||||
SERVICE_SET_TIMER = "set_sleep_timer"
|
||||
SERVICE_UNJOIN = "unjoin"
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
{
|
||||
"services": {
|
||||
"clear_sleep_timer": {
|
||||
"service": "mdi:sleep-off"
|
||||
},
|
||||
"join": {
|
||||
"service": "mdi:link-variant"
|
||||
},
|
||||
"set_sleep_timer": {
|
||||
"service": "mdi:sleep"
|
||||
},
|
||||
"unjoin": {
|
||||
"service": "mdi:link-variant-off"
|
||||
}
|
||||
|
||||
@@ -39,9 +39,7 @@ from .const import (
|
||||
ATTR_BLUESOUND_GROUP,
|
||||
ATTR_MASTER,
|
||||
DOMAIN,
|
||||
SERVICE_CLEAR_TIMER,
|
||||
SERVICE_JOIN,
|
||||
SERVICE_SET_TIMER,
|
||||
SERVICE_UNJOIN,
|
||||
)
|
||||
from .coordinator import BluesoundCoordinator
|
||||
@@ -603,42 +601,6 @@ class BluesoundPlayer(CoordinatorEntity[BluesoundCoordinator], MediaPlayerEntity
|
||||
"""Remove follower to leader."""
|
||||
await self._player.remove_follower(host, port)
|
||||
|
||||
async def async_increase_timer(self) -> int:
|
||||
"""Increase sleep time on player."""
|
||||
ir.async_create_issue(
|
||||
self.hass,
|
||||
DOMAIN,
|
||||
f"deprecated_service_{SERVICE_SET_TIMER}",
|
||||
is_fixable=False,
|
||||
breaks_in_ha_version="2025.12.0",
|
||||
issue_domain=DOMAIN,
|
||||
severity=ir.IssueSeverity.WARNING,
|
||||
translation_key="deprecated_service_set_sleep_timer",
|
||||
translation_placeholders={
|
||||
"name": slugify(self.sync_status.name),
|
||||
},
|
||||
)
|
||||
return await self._player.sleep_timer()
|
||||
|
||||
async def async_clear_timer(self) -> None:
|
||||
"""Clear sleep timer on player."""
|
||||
ir.async_create_issue(
|
||||
self.hass,
|
||||
DOMAIN,
|
||||
f"deprecated_service_{SERVICE_CLEAR_TIMER}",
|
||||
is_fixable=False,
|
||||
breaks_in_ha_version="2025.12.0",
|
||||
issue_domain=DOMAIN,
|
||||
severity=ir.IssueSeverity.WARNING,
|
||||
translation_key="deprecated_service_clear_sleep_timer",
|
||||
translation_placeholders={
|
||||
"name": slugify(self.sync_status.name),
|
||||
},
|
||||
)
|
||||
sleep = 1
|
||||
while sleep > 0:
|
||||
sleep = await self._player.sleep_timer()
|
||||
|
||||
async def async_set_shuffle(self, shuffle: bool) -> None:
|
||||
"""Enable or disable shuffle mode."""
|
||||
await self._player.shuffle(shuffle)
|
||||
|
||||
@@ -19,19 +19,3 @@ unjoin:
|
||||
entity:
|
||||
integration: bluesound
|
||||
domain: media_player
|
||||
|
||||
set_sleep_timer:
|
||||
fields:
|
||||
entity_id:
|
||||
selector:
|
||||
entity:
|
||||
integration: bluesound
|
||||
domain: media_player
|
||||
|
||||
clear_sleep_timer:
|
||||
fields:
|
||||
entity_id:
|
||||
selector:
|
||||
entity:
|
||||
integration: bluesound
|
||||
domain: media_player
|
||||
|
||||
@@ -37,34 +37,16 @@
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_service_clear_sleep_timer": {
|
||||
"description": "Use `button.{name}_clear_sleep_timer` instead.\n\nPlease replace this action and adjust your automations and scripts.",
|
||||
"title": "Detected use of deprecated action bluesound.clear_sleep_timer"
|
||||
},
|
||||
"deprecated_service_join": {
|
||||
"description": "Use the `media_player.join` action instead.\n\nPlease replace this action and adjust your automations and scripts.",
|
||||
"title": "Detected use of deprecated action bluesound.join"
|
||||
},
|
||||
"deprecated_service_set_sleep_timer": {
|
||||
"description": "Use `button.{name}_set_sleep_timer` instead.\n\nPlease replace this action and adjust your automations and scripts.",
|
||||
"title": "Detected use of deprecated action bluesound.set_sleep_timer"
|
||||
},
|
||||
"deprecated_service_unjoin": {
|
||||
"description": "Use the `media_player.unjoin` action instead.\n\nPlease replace this action and adjust your automations and scripts.",
|
||||
"title": "Detected use of deprecated action bluesound.unjoin"
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"clear_sleep_timer": {
|
||||
"description": "Clears a Bluesound timer.",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Name(s) of entities that will have the timer cleared.",
|
||||
"name": "Entity"
|
||||
}
|
||||
},
|
||||
"name": "Clear sleep timer"
|
||||
},
|
||||
"join": {
|
||||
"description": "Groups players together under a single master speaker.",
|
||||
"fields": {
|
||||
@@ -79,16 +61,6 @@
|
||||
},
|
||||
"name": "Join"
|
||||
},
|
||||
"set_sleep_timer": {
|
||||
"description": "Sets a Bluesound timer that will turn off the speaker. It will increase in steps: 15, 30, 45, 60, 90, 0.",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Name(s) of entities that will have a timer set.",
|
||||
"name": "Entity"
|
||||
}
|
||||
},
|
||||
"name": "Set sleep timer"
|
||||
},
|
||||
"unjoin": {
|
||||
"description": "Separates a player from a group.",
|
||||
"fields": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Tests for the Bluesound Media Player platform."""
|
||||
|
||||
import dataclasses
|
||||
from unittest.mock import call
|
||||
|
||||
from pyblu import PairedPlayer
|
||||
from pyblu.errors import PlayerUnreachableError
|
||||
@@ -11,10 +10,6 @@ from syrupy.filters import props
|
||||
|
||||
from homeassistant.components.bluesound import DOMAIN
|
||||
from homeassistant.components.bluesound.const import ATTR_MASTER
|
||||
from homeassistant.components.bluesound.media_player import (
|
||||
SERVICE_CLEAR_TIMER,
|
||||
SERVICE_SET_TIMER,
|
||||
)
|
||||
from homeassistant.components.media_player import (
|
||||
ATTR_GROUP_MEMBERS,
|
||||
ATTR_INPUT_SOURCE,
|
||||
@@ -240,37 +235,6 @@ async def test_unavailable_when_offline(
|
||||
assert post_state.state == STATE_UNAVAILABLE
|
||||
|
||||
|
||||
async def test_set_sleep_timer(
|
||||
hass: HomeAssistant, setup_config_entry: None, player_mocks: PlayerMocks
|
||||
) -> None:
|
||||
"""Test the set sleep timer action."""
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_TIMER,
|
||||
{ATTR_ENTITY_ID: "media_player.player_name1111"},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
player_mocks.player_data.player.sleep_timer.assert_called_once()
|
||||
|
||||
|
||||
async def test_clear_sleep_timer(
|
||||
hass: HomeAssistant, setup_config_entry: None, player_mocks: PlayerMocks
|
||||
) -> None:
|
||||
"""Test the clear sleep timer action."""
|
||||
|
||||
player_mocks.player_data.player.sleep_timer.side_effect = [15, 30, 45, 60, 90, 0]
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_CLEAR_TIMER,
|
||||
{ATTR_ENTITY_ID: "media_player.player_name1111"},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
player_mocks.player_data.player.sleep_timer.assert_has_calls([call()] * 6)
|
||||
|
||||
|
||||
async def test_join_cannot_join_to_self(
|
||||
hass: HomeAssistant, setup_config_entry: None, player_mocks: PlayerMocks
|
||||
) -> None:
|
||||
|
||||
Reference in New Issue
Block a user