home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.67k stars 30.8k forks source link

Can't connect to Synology Surveillance Station 6.1 #35475

Closed Spirituss closed 3 years ago

Spirituss commented 4 years ago

The problem

I have Synology Surveillance Station 6.1 (it's the last that can be installed on DS409) but don't like to give up it since it has 2 additional Synology surveillance licences which can be used. I try to connect using Synology camera integration but it is failed.

Environment

Problem-relevant configuration.yaml

camera:
  - name: station
    platform: synology 
    url: !secret surveillance_station
    username: !secret dsm_user
    password: !secret dsm_password
    timeout: 60
    verify_ssl: false  

Traceback/Error logs

2020-05-08 01:03:24 ERROR (MainThread) [homeassistant.components.camera] Error while setting up synology platform for camera
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/src/homeassistant/homeassistant/components/synology/camera.py", line 56, in async_setup_platform
    timeout=timeout,
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/synology/surveillance_station.py", line 12, in __init__
    self._api = Api(url, username, password, timeout, verify_ssl)
  File "/usr/local/lib/python3.7/site-packages/synology/api.py", line 59, in __init__
    self._initialize_api_info()
  File "/usr/local/lib/python3.7/site-packages/synology/api.py", line 75, in _initialize_api_info
    api['url'] = self._base_url + response['data'][api_name]['path']
KeyError: 'SYNO.SurveillanceStation.Camera.Event'
2020-05-08 01:03:29 ERROR (MainThread) [homeassistant.components.synology.camera] Error when initializing SurveillanceStation
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/synology/api.py", line 192, in _get_json_with_retry
    return self._get_json(url, payload)
  File "/usr/local/lib/python3.7/site-packages/synology/api.py", line 205, in _get_json
    raise SessionExpiredException('Session expired')
synology.api.SessionExpiredException: Session expired

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/synology/camera.py", line 56, in async_setup_platform
    timeout=timeout,
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/synology/surveillance_station.py", line 16, in __init__
    self.update()
  File "/usr/local/lib/python3.7/site-packages/synology/surveillance_station.py", line 20, in update
    cameras = self._api.camera_list()
  File "/usr/local/lib/python3.7/site-packages/synology/api.py", line 101, in camera_list
    response = self._get_json_with_retry(api['url'], payload)
  File "/usr/local/lib/python3.7/site-packages/synology/api.py", line 194, in _get_json_with_retry
    self._initialize_api_sid()
  File "/usr/local/lib/python3.7/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.7/site-packages/synology/api.py", line 192, in _get_json_with_retry
    return self._get_json(url, payload)
  File "/usr/local/lib/python3.7/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})

Additional information

It works well with Surveillance Station 8.2.7-6222.

probot-home-assistant[bot] commented 4 years ago

synology documentation synology source (message by IssueLinks)

aptonline commented 4 years ago

Just to add to this I decided to switch back over to Synology Surveillance station again after leaving it for a while (due to the issues listed here to see if things have improved. I too am running the latest version of Surveillance Station (8.2.7-6222) and latest HA (0.110.3) via docker.

This is the error I am receiving during initialisation:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.7/http/client.py", line 1344, in getresponse
    response.begin()
  File "/usr/local/lib/python3.7/http/client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.7/http/client.py", line 267, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 725, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 403, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 735, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 428, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 336, in _raise_timeout
    self, url, "Read timed out. (read timeout=%s)" % timeout_value
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='192.168.1.12', port=5000): Read timed out. (read timeout=15)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/synology/camera.py", line 56, in async_setup_platform
    timeout=timeout,
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/synology/surveillance_station.py", line 12, in __init__
    self._api = Api(url, username, password, timeout, verify_ssl)
  File "/usr/local/lib/python3.7/site-packages/synology/api.py", line 60, in __init__
    self._initialize_api_sid()
  File "/usr/local/lib/python3.7/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.7/site-packages/synology/api.py", line 192, in _get_json_with_retry
    return self._get_json(url, payload)
  File "/usr/local/lib/python3.7/site-packages/synology/api.py", line 198, in _get_json
    response = self._get(url, payload)
  File "/usr/local/lib/python3.7/site-packages/synology/api.py", line 185, in _get
    verify=self._verify_ssl)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='192.168.1.12', port=5000): Read timed out. (read timeout=15)

Is the Synology livestreaming API still removed from recent builds or is this something else that's broken.

EDIT: There seems to be a discussion about the issue here: https://community.synology.com/enu/forum/3/post/123094?page=4&sort=oldest

Turns out the live-streaming API was not removed but documentation was as they want 3rd parties to use a different streaming method.

stale[bot] commented 4 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment šŸ‘ This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Spirituss commented 4 years ago

The issue is still actual. I'm waiting for @shenxn pull request release.

Spirituss commented 4 years ago

@shenxn Any news re. this issue?

shenxn commented 4 years ago

@Spirituss I think this problem is caused by the lack of some API methods in Surveillance Station 6.1. We'll try to find a workaournd to detect and not use those functions. But that is going to take some time because we need to fix the streaming and account priviledge problems first since those affects more users. I'll ping you for test when we get to that point.

Spirituss commented 4 years ago

@shenxn Thanks for your support! I'm looking forward to your soon feedback.

Spirituss commented 4 years ago

@shenxn Is it included into 116b0?

Spirituss commented 4 years ago

@shenxn I updated to 0.116.0, still can't connect.

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment šŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Spirituss commented 3 years ago

The issue is not yet closed.

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment šŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Spirituss commented 3 years ago

The issue is not yet solved.