"""
Support for Russound multizone controllers using RIO Protocol.

For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.russound_rio/
"""
import logging

import voluptuous as vol

from homeassistant.components.media_player import (
    MediaPlayerDevice, PLATFORM_SCHEMA)
from homeassistant.components.media_player.const import (
    MEDIA_TYPE_MUSIC, SUPPORT_SELECT_SOURCE, SUPPORT_TURN_OFF,
    SUPPORT_TURN_ON, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET)
from homeassistant.const import (
    CONF_HOST, CONF_NAME, CONF_PORT, EVENT_HOMEASSISTANT_STOP, STATE_OFF,
    STATE_ON)
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv

REQUIREMENTS = ['russound_rio==0.1.4']

_LOGGER = logging.getLogger(__name__)

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(
        hass, config, async_add_entities, discovery_info=None):
    """Set up the Russound RIO platform."""
    from russound_rio import Russound

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