Synology Camera [SOLVED]

Yeah, I put ssl to false and used the internal ip of the NAS. The same ip, brings me right to the login page using a browser. It’s unsecured though. I also tried my synology.me address, which has a valid cert and is secure. I tried that one with ssl to true and it still didn’t work. I also have a paid domain that I forward to the synology.me. I haven’t tried that one yet, but since it is just forwarding the address, I imagine I would get the same result.

1 Like

Looks like I am getting closer, went with one of my domain names that gets forwarded to the synology.me account. It sees it, but is refusing connection. Oddly, the NAS shows the Home Assistant user I created for HA is connected.

Log Details (ERROR)
Tue Dec 04 2018 18:09:32 GMT-0500 (Eastern Standard Time)

Error when initializing SurveillanceStation
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 80, in create_connection
    raise err
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 70, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  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 343, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 301, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 168, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x705b5bb0>: Failed to establish a new connection: [Errno 111] Connection refused

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 449, 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 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='guardian.coscia.network', port=443): Max retries exceeded with url: /webapi/query.cgi?api=SYNO.API.Info&method=Query&version=1&query=SYNO.API.Auth%2CSYNO.SurveillanceStation.Camera%2CSYNO.SurveillanceStation.Camera.Event%2CSYNO.SurveillanceStation.VideoStream (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x705b5bb0>: Failed to establish a new connection: [Errno 111] Connection refused',))

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 53, 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 59, in __init__
    self._initialize_api_info()
  File "/usr/local/lib/python3.6/site-packages/synology/api.py", line 70, in _initialize_api_info
    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 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='guardian.coscia.network', port=443): Max retries exceeded with url: /webapi/query.cgi?api=SYNO.API.Info&method=Query&version=1&query=SYNO.API.Auth%2CSYNO.SurveillanceStation.Camera%2CSYNO.SurveillanceStation.Camera.Event%2CSYNO.SurveillanceStation.VideoStream (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x705b5bb0>: Failed to establish a new connection: [Errno 111] Connection refused',))

Still haven’t had much luck. Do you think it’s because I have HTTP forwarded to HTTPS automatically? I have ssl set to true.

Turned off the HTTPS redirect and still can’t get it to work. This is the error message I am currently getting for SS…

Log Details (ERROR)
Sat Dec 15 2018 12:33:05 GMT-0500 (Eastern Standard Time)

Error when initializing SurveillanceStation
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/synology.py", line 53, 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})

Do you have the port number at the end of the IP address and have you tried creating a new user account in your Synology without the space?
I have http to redirect to https.
Also have you given your username permission to access Surveillance Station?
This is how my setup is, but with different user name a password.

camera:
  - platform: synology
    url: https://192.168.1.2:5001
    username: homeassistant
    password: password
    timeout: 15
    verify_ssl: False

Thanks for the reply! Taking the single space out of the user name did the trick! Thank you so much for the help. Now to see if it will still work with https redirect on. :slight_smile:

Glad you got it sorted.

Are you hosting your Home Assistant on your Syno as well?

A couple of weeks ago I did a basic automation to trigger recordings on the Surveillance Station based on a sensor trigger. Might give you some ideas on how to Integrate / Automate Surveillance Station a bit more with Home Assistant.

Thanks, don’t know if I would have solved the issue without your help. Although I did notice the feed doesn’t seem to be live video, it is a static image that is updated every 10 seconds. Is that normal?

I actually have two Synos, an older DS214play that I use for file sharing and a new DS718+ that I use exclusively for SS. I’ll probably replace the DS214play with a DS918+ soon, I host cloud storage for my entire family and need the additional disk bays for storage.

I primarily use SmartThings for my home automation, but have Home Assistant running in parallel (minus all z-wave devices) on a raspberry pi. I think it’s inevitable before Samsung kills the openness of SmartThings, so trying to prepare myself for the jump. HA has a higher learning curve, so taking it slow and steady.

Thanks for the link! Right now I am recording 24/7, but will probably have to cut back as I add more cameras. Again, thanks for all the help!

The main interface is an almost static image like you say, updates every 10 seconds or so.

Click on the camera image and it updates quicker.

I would move away from 24/7 recording and use motion detection. It’s not 100% but safes on having to view hundreds of hours of footage to find an event.

That’s why I like to use external sensors like a Door / Window sensor or a PIR sensor. You can trigger a recording you might normally miss. But if the sensor is set right it wont be triggered from false readings.

Has anyone had any issues with Synology CPU usage recently? My Hassio is pulling images every 10 seconds or so, and it’s pushing my 215j to the limit, it’s 100% CPU usage at all times. It’s so bad I can’t even access the Synology web interface with shutting Hassio down. It’s only started happening recently, and it’s made my NAS nearly useless.

what SS are you running? 8.2.3 ? there are some issues, at this moment they are developing a new .py file

you can join the testing here :

Yeah, the latest SS. Thanks for the link.

are you using 8.2.3 already?
because also, in older SS versions there were indeed CPU issues, nothing related to HA

Yeah 8.2.3 5828

Still sitting at 99% doing nothing. When I turn my Hassio off, CPU use on the synology drops down to 0-30%, so it’s the Hassio pulling those images.

ok, try the new custom .py file on that github
or try this patch:

from synology community:
Hi Everyone, our developer made a informal version that fix the stream api. You can download apk here with the password “SYNO0311”. However, this is an informal testing version, there is no any assurance made.
link : https://supfiles.synology.com/fsdownload/oXkk1MptJ/SS8.2.3-5829

Thanks for that, I’ll have a look

How did you get on with this? I too have a 215j, just set up some Reolink cameras but they are very slow to update when using ONVIF or FFMPEG in Hassio so was thinking about using the Synology component. Would be interested to hear your progress

not possible yet
but rstp stream is coming in the future

While this worked, there is a memory leak in the component

with the latest version of surveillance station the stream works great for me, but I do have a problem getting a recording. it’s giving me the following error:
Failed to call service camera/record. camera.frontdoor does not support record service

Any idea what might cause this or how to solve it?