Add webostv sound_output capability (#31121)

* Webostv: add sound_output capability

Add the ability to read and set the sound_output

* Webostv: add sound_output capability

* Webostv: add sound_output capability

* fix blank spaces

* fix to long line

* add ,

* Import ATTR_SOUND_OUTPUT

Do not have the ability to test this change right now

* Add white space

* Create const.py

* Use const import

* Use import from const.py

* Add docstring

* Change order

* Change order

* Fix import

* Fix import

* Fix typo

* Change order again

* Change order again

* Change order of attributes
This commit is contained in:
starkillerOG authored and Martin Hjelmare committed 2020-01-27 10:40:48 +01:00
1 parent 1f0f62de7f
commit 1278f32306
4 files changed
+39 -7

No files matched your search

@@ -17,6 +17,8 @@ from homeassistant.const import (
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.dispatcher import async_dispatcher_send
from .const import ATTR_SOUND_OUTPUT
DOMAIN = "webostv"
CONF_SOURCES = "sources"
@@ -30,6 +32,8 @@ ATTR_BUTTON = "button"
SERVICE_COMMAND = "command"
ATTR_COMMAND = "command"
SERVICE_SELECT_SOUND_OUTPUT = "select_sound_output"
CUSTOMIZE_SCHEMA = vol.Schema(
{vol.Optional(CONF_SOURCES, default=[]): vol.All(cv.ensure_list, [cv.string])}
)
@@ -60,9 +64,15 @@ BUTTON_SCHEMA = CALL_SCHEMA.extend({vol.Required(ATTR_BUTTON): cv.string})
COMMAND_SCHEMA = CALL_SCHEMA.extend({vol.Required(ATTR_COMMAND): cv.string})
SOUND_OUTPUT_SCHEMA = CALL_SCHEMA.extend({vol.Required(ATTR_SOUND_OUTPUT): cv.string})
SERVICE_TO_METHOD = {
SERVICE_BUTTON: {"method": "async_button", "schema": BUTTON_SCHEMA},
SERVICE_COMMAND: {"method": "async_command", "schema": COMMAND_SCHEMA},
SERVICE_SELECT_SOUND_OUTPUT: {
"method": "async_select_sound_output",
"schema": SOUND_OUTPUT_SCHEMA,
},
}
_LOGGER = logging.getLogger(__name__)