Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions homeassistant/components/frontier_silicon/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
)
from homeassistant.const import (
CONF_HOST,
CONF_NAME,
CONF_PASSWORD,
CONF_PORT,
STATE_OFF,
Expand Down Expand Up @@ -60,6 +61,7 @@
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,
}
)

Expand All @@ -68,17 +70,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
Expand All @@ -93,13 +97,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
Expand Down