コード例 #1
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
    | SUPPORT_VOLUME_MUTE
    | SUPPORT_TURN_ON
    | SUPPORT_TURN_OFF
    | SUPPORT_SELECT_SOURCE
)
SUPPORT_MEDIA_MODES = (
    SUPPORT_PAUSE
    | SUPPORT_STOP
    | SUPPORT_PREVIOUS_TRACK
    | SUPPORT_NEXT_TRACK
    | SUPPORT_PLAY
)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Required(CONF_HOST): cv.string,
        vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
    }
)

NORMAL_INPUTS = {
    "Cd": "CD",
    "Dvd": "DVD",
    "Blue ray": "BD",
    "TV": "TV",
    "Satellite / Cable": "SAT/CBL",
    "Game": "GAME",
    "Game2": "GAME2",
    "Video Aux": "V.AUX",
    "Dock": "DOCK",
}
コード例 #2
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
BLACKBIRD_SETALLZONES_SCHEMA = MEDIA_PLAYER_SCHEMA.extend(
    {vol.Required(ATTR_SOURCE): cv.string})

# Valid zone ids: 1-8
ZONE_IDS = vol.All(vol.Coerce(int), vol.Range(min=1, max=8))

# Valid source ids: 1-8
SOURCE_IDS = vol.All(vol.Coerce(int), vol.Range(min=1, max=8))

PLATFORM_SCHEMA = vol.All(
    cv.has_at_least_one_key(CONF_PORT, CONF_HOST),
    PLATFORM_SCHEMA.extend({
        vol.Exclusive(CONF_PORT, CONF_TYPE):
        cv.string,
        vol.Exclusive(CONF_HOST, CONF_TYPE):
        cv.string,
        vol.Required(CONF_ZONES):
        vol.Schema({ZONE_IDS: ZONE_SCHEMA}),
        vol.Required(CONF_SOURCES):
        vol.Schema({SOURCE_IDS: SOURCE_SCHEMA}),
    }),
)


def setup_platform(opp, config, add_entities, discovery_info=None):
    """Set up the Monoprice Blackbird 4k 8x8 HDBaseT Matrix platform."""
    if DATA_BLACKBIRD not in opp.data:
        opp.data[DATA_BLACKBIRD] = {}

    port = config.get(CONF_PORT)
    host = config.get(CONF_HOST)
コード例 #3
0
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_HOST):
    cv.string,
    vol.Optional(CONF_DEVICE_CLASS, default=DEFAULT_DEVICE_CLASS):
    vol.In(DEVICE_CLASSES),
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
    vol.Optional(CONF_PORT, default=DEFAULT_PORT):
    cv.port,
    vol.Optional(CONF_ADBKEY):
    cv.isfile,
    vol.Optional(CONF_ADB_SERVER_IP):
    cv.string,
    vol.Optional(CONF_ADB_SERVER_PORT, default=DEFAULT_ADB_SERVER_PORT):
    cv.port,
    vol.Optional(CONF_GET_SOURCES, default=DEFAULT_GET_SOURCES):
    cv.boolean,
    vol.Optional(CONF_APPS, default={}):
    vol.Schema({cv.string: vol.Any(cv.string, None)}),
    vol.Optional(CONF_TURN_ON_COMMAND):
    cv.string,
    vol.Optional(CONF_TURN_OFF_COMMAND):
    cv.string,
    vol.Optional(CONF_STATE_DETECTION_RULES, default={}):
    vol.Schema({cv.string: ha_state_detection_rules_validator(vol.Invalid)}),
    vol.Optional(CONF_EXCLUDE_UNNAMED_APPS, default=False):
    cv.boolean,
    vol.Optional(CONF_SCREENCAP, default=DEFAULT_SCREENCAP):
    cv.boolean,
})
コード例 #4
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
NODE_RETRY_INITIATION = timedelta(minutes=3)

STATE_GROUPED = "grouped"
SYNC_STATUS_INTERVAL = timedelta(minutes=5)

UPDATE_CAPTURE_INTERVAL = timedelta(minutes=30)
UPDATE_PRESETS_INTERVAL = timedelta(minutes=30)
UPDATE_SERVICES_INTERVAL = timedelta(minutes=30)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Optional(CONF_HOSTS): vol.All(
            cv.ensure_list,
            [
                {
                    vol.Required(CONF_HOST): cv.string,
                    vol.Optional(CONF_NAME): cv.string,
                    vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
                }
            ],
        )
    }
)

BS_SCHEMA = vol.Schema({vol.Optional(ATTR_ENTITY_ID): cv.entity_ids})

BS_JOIN_SCHEMA = BS_SCHEMA.extend({vol.Required(ATTR_MASTER): cv.entity_id})

SERVICE_TO_METHOD = {
    SERVICE_JOIN: {"method": "async_join", "schema": BS_JOIN_SCHEMA},
    SERVICE_UNJOIN: {"method": "async_unjoin", "schema": BS_SCHEMA},
    SERVICE_SET_TIMER: {"method": "async_increase_timer", "schema": BS_SCHEMA},
コード例 #5
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
    STATE_PLAYING,
)
from openpeerpower.core import OpenPeerPower
import openpeerpower.helpers.config_validation as cv
from openpeerpower.helpers.entity import DeviceInfo
from openpeerpower.helpers.entity_platform import AddEntitiesCallback
from openpeerpower.helpers.typing import ConfigType, DiscoveryInfoType, StateType

from .const import ATTR_MANUFACTURER, DEFAULT_NAME, DOMAIN

CONF_SOURCES: Final = "sources"

PLATFORM_SCHEMA: Final = PARENT_PLATFORM_SCHEMA.extend({
    vol.Required(CONF_HOST):
    cv.string,
    vol.Optional(CONF_SOURCES):
    vol.Schema({cv.string: cv.string}),
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
})

DUNEHD_PLAYER_SUPPORT: Final[int] = (SUPPORT_PAUSE
                                     | SUPPORT_TURN_ON
                                     | SUPPORT_TURN_OFF
                                     | SUPPORT_PREVIOUS_TRACK
                                     | SUPPORT_NEXT_TRACK
                                     | SUPPORT_PLAY)


async def async_setup_platform(
    opp: OpenPeerPower,
    config: ConfigType,
コード例 #6
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
                      | SUPPORT_STOP)

CONF_ON_ACTION = "turn_on_action"

DEFAULT_API_VERSION = 1

PLATFORM_SCHEMA = vol.All(
    cv.deprecated(CONF_HOST),
    cv.deprecated(CONF_NAME),
    cv.deprecated(CONF_API_VERSION),
    cv.deprecated(CONF_ON_ACTION),
    PLATFORM_SCHEMA.extend({
        vol.Required(CONF_HOST):
        cv.string,
        vol.Remove(CONF_NAME):
        cv.string,
        vol.Optional(CONF_API_VERSION, default=DEFAULT_API_VERSION):
        vol.Coerce(int),
        vol.Remove(CONF_ON_ACTION):
        cv.SCRIPT_SCHEMA,
    }),
)


def _inverted(data):
    return {v: k for k, v in data.items()}


async def async_setup_platform(opp,
                               config,
                               async_add_entities,
                               discovery_info=None):
コード例 #7
0
    SERVICE_JOIN,
    SERVICE_RESTORE,
    SERVICE_SET_LATENCY,
    SERVICE_SNAPSHOT,
    SERVICE_UNJOIN,
)

_LOGGER = logging.getLogger(__name__)

SUPPORT_SNAPCAST_CLIENT = (SUPPORT_VOLUME_MUTE | SUPPORT_VOLUME_SET
                           | SUPPORT_SELECT_SOURCE)
SUPPORT_SNAPCAST_GROUP = (SUPPORT_VOLUME_MUTE | SUPPORT_VOLUME_SET
                          | SUPPORT_SELECT_SOURCE)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_HOST): cv.string,
    vol.Optional(CONF_PORT): cv.port
})


async def async_setup_platform(opp,
                               config,
                               async_add_entities,
                               discovery_info=None):
    """Set up the Snapcast platform."""

    host = config.get(CONF_HOST)
    port = config.get(CONF_PORT, CONTROL_PORT)

    platform = entity_platform.async_get_current_platform()
    platform.async_register_entity_service(SERVICE_SNAPSHOT, {}, "snapshot")
    platform.async_register_entity_service(SERVICE_RESTORE, {},
コード例 #8
0
DLNA_DMR_DATA = "dlna_dmr"

DEFAULT_NAME = "DLNA Digital Media Renderer"
DEFAULT_LISTEN_PORT = 8301

CONF_LISTEN_IP = "listen_ip"
CONF_LISTEN_PORT = "listen_port"
CONF_CALLBACK_URL_OVERRIDE = "callback_url_override"

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_URL):
    cv.string,
    vol.Optional(CONF_LISTEN_IP):
    cv.string,
    vol.Optional(CONF_LISTEN_PORT, default=DEFAULT_LISTEN_PORT):
    cv.port,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
    vol.Optional(CONF_CALLBACK_URL_OVERRIDE):
    cv.url,
})


def catch_request_errors():
    """Catch asyncio.TimeoutError, aiohttp.ClientError errors."""
    def call_wrapper(func):
        """Call wrapper for decorator."""
        @functools.wraps(func)
        async def wrapper(self, *args, **kwargs):
            """Catch asyncio.TimeoutError, aiohttp.ClientError errors."""
            try:
コード例 #9
0
SERVICE_SUB_DB = "set_sub_db"
SERVICE_UPDATE_DSP = "update_dsp"

DSP_SCAN_INTERVAL = timedelta(seconds=3600)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_HOST):
    cv.string,
    vol.Required(CONF_TYPE):
    vol.In(["LS50", "LSX"]),
    vol.Optional(CONF_PORT, default=DEFAULT_PORT):
    cv.port,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
    vol.Optional(CONF_MAX_VOLUME, default=DEFAULT_MAX_VOLUME):
    cv.small_float,
    vol.Optional(CONF_VOLUME_STEP, default=DEFAULT_VOLUME_STEP):
    cv.small_float,
    vol.Optional(CONF_INVERSE_SPEAKER_MODE,
                 default=DEFAULT_INVERSE_SPEAKER_MODE):
    cv.boolean,
    vol.Optional(CONF_SUPPORTS_ON, default=DEFAULT_SUPPORTS_ON):
    cv.boolean,
    vol.Optional(CONF_STANDBY_TIME):
    vol.In([20, 60]),
})


def get_ip_mode(host):
    """Get the 'mode' used to retrieve the MAC address."""
    try:
コード例 #10
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
    "video4": "Video 4",
    "video5": "Video 5",
    "video6": "Video 6",
    "video7": "Video 7",
    "fm": "Radio",
}

DEFAULT_PLAYABLE_SOURCES = ("fm", "am", "tuner")

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Optional(CONF_HOST): cv.string,
        vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
        vol.Optional(CONF_MAX_VOLUME, default=SUPPORTED_MAX_VOLUME): vol.All(
            vol.Coerce(int), vol.Range(min=1, max=100)
        ),
        vol.Optional(
            CONF_RECEIVER_MAX_VOLUME, default=DEFAULT_RECEIVER_MAX_VOLUME
        ): cv.positive_int,
        vol.Optional(CONF_SOURCES, default=DEFAULT_SOURCES): {cv.string: cv.string},
    }
)

TIMEOUT_MESSAGE = "Timeout waiting for response."


ATTR_HDMI_OUTPUT = "hdmi_output"
ATTR_PRESET = "preset"
ATTR_AUDIO_INFORMATION = "audio_information"
ATTR_VIDEO_INFORMATION = "video_information"
ATTR_VIDEO_OUT = "video_out"
コード例 #11
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
SUPPORT_UE_SMART_RADIO = (
    SUPPORT_PLAY
    | SUPPORT_PAUSE
    | SUPPORT_STOP
    | SUPPORT_PREVIOUS_TRACK
    | SUPPORT_NEXT_TRACK
    | SUPPORT_TURN_ON
    | SUPPORT_TURN_OFF
    | SUPPORT_VOLUME_SET
    | SUPPORT_VOLUME_MUTE
)

PLAYBACK_DICT = {"play": STATE_PLAYING, "pause": STATE_PAUSED, "stop": STATE_IDLE}

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {vol.Required(CONF_USERNAME): cv.string, vol.Required(CONF_PASSWORD): cv.string}
)


def send_request(payload, session):
    """Send request to radio."""
    try:
        request = requests.post(
            URL,
            cookies={"sdi_squeezenetwork_session": session},
            json=payload,
            timeout=5,
        )
    except requests.exceptions.Timeout:
        _LOGGER.error("Timed out when sending request")
    except requests.exceptions.ConnectionError:
コード例 #12
0
SUPPORT_MEDIAROOM = (SUPPORT_PAUSE
                     | SUPPORT_TURN_ON
                     | SUPPORT_TURN_OFF
                     | SUPPORT_VOLUME_STEP
                     | SUPPORT_VOLUME_MUTE
                     | SUPPORT_PLAY_MEDIA
                     | SUPPORT_STOP
                     | SUPPORT_NEXT_TRACK
                     | SUPPORT_PREVIOUS_TRACK
                     | SUPPORT_PLAY)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_HOST):
    cv.string,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
    vol.Optional(CONF_OPTIMISTIC, default=False):
    cv.boolean,
    vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT):
    cv.positive_int,
})


async def async_setup_platform(opp,
                               config,
                               async_add_entities,
                               discovery_info=None):
    """Set up the Mediaroom platform."""
    known_hosts = opp.data.get(DATA_MEDIAROOM)
    if known_hosts is None:
        known_hosts = opp.data[DATA_MEDIAROOM] = []
    host = config.get(CONF_HOST)
コード例 #13
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
import openpeerpower.helpers.config_validation as cv

_LOGGER = logging.getLogger(__name__)

CONF_PIPELINE = "pipeline"

DOMAIN = "gstreamer"

SUPPORT_GSTREAMER = (SUPPORT_VOLUME_SET
                     | SUPPORT_PLAY
                     | SUPPORT_PAUSE
                     | SUPPORT_PLAY_MEDIA
                     | SUPPORT_NEXT_TRACK)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_NAME): cv.string,
    vol.Optional(CONF_PIPELINE): cv.string
})


def setup_platform(opp, config, add_entities, discovery_info=None):
    """Set up the Gstreamer platform."""

    name = config.get(CONF_NAME)
    pipeline = config.get(CONF_PIPELINE)
    player = GstreamerPlayer(pipeline)

    def _shutdown(call):
        """Quit the player on shutdown."""
        player.quit()

    opp.bus.listen_once(EVENT_OPENPEERPOWER_STOP, _shutdown)
コード例 #14
0
SUPPORT_CMUS = (
    SUPPORT_PAUSE
    | SUPPORT_VOLUME_SET
    | SUPPORT_TURN_OFF
    | SUPPORT_TURN_ON
    | SUPPORT_PREVIOUS_TRACK
    | SUPPORT_NEXT_TRACK
    | SUPPORT_PLAY_MEDIA
    | SUPPORT_SEEK
    | SUPPORT_PLAY
)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Inclusive(CONF_HOST, "remote"): cv.string,
        vol.Inclusive(CONF_PASSWORD, "remote"): cv.string,
        vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
        vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
    }
)


def setup_platform(opp, config, add_entities, discover_info=None):
    """Set up the CMUS platform."""

    host = config.get(CONF_HOST)
    password = config.get(CONF_PASSWORD)
    port = config[CONF_PORT]
    name = config[CONF_NAME]

    cmus_remote = CmusRemote(server=host, port=port, password=password)
    cmus_remote.connect()
コード例 #15
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
    STATE_OFF,
    STATE_ON,
)
from openpeerpower.core import callback
import openpeerpower.helpers.config_validation as cv

SUPPORT_RUSSOUND = (SUPPORT_VOLUME_MUTE
                    | SUPPORT_VOLUME_SET
                    | SUPPORT_TURN_ON
                    | SUPPORT_TURN_OFF
                    | SUPPORT_SELECT_SOURCE)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_HOST):
    cv.string,
    vol.Required(CONF_NAME):
    cv.string,
    vol.Optional(CONF_PORT, default=9621):
    cv.port,
})


async def async_setup_platform(opp,
                               config,
                               async_add_entities,
                               discovery_info=None):
    """Set up the Russound RIO platform."""

    host = config.get(CONF_HOST)
    port = config.get(CONF_PORT)

    russ = Russound(opp.loop, host, port)
コード例 #16
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
    | SUPPORT_TURN_OFF
    | SUPPORT_VOLUME_SET
    | SUPPORT_VOLUME_MUTE
    | SUPPORT_SELECT_SOURCE
)

KNOWN_HOSTS_KEY = "data_yamaha_musiccast"
INTERVAL_SECONDS = "interval_seconds"

DEFAULT_PORT = 5005
DEFAULT_INTERVAL = 480

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Required(CONF_HOST): cv.string,
        vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
        vol.Optional(INTERVAL_SECONDS, default=DEFAULT_INTERVAL): cv.positive_int,
    }
)


def setup_platform(opp, config, add_entities, discovery_info=None):
    """Set up the Yamaha MusicCast platform."""

    known_hosts = opp.data.get(KNOWN_HOSTS_KEY)
    if known_hosts is None:
        known_hosts = opp.data[KNOWN_HOSTS_KEY] = []
    _LOGGER.debug("known_hosts: %s", known_hosts)

    host = config.get(CONF_HOST)
    port = config.get(CONF_PORT)
コード例 #17
0
SCAN_INTERVAL = timedelta(seconds=5)

SUPPORT_CLEMENTINE = (
    SUPPORT_PAUSE
    | SUPPORT_VOLUME_STEP
    | SUPPORT_PREVIOUS_TRACK
    | SUPPORT_VOLUME_SET
    | SUPPORT_NEXT_TRACK
    | SUPPORT_SELECT_SOURCE
    | SUPPORT_PLAY
)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Required(CONF_HOST): cv.string,
        vol.Optional(CONF_ACCESS_TOKEN): cv.positive_int,
        vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
        vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
    }
)


def setup_platform(opp, config, add_entities, discovery_info=None):
    """Set up the Clementine platform."""

    host = config[CONF_HOST]
    port = config[CONF_PORT]
    token = config.get(CONF_ACCESS_TOKEN)

    client = ClementineRemote(host, port, token, reconnect=True)

    add_entities([ClementineDevice(client, config[CONF_NAME])])
コード例 #18
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
CONF_MAX_VOLUME = "max_volume"
CONF_VOLUME_STEP = "volume_step"  # for NADReceiverTCP
CONF_SOURCE_DICT = "sources"  # for NADReceiver

SOURCE_DICT_SCHEMA = vol.Schema({vol.Range(min=1, max=10): cv.string})

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_TYPE, default=DEFAULT_TYPE):
    vol.In(["RS232", "Telnet", "TCP"]),
    vol.Optional(CONF_SERIAL_PORT, default=DEFAULT_SERIAL_PORT):
    cv.string,
    vol.Optional(CONF_HOST):
    cv.string,
    vol.Optional(CONF_PORT, default=DEFAULT_PORT):
    int,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
    vol.Optional(CONF_MIN_VOLUME, default=DEFAULT_MIN_VOLUME):
    int,
    vol.Optional(CONF_MAX_VOLUME, default=DEFAULT_MAX_VOLUME):
    int,
    vol.Optional(CONF_SOURCE_DICT, default={}):
    SOURCE_DICT_SCHEMA,
    vol.Optional(CONF_VOLUME_STEP, default=DEFAULT_VOLUME_STEP):
    int,
})


def setup_platform(opp, config, add_entities, discovery_info=None):
    """Set up the NAD platform."""
    if config.get(CONF_TYPE) in ("RS232", "Telnet"):
        add_entities(
コード例 #19
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
                 | SUPPORT_PREVIOUS_TRACK
                 | SUPPORT_NEXT_TRACK
                 | SUPPORT_SEEK
                 | SUPPORT_VOLUME_SET
                 | SUPPORT_PLAY)

PLAYBACK_DICT = {
    "0": STATE_PAUSED,
    "1": STATE_PAUSED,
    "2": STATE_PLAYING
}  # Stopped

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_HOST, default=DEFAULT_HOST):
    cv.string,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
    vol.Optional(CONF_PORT, default=DEFAULT_PORT):
    cv.port,
})


def request_configuration(opp, config, url, add_entities_callback):
    """Request configuration steps from the user."""
    configurator = opp.components.configurator
    if "gpmdp" in _CONFIGURING:
        configurator.notify_errors(_CONFIGURING["gpmdp"],
                                   "Failed to register, please try again.")

        return
    websocket = create_connection((url), timeout=1)
    websocket.send(
コード例 #20
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
SUPPORT_YAMAHA = (SUPPORT_VOLUME_SET
                  | SUPPORT_VOLUME_MUTE
                  | SUPPORT_TURN_ON
                  | SUPPORT_TURN_OFF
                  | SUPPORT_SELECT_SOURCE
                  | SUPPORT_PLAY
                  | SUPPORT_SELECT_SOUND_MODE)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
    vol.Optional(CONF_HOST):
    cv.string,
    vol.Optional(CONF_SOURCE_IGNORE, default=[]):
    vol.All(cv.ensure_list, [cv.string]),
    vol.Optional(CONF_ZONE_IGNORE, default=[]):
    vol.All(cv.ensure_list, [cv.string]),
    vol.Optional(CONF_SOURCE_NAMES, default={}): {
        cv.string: cv.string
    },
    vol.Optional(CONF_ZONE_NAMES, default={}): {
        cv.string: cv.string
    },
})


class YamahaConfigInfo:
    """Configuration Info for Yamaha Receivers."""
    def __init__(self, config: None, discovery_info: None) -> None:
        """Initialize the Configuration Info for Yamaha Receiver."""
        self.name = config.get(CONF_NAME)
        self.host = config.get(CONF_HOST)
コード例 #21
0
                   | SUPPORT_VOLUME_MUTE
                   | SUPPORT_TURN_ON
                   | SUPPORT_TURN_OFF
                   | SUPPORT_SELECT_SOURCE
                   | SUPPORT_PLAY)

MAX_VOLUME = 185
MAX_SOURCE_NUMBERS = 60

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_HOST):
    cv.string,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
    vol.Optional(CONF_PORT, default=DEFAULT_PORT):
    cv.port,
    vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT):
    cv.socket_timeout,
    vol.Optional(CONF_SOURCES, default=DEFAULT_SOURCES): {
        cv.string: cv.string
    },
})


def setup_platform(opp, config, add_entities, discovery_info=None):
    """Set up the Pioneer platform."""
    pioneer = PioneerDevice(
        config[CONF_NAME],
        config[CONF_HOST],
        config[CONF_PORT],
        config[CONF_TIMEOUT],
コード例 #22
0
    | SUPPORT_TURN_ON
    | SUPPORT_VOLUME_MUTE
    | SUPPORT_VOLUME_SET
    | SUPPORT_VOLUME_STEP
)


PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Required(CONF_HOST): cv.string,
        vol.Optional(CONF_NAME): cv.string,
        vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
        vol.Optional(CONF_TCP_PORT, default=DEFAULT_WS_PORT): cv.port,
        vol.Optional(CONF_PROXY_SSL, default=DEFAULT_SSL): cv.boolean,
        vol.Optional(CONF_TURN_ON_ACTION): cv.SCRIPT_SCHEMA,
        vol.Optional(CONF_TURN_OFF_ACTION): vol.Any(
            cv.SCRIPT_SCHEMA, vol.In(DEPRECATED_TURN_OFF_ACTIONS)
        ),
        vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int,
        vol.Inclusive(CONF_USERNAME, "auth"): cv.string,
        vol.Inclusive(CONF_PASSWORD, "auth"): cv.string,
        vol.Optional(CONF_ENABLE_WEBSOCKET, default=True): cv.boolean,
    }
)


SERVICE_ADD_MEDIA = "add_to_playlist"
SERVICE_CALL_METHOD = "call_method"

ATTR_MEDIA_TYPE = "media_type"
ATTR_MEDIA_NAME = "media_name"
コード例 #23
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
                  | SUPPORT_VOLUME_MUTE
                  | SUPPORT_PREVIOUS_TRACK
                  | SUPPORT_NEXT_TRACK
                  | SUPPORT_SEEK
                  | SUPPORT_PLAY_MEDIA
                  | SUPPORT_PLAY
                  | SUPPORT_TURN_OFF
                  | SUPPORT_SHUFFLE_SET)

SUPPORT_AIRPLAY = SUPPORT_VOLUME_SET | SUPPORT_TURN_ON | SUPPORT_TURN_OFF

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_HOST):
    cv.string,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
    vol.Optional(CONF_PORT, default=DEFAULT_PORT):
    cv.port,
    vol.Optional(CONF_SSL, default=DEFAULT_SSL):
    cv.boolean,
})


class Itunes:
    """The iTunes API client."""
    def __init__(self, host, port, use_ssl):
        """Initialize the iTunes device."""
        self.host = host
        self.port = port
        self.use_ssl = use_ssl

    @property
コード例 #24
0
SUPPORT_RUSSOUND = (SUPPORT_VOLUME_MUTE
                    | SUPPORT_VOLUME_SET
                    | SUPPORT_TURN_ON
                    | SUPPORT_TURN_OFF
                    | SUPPORT_SELECT_SOURCE)

ZONE_SCHEMA = vol.Schema({vol.Required(CONF_NAME): cv.string})

SOURCE_SCHEMA = vol.Schema({vol.Required(CONF_NAME): cv.string})

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_HOST):
    cv.string,
    vol.Required(CONF_NAME):
    cv.string,
    vol.Required(CONF_PORT):
    cv.port,
    vol.Required(CONF_ZONES):
    vol.Schema({cv.positive_int: ZONE_SCHEMA}),
    vol.Required(CONF_SOURCES):
    vol.All(cv.ensure_list, [SOURCE_SCHEMA]),
})


def setup_platform(opp, config, add_entities, discovery_info=None):
    """Set up the Russound RNET platform."""
    host = config.get(CONF_HOST)
    port = config.get(CONF_PORT)

    if host is None or port is None:
        _LOGGER.error("Invalid config. Expected %s and %s", CONF_HOST,
                      CONF_PORT)
コード例 #25
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
_LOGGER = logging.getLogger(__name__)

CONF_ARGUMENTS = "arguments"
DEFAULT_NAME = "Vlc"

SUPPORT_VLC = (SUPPORT_PAUSE
               | SUPPORT_VOLUME_SET
               | SUPPORT_VOLUME_MUTE
               | SUPPORT_PLAY_MEDIA
               | SUPPORT_PLAY
               | SUPPORT_STOP)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_ARGUMENTS, default=""):
    cv.string,
    vol.Optional(CONF_NAME):
    cv.string,
})


def setup_platform(opp, config, add_entities, discovery_info=None):
    """Set up the vlc platform."""
    add_entities([
        VlcDevice(config.get(CONF_NAME, DEFAULT_NAME),
                  config.get(CONF_ARGUMENTS))
    ])


class VlcDevice(MediaPlayerEntity):
    """Representation of a vlc player."""
    def __init__(self, name, arguments):
コード例 #26
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
                   | SUPPORT_PREVIOUS_TRACK
                   | SUPPORT_SELECT_SOURCE
                   | SUPPORT_VOLUME_MUTE
                   | SUPPORT_VOLUME_STEP
                   | SUPPORT_VOLUME_SET
                   | SUPPORT_PLAY)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_HOST):
    cv.string,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
    vol.Optional(CONF_PORT, default=DEFAULT_PORT):
    cv.port,
    vol.Optional(CONF_USERNAME, default=DEFAULT_USERNAME):
    cv.string,
    vol.Optional(CONF_PASSWORD, default=DEFAULT_PASSWORD):
    cv.string,
    vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT):
    cv.string,
    vol.Optional("retries", default=DEFAULT_RETRIES):
    cv.string,
    vol.Optional("power_on_enabled", default=False):
    cv.boolean,
})

SOURCES = {
    0: "TV / Antenna",
    1: "HDMI_IN_1",
    2: "HDMI_IN_2",
    3: "HDMI_IN_3",
    4: "HDMI_IN_4",
コード例 #27
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
                      | SUPPORT_TURN_ON
                      | SUPPORT_TURN_OFF
                      | SUPPORT_PLAY_MEDIA
                      | SUPPORT_PLAY
                      | SUPPORT_SHUFFLE_SET
                      | SUPPORT_CLEAR_PLAYLIST
                      | SUPPORT_STOP)

PLATFORM_SCHEMA = vol.All(
    cv.deprecated(CONF_HOST),
    cv.deprecated(CONF_PORT),
    cv.deprecated(CONF_PASSWORD),
    cv.deprecated(CONF_USERNAME),
    PLATFORM_SCHEMA.extend({
        vol.Required(CONF_HOST): cv.string,
        vol.Optional(CONF_PASSWORD): cv.string,
        vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
        vol.Optional(CONF_USERNAME): cv.string,
    }),
)

KNOWN_SERVERS = "known_servers"
ATTR_PARAMETERS = "parameters"
ATTR_OTHER_PLAYER = "other_player"

ATTR_TO_PROPERTY = [
    ATTR_QUERY_RESULT,
    ATTR_SYNC_GROUP,
]

SQUEEZEBOX_MODE = {
    "pause": STATE_PAUSED,
コード例 #28
0
CONF_COMMANDS = "commands"

OFF_STATES = [STATE_IDLE, STATE_OFF, STATE_UNAVAILABLE]

ATTRS_SCHEMA = cv.schema_with_slug_keys(cv.string)
CMD_SCHEMA = cv.schema_with_slug_keys(cv.SERVICE_SCHEMA)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Required(CONF_NAME):
        cv.string,
        vol.Optional(CONF_CHILDREN, default=[]):
        cv.entity_ids,
        vol.Optional(CONF_COMMANDS, default={}):
        CMD_SCHEMA,
        vol.Optional(CONF_ATTRS, default={}):
        vol.Or(cv.ensure_list(ATTRS_SCHEMA), ATTRS_SCHEMA),
        vol.Optional(CONF_DEVICE_CLASS):
        DEVICE_CLASSES_SCHEMA,
        vol.Optional(CONF_STATE_TEMPLATE):
        cv.template,
    },
    extra=vol.REMOVE_EXTRA,
)


async def async_setup_platform(opp,
                               config,
                               async_add_entities,
                               discovery_info=None):
    """Set up the universal media players."""
コード例 #29
0
ファイル: media_player.py プロジェクト: OpenPeerPower/core
SUPPORT_LGTV = (SUPPORT_PAUSE
                | SUPPORT_VOLUME_STEP
                | SUPPORT_VOLUME_MUTE
                | SUPPORT_PREVIOUS_TRACK
                | SUPPORT_NEXT_TRACK
                | SUPPORT_TURN_OFF
                | SUPPORT_SELECT_SOURCE
                | SUPPORT_PLAY
                | SUPPORT_PLAY_MEDIA)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_ON_ACTION):
    cv.SCRIPT_SCHEMA,
    vol.Required(CONF_HOST):
    cv.string,
    vol.Optional(CONF_ACCESS_TOKEN):
    vol.All(cv.string, vol.Length(max=6)),
    vol.Optional(CONF_NAME, default=DEFAULT_NAME):
    cv.string,
})


def setup_platform(opp, config, add_entities, discovery_info=None):
    """Set up the LG TV platform."""

    host = config.get(CONF_HOST)
    access_token = config.get(CONF_ACCESS_TOKEN)
    name = config.get(CONF_NAME)
    on_action = config.get(CONF_ON_ACTION)

    client = LgNetCastClient(host, access_token)