diff --git a/homeassistant/components/frontier_silicon/media_player.py b/homeassistant/components/frontier_silicon/media_player.py index 2336a9e0e06..711a8940493 100644 --- a/homeassistant/components/frontier_silicon/media_player.py +++ b/homeassistant/components/frontier_silicon/media_player.py @@ -24,6 +24,7 @@ from homeassistant.components.media_player.const import ( ) from homeassistant.const import ( CONF_HOST, + CONF_NAME, CONF_PASSWORD, CONF_PORT, STATE_IDLE, @@ -61,6 +62,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( vol.Required(CONF_HOST): cv.string, vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port, vol.Optional(CONF_PASSWORD, default=DEFAULT_PASSWORD): cv.string, + vol.Optional(CONF_NAME): cv.string, } ) @@ -69,17 +71,19 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= """Set up the Frontier Silicon platform.""" if discovery_info is not None: async_add_entities( - [AFSAPIDevice(discovery_info["ssdp_description"], DEFAULT_PASSWORD)], True + [AFSAPIDevice(discovery_info["ssdp_description"], DEFAULT_PASSWORD, None)], + True, ) return True host = config.get(CONF_HOST) port = config.get(CONF_PORT) password = config.get(CONF_PASSWORD) + name = config.get(CONF_NAME) try: async_add_entities( - [AFSAPIDevice(DEVICE_URL.format(host, port), password)], True + [AFSAPIDevice(DEVICE_URL.format(host, port), password, name)], True ) _LOGGER.debug("FSAPI device %s:%s -> %s", host, port, password) return True @@ -94,13 +98,13 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= class AFSAPIDevice(MediaPlayerDevice): """Representation of a Frontier Silicon device on the network.""" - def __init__(self, device_url, password): + def __init__(self, device_url, password, name): """Initialize the Frontier Silicon API device.""" self._device_url = device_url self._password = password self._state = None - self._name = None + self._name = name self._title = None self._artist = None self._album_name = None