move service constants to const.py, move custom services to monoprice domain (#29099)

pull/29113/head^2
Raman Gupta 2019-11-26 13:07:29 -05:00 committed by Paulus Schoutsen
parent c1163283ff
commit 499838d5a7
5 changed files with 24 additions and 21 deletions

View File

@ -107,20 +107,6 @@ media_seek:
description: Position to seek to. The format is platform dependent.
example: 100
monoprice_snapshot:
description: Take a snapshot of the media player zone.
fields:
entity_id:
description: Name(s) of entities that will be snapshot. Platform dependent.
example: 'media_player.living_room'
monoprice_restore:
description: Restore a snapshot of the media player zone.
fields:
entity_id:
description: Name(s) of entities that will be restored. Platform dependent.
example: 'media_player.living_room'
play_media:
description: Send the media player the command for playing media.
fields:

View File

@ -0,0 +1,5 @@
"""Constants for the Monoprice 6-Zone Amplifier Media Player component."""
DOMAIN = "monoprice"
SERVICE_SNAPSHOT = "snapshot"
SERVICE_RESTORE = "restore"

View File

@ -5,7 +5,6 @@ import voluptuous as vol
from homeassistant.components.media_player import MediaPlayerDevice, PLATFORM_SCHEMA
from homeassistant.components.media_player.const import (
DOMAIN,
SUPPORT_SELECT_SOURCE,
SUPPORT_TURN_OFF,
SUPPORT_TURN_ON,
@ -21,6 +20,7 @@ from homeassistant.const import (
STATE_ON,
)
import homeassistant.helpers.config_validation as cv
from .const import DOMAIN, SERVICE_RESTORE, SERVICE_SNAPSHOT
_LOGGER = logging.getLogger(__name__)
@ -42,9 +42,6 @@ CONF_SOURCES = "sources"
DATA_MONOPRICE = "monoprice"
SERVICE_SNAPSHOT = "snapshot"
SERVICE_RESTORE = "restore"
# Valid zone ids: 11-16 or 21-26 or 31-36
ZONE_IDS = vol.All(
vol.Coerce(int),

View File

@ -0,0 +1,13 @@
snapshot:
description: Take a snapshot of the media player zone.
fields:
entity_id:
description: Name(s) of entities that will be snapshot. Platform dependent.
example: 'media_player.living_room'
restore:
description: Restore a snapshot of the media player zone.
fields:
entity_id:
description: Name(s) of entities that will be restored. Platform dependent.
example: 'media_player.living_room'

View File

@ -5,7 +5,6 @@ import voluptuous as vol
from collections import defaultdict
from homeassistant.components.media_player.const import (
DOMAIN,
SUPPORT_TURN_ON,
SUPPORT_TURN_OFF,
SUPPORT_VOLUME_MUTE,
@ -19,10 +18,13 @@ import tests.common
from homeassistant.components.monoprice.media_player import (
DATA_MONOPRICE,
PLATFORM_SCHEMA,
SERVICE_SNAPSHOT,
SERVICE_RESTORE,
setup_platform,
)
from homeassistant.components.monoprice.const import (
DOMAIN,
SERVICE_RESTORE,
SERVICE_SNAPSHOT,
)
import pytest