From 2da37778af673b3df69fb72c91f93ae0bb1f16ff Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Tue, 26 Nov 2019 14:06:34 -0500 Subject: [PATCH] Update service domain for bluesound from 'media_player' to 'bluesound' (#29111) * move service constants to const.py, move services to bluesound domain * Remove bluesound services from media_player/services.yaml --- .coveragerc | 2 +- homeassistant/components/bluesound/const.py | 6 ++++ .../components/bluesound/media_player.py | 12 ++++--- .../components/bluesound/services.yaml | 30 ++++++++++++++++++ .../components/media_player/services.yaml | 31 ------------------- 5 files changed, 44 insertions(+), 37 deletions(-) create mode 100644 homeassistant/components/bluesound/const.py diff --git a/.coveragerc b/.coveragerc index 20be7adbd94..503cd5ad761 100644 --- a/.coveragerc +++ b/.coveragerc @@ -83,7 +83,7 @@ omit = homeassistant/components/blinkt/light.py homeassistant/components/blockchain/sensor.py homeassistant/components/bloomsky/* - homeassistant/components/bluesound/media_player.py + homeassistant/components/bluesound/* homeassistant/components/bluetooth_le_tracker/device_tracker.py homeassistant/components/bluetooth_tracker/device_tracker.py homeassistant/components/bme280/sensor.py diff --git a/homeassistant/components/bluesound/const.py b/homeassistant/components/bluesound/const.py new file mode 100644 index 00000000000..af1a8e5187c --- /dev/null +++ b/homeassistant/components/bluesound/const.py @@ -0,0 +1,6 @@ +"""Constants for the Bluesound HiFi wireless speakers and audio integrations component.""" +DOMAIN = "bluesound" +SERVICE_CLEAR_TIMER = "clear_sleep_timer" +SERVICE_JOIN = "join" +SERVICE_SET_TIMER = "set_sleep_timer" +SERVICE_UNJOIN = "unjoin" diff --git a/homeassistant/components/bluesound/media_player.py b/homeassistant/components/bluesound/media_player.py index 7b2719c1e4e..5a9f3561dc9 100644 --- a/homeassistant/components/bluesound/media_player.py +++ b/homeassistant/components/bluesound/media_player.py @@ -15,7 +15,6 @@ import xmltodict from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice from homeassistant.components.media_player.const import ( ATTR_MEDIA_ENQUEUE, - DOMAIN, MEDIA_TYPE_MUSIC, SUPPORT_CLEAR_PLAYLIST, SUPPORT_NEXT_TRACK, @@ -50,6 +49,13 @@ import homeassistant.helpers.config_validation as cv from homeassistant.helpers.event import async_track_time_interval from homeassistant.util import Throttle import homeassistant.util.dt as dt_util +from .const import ( + DOMAIN, + SERVICE_CLEAR_TIMER, + SERVICE_JOIN, + SERVICE_SET_TIMER, + SERVICE_UNJOIN, +) _LOGGER = logging.getLogger(__name__) @@ -62,10 +68,6 @@ DEFAULT_PORT = 11000 NODE_OFFLINE_CHECK_TIMEOUT = 180 NODE_RETRY_INITIATION = timedelta(minutes=3) -SERVICE_CLEAR_TIMER = "bluesound_clear_sleep_timer" -SERVICE_JOIN = "bluesound_join" -SERVICE_SET_TIMER = "bluesound_set_sleep_timer" -SERVICE_UNJOIN = "bluesound_unjoin" STATE_GROUPED = "grouped" SYNC_STATUS_INTERVAL = timedelta(minutes=5) diff --git a/homeassistant/components/bluesound/services.yaml b/homeassistant/components/bluesound/services.yaml index e69de29bb2d..6c85c77e961 100644 --- a/homeassistant/components/bluesound/services.yaml +++ b/homeassistant/components/bluesound/services.yaml @@ -0,0 +1,30 @@ +join: + description: Group player together. + fields: + master: + description: Entity ID of the player that should become the master of the group. + example: 'media_player.bluesound_livingroom' + entity_id: + description: Name(s) of entities that will coordinate the grouping. Platform dependent. + example: 'media_player.bluesound_livingroom' + +unjoin: + description: Unjoin the player from a group. + fields: + entity_id: + description: Name(s) of entities that will be unjoined from their group. Platform dependent. + example: 'media_player.bluesound_livingroom' + +set_sleep_timer: + description: "Set a Bluesound timer. It will increase timer in steps: 15, 30, 45, 60, 90, 0" + fields: + entity_id: + description: Name(s) of entities that will have a timer set. + example: 'media_player.bluesound_livingroom' + +clear_sleep_timer: + description: Clear a Bluesound timer. + fields: + entity_id: + description: Name(s) of entities that will have the timer cleared. + example: 'media_player.bluesound_livingroom' \ No newline at end of file diff --git a/homeassistant/components/media_player/services.yaml b/homeassistant/components/media_player/services.yaml index 92aafda81cb..da229ada65c 100644 --- a/homeassistant/components/media_player/services.yaml +++ b/homeassistant/components/media_player/services.yaml @@ -244,37 +244,6 @@ yamaha_enable_output: description: Boolean indicating if port should be enabled or not. example: true -bluesound_join: - description: Group player together. - fields: - master: - description: Entity ID of the player that should become the master of the group. - example: 'media_player.bluesound_livingroom' - entity_id: - description: Name(s) of entities that will coordinate the grouping. Platform dependent. - example: 'media_player.bluesound_livingroom' - -bluesound_unjoin: - description: Unjoin the player from a group. - fields: - entity_id: - description: Name(s) of entities that will be unjoined from their group. Platform dependent. - example: 'media_player.bluesound_livingroom' - -bluesound_set_sleep_timer: - description: "Set a Bluesound timer. It will increase timer in steps: 15, 30, 45, 60, 90, 0" - fields: - entity_id: - description: Name(s) of entities that will have a timer set. - example: 'media_player.bluesound_livingroom' - -bluesound_clear_sleep_timer: - description: Clear a Bluesound timer. - fields: - entity_id: - description: Name(s) of entities that will have the timer cleared. - example: 'media_player.bluesound_livingroom' - songpal_set_sound_setting: description: Change sound setting. -- GitLab