Synology IP Camera - Can't connect (I guess)

Hi,

Yesterday I’ve lost all my HA configuration. Not a big deal since I had very few things but, ok, I restart everything. My IP Camera, which are configured in my Synology NAS, was working perfectly, even so perfectly that I can’t remember having issues adding them to HA and there configurations…

Now that I’ve a fresh new HA, I can’t make them working again !

Here’s the log :

Error when initializing SurveillanceStation
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 384, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 380, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/local/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.6/ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.6/ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
  File "/usr/local/lib/python3.6/ssl.py", line 631, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 445, in send
    timeout=timeout
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 367, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 306, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='192.168.1.27', port=5001): Read timed out. (read timeout=5)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/synology.py", line 55, in async_setup_platform
    timeout=timeout
  File "/usr/local/lib/python3.6/site-packages/synology/surveillance_station.py", line 12, in __init__
    self._api = Api(url, username, password, timeout, verify_ssl)
  File "/usr/local/lib/python3.6/site-packages/synology/api.py", line 60, in __init__
    self._initialize_api_sid()
  File "/usr/local/lib/python3.6/site-packages/synology/api.py", line 88, in _initialize_api_sid
    response = self._get_json_with_retry(api['url'], payload)
  File "/usr/local/lib/python3.6/site-packages/synology/api.py", line 192, in _get_json_with_retry
    return self._get_json(url, payload)
  File "/usr/local/lib/python3.6/site-packages/synology/api.py", line 198, in _get_json
    response = self._get(url, payload)
  File "/usr/local/lib/python3.6/site-packages/synology/api.py", line 185, in _get
    verify=self._verify_ssl)
  File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 512, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 622, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 526, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='192.168.1.27', port=5001): Read timed out. (read timeout=5)

and in my configuration.yaml I’ve got :

# Synology Cam
camera:
  - platform: synology
    url: https://192.168.1.27:5001
    username: xxx
    password: xxx
    verify_ssl: False

When I try this IP in my browser, I access to the NAS… I’ve also try port 5000 which is ok too…

If someone see something wrong, please tell me :frowning:
Thanks !

Oh, and I’m using this configuration too, don’t know if it’s relevant :

http:
  base_url: https://something.duckdns.org
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem

I replaced my diskstation recently… also having trouble getting it to connect. Haven’t had time to dig into it, but I suspect something changed in a recent version making it fail to start a session, so existing sessions will still work, but once you change something, you’ll no longer connect.

Hum… But, well, it was working just yesterday :roll_eyes:

Nothing’s seems wrong ? Others have the issue ?

I’ve made some changes, still not working but error changed.

# Synology Cam
camera:
  - platform: synology
    url: https://192.168.1.27:5001
    username: !secret syno_username
    password: !secret syno_pwd
    timeout: 15
    verify_ssl: false

(I’ve add timeout: 15)

and the log then :

Wed Oct 03 2018 22:51:31 GMT+0200 (heure d’été d’Europe centrale)

Error when initializing SurveillanceStation
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/synology.py", line 55, in async_setup_platform
    timeout=timeout
  File "/usr/local/lib/python3.6/site-packages/synology/surveillance_station.py", line 12, in __init__
    self._api = Api(url, username, password, timeout, verify_ssl)
  File "/usr/local/lib/python3.6/site-packages/synology/api.py", line 60, in __init__
    self._initialize_api_sid()
  File "/usr/local/lib/python3.6/site-packages/synology/api.py", line 88, in _initialize_api_sid
    response = self._get_json_with_retry(api['url'], payload)
  File "/usr/local/lib/python3.6/site-packages/synology/api.py", line 192, in _get_json_with_retry
    return self._get_json(url, payload)
  File "/usr/local/lib/python3.6/site-packages/synology/api.py", line 207, in _get_json
    raise ValueError('Invalid or failed response', content)
ValueError: ('Invalid or failed response', {'error': {'code': 400}, 'success': False})

(I guess it’s saying nothing usefull…)

I god, I can’t believe… I’ve inverted ‘’ - ’ and " _ " in my own username !.. It’s working now, of course… :pensive: