Skip to content
Snippets Groups Projects
Commit fb631986 authored by Fabian Affolter's avatar Fabian Affolter
Browse files

fix return values, disconnect from mpd, and fix pylint issue

parent 26c8d81d
No related branches found
No related tags found
No related merge requests found
...@@ -50,7 +50,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None): ...@@ -50,7 +50,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
port = config.get('port', 6600) port = config.get('port', 6600)
location = config.get('location', 'MPD') location = config.get('location', 'MPD')
# pylint: disable=unused-argument
try: try:
from mpd import MPDClient from mpd import MPDClient
...@@ -59,23 +58,23 @@ def setup_platform(hass, config, add_devices, discovery_info=None): ...@@ -59,23 +58,23 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
"Unable to import mpd2. " "Unable to import mpd2. "
"Did you maybe not install the 'python-mpd2' package?") "Did you maybe not install the 'python-mpd2' package?")
return None return False
# pylint: disable=unused-argument # pylint: disable=no-member
try: try:
mpd_client = MPDClient() mpd_client = MPDClient()
mpd_client.connect(daemon, port) mpd_client.connect(daemon, port)
mpd_client.close()
mpd_client.disconnect()
except socket.error: except socket.error:
_LOGGER.error( _LOGGER.error(
"Unable to connect to MPD. " "Unable to connect to MPD. "
"Please check your settings") "Please check your settings")
return None return False
mpd = [] mpd = []
if daemon is not None and port is not None: mpd.append(MpdDevice(daemon, port, location))
mpd.append(MpdDevice(daemon, port, location))
add_devices(mpd) add_devices(mpd)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment