Improve LG webosTV (#34147)

* Move consts to const, general cleanup

* Add unique id

* Add default icon

* Set supported features based on sound output

* Update homeassistant/components/webostv/media_player.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Set device class

* Add software_info to client mock

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Aidan TimsonandMartin Hjelmare authored and GitHub committed 2020-04-14 20:26:13 +02:00
1 parent ba394fd2aa
commit 18478ebd05
4 files changed
+69 -34

No files matched your search

+13 -16
View File
@@ -1,4 +1,4 @@
"""Support for WebOS TV."""
"""Support for LG webOS Smart TV."""
import asyncio
import logging
@@ -6,6 +6,18 @@ from aiopylgtv import PyLGTVCmdException, PyLGTVPairException, WebOsClient
import voluptuous as vol
from websockets.exceptions import ConnectionClosed
from homeassistant.components.webostv.const import (
ATTR_BUTTON,
ATTR_COMMAND,
CONF_ON_ACTION,
CONF_SOURCES,
DEFAULT_NAME,
DOMAIN,
SERVICE_BUTTON,
SERVICE_COMMAND,
SERVICE_SELECT_SOUND_OUTPUT,
WEBOSTV_CONFIG_FILE,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_CUSTOMIZE,
@@ -19,21 +31,6 @@ from homeassistant.helpers.dispatcher import async_dispatcher_send
from .const import ATTR_SOUND_OUTPUT
DOMAIN = "webostv"
CONF_SOURCES = "sources"
CONF_ON_ACTION = "turn_on_action"
DEFAULT_NAME = "LG webOS Smart TV"
WEBOSTV_CONFIG_FILE = "webostv.conf"
SERVICE_BUTTON = "button"
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])}
)