Somehow I broke my Sabznbd sensor. I’m hoping a second pair of eyes can help.
In my HA/Sensors folder:
- platform: sabnzbd
name: SAB
api_key: KeyGoesHere
host: 192.168.1.150
port: 9090
monitored_variables:
- 'current_status'
- 'speed'
- 'queue_size'
- 'queue_remaining'
HA logs spits out the following:
16-08-28 17:12:33 homeassistant.components.sensor.sabnzbd: Connection to SABnzbd API failed
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py", line 142, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/connection.py", line 75, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/lib/python3.4/socket.py", line 533, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py", line 595, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py", line 363, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.4/http/client.py", line 1088, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python3.4/http/client.py", line 1126, in _send_request
self.endheaders(body)
File "/usr/lib/python3.4/http/client.py", line 1084, in endheaders
self._send_output(message_body)
File "/usr/lib/python3.4/http/client.py", line 922, in _send_output
self.send(msg)
File "/usr/lib/python3.4/http/client.py", line 857, in send
self.connect()
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py", line 167, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py", line 151, in _new_conn
self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.HTTPConnection object at 0x7fe17989a198>: Failed to establish a new connection: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/requests/adapters.py", line 423, in send
timeout=timeout
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py", line 640, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/retry.py", line 287, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='https', port=80): Max retries exceeded with url: //192.168.1.150:9090/api?mode=qstatus&apikey=KeyGoesHere&output=json (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7fe17989a198>: Failed to establish a new connection: [Errno -2] Name or service not known',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/var/opt/homeassistant/deps/pysabnzbd/__init__.py", line 38, in check_available
response = requests.get(url, params=api_args, timeout=5)
File "/usr/local/lib/python3.4/dist-packages/requests/api.py", line 70, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/requests/api.py", line 56, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/requests/adapters.py", line 487, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='https', port=80): Max retries exceeded with url: //192.168.1.150:9090/api?mode=qstatus&apikey=KeyGoesHere&output=json (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7fe17989a198>: Failed to establish a new connection: [Errno -2] Name or service not known',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/sensor/sabnzbd.py", line 65, in setup_platform
sab_api.check_available()
File "/var/opt/homeassistant/deps/pysabnzbd/__init__.py", line 43, in check_available
raise SabnzbdApiException("Failed to communicate with SABnzbd API.")
pysabnzbd.SabnzbdApiException: Failed to communicate with SABnzbd API.
If I type https://192.168.1.150:9090/api?mode=qstatus&apikey=KeyGoesHere&output=json into my browser though, I get a nice output though
{"noofslots_total": 0, "have_warnings": "3", "pp_active": false, "mb": 0.0, "speedlimit_abs": "", "jobs": [], "noofslots": 0, "paused": false, "pause_int": "0", "state": "IDLE", "loadavg": "0.15 | 0.24 | 0.29 | V=4598M R=211M", "mbleft": 0.0, "diskspace2": 1925.5283203125, "diskspace1": 8.65057373046875, "kbpersec": 0.0, "speedlimit": "100", "timeleft": "0:00:00", "speed": "0 "}
Any ideas? Does it have to do with the fact that I run SAB as https? I’ve tried every combination of host (with and without port number) and port config lines but can’t get it to clear the error.