diff --git a/homeassistant/components/sensor/transmission.py b/homeassistant/components/sensor/transmission.py index 1eda9cb58fd..678d9afb81d 100644 --- a/homeassistant/components/sensor/transmission.py +++ b/homeassistant/components/sensor/transmission.py @@ -55,12 +55,15 @@ def setup_platform(hass, config, add_devices, discovery_info=None): password = config.get(CONF_PASSWORD) port = config.get(CONF_PORT) - transmission_api = transmissionrpc.Client( - host, port=port, user=username, password=password) try: + transmission_api = transmissionrpc.Client( + host, port=port, user=username, password=password) transmission_api.session_stats() - except TransmissionError: - _LOGGER.exception("Connection to Transmission API failed") + except TransmissionError as error: + _LOGGER.error( + "Connection to Transmission API failed on %s:%s with message %s", + host, port, error.original + ) return False # pylint: disable=global-statement diff --git a/homeassistant/components/switch/transmission.py b/homeassistant/components/switch/transmission.py index 656a6227358..840fdae44d9 100644 --- a/homeassistant/components/switch/transmission.py +++ b/homeassistant/components/switch/transmission.py @@ -43,12 +43,15 @@ def setup_platform(hass, config, add_devices, discovery_info=None): password = config.get(CONF_PASSWORD) port = config.get(CONF_PORT) - transmission_api = transmissionrpc.Client( - host, port=port, user=username, password=password) try: + transmission_api = transmissionrpc.Client( + host, port=port, user=username, password=password) transmission_api.session_stats() - except TransmissionError: - _LOGGING.error("Connection to Transmission API failed") + except TransmissionError as error: + _LOGGING.error( + "Connection to Transmission API failed on %s:%s with message %s", + host, port, error.original + ) return False add_devices([TransmissionSwitch(transmission_api, name)])