8000 Synology cameras won't load when using non-admin DSM account · Issue #9908 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Synology cameras won't load when using non-admin DSM account #9908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mbrrg opened this issue Oct 16, 2017 · 21 comments
Closed

Synology cameras won't load when using non-admin DSM account #9908

mbrrg opened this issue Oct 16, 2017 · 21 comments

Comments

@mbrrg
Copy link
Contributor
mbrrg commented Oct 16, 2017

Home Assistant release (hass --version): 0.55.2 (official Docker image)
Python release (python3 --version): 3.6 (Docker)
Component/platform: camera/synology
Description of problem:
After upgrade to 0.55.2 (from 0.53 or so) my Synology cameras won't load due to some authentication problem in the py-synology library (speculation). Loading fails if I specify a Synology user account with limited permissions to only access SurveillanceStation but works fine if I specify the credentials of my DiskStation admin user which has access to everything.

Expected:
Synology cameras should work as normal also for a user account with limited (but valid) access rights.

Problem-relevant configuration.yaml entries and steps to reproduce:

camera:
  - platform: synology
    url: https://xxxxxxxxx.localdomain:5001
    username: homeassistant
    password: xxxxxxxxxxxx
    timeout: 15
    verify_ssl: False

Traceback (if applicable):

2017-10-16 20:37:55 ERROR (MainThread) [homeassistant.components.camera.synology] Error when initializing SurveillanceStation
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/components/camera/synology.py", line 54, in async_setup_platform
    timeout=timeout
  File "/usr/local/lib/python3.6/site-packages/synology/surveillance_station.py", line 9, in __init__
    self._api = Api(url, username, password, timeout, verify_ssl)
  File "/usr/local/lib/python3.6/site-packages/synology/api.py", line 56, in __init__
    self._initialize_api_sid()
  File "/usr/local/lib/python3.6/site-packages/synology/api.py", line 82, in _initialize_api_sid
    response = self._get_json(api['url'], payload)
  File "/usr/local/lib/python3.6/site-packages/synology/api.py", line 191, in _get_json
    raise ValueError('Invalid or failed response', content)
ValueError: ('Invalid or failed response', {'error': {'code': 400}, 'success': False})
@snjoetw
Copy link
Contributor
snjoetw commented Oct 16, 2017

I'm using non-admin account and I'm able to use synology camera component.

Can you check Control Panel -> Users -> Select your non-admin user and click Edit -> Applications

Do you see Surveillance Station is allowed?

@jradwan
Copy link
jradwan commented Oct 16, 2017

I'm having the same issue. And my non-admin account does have permissions to Surveillance Station. This was working until 0.55.x.

image

8000

@snjoetw
Copy link
Contributor
snjoetw commented Oct 17, 2017

That’s weird, I’ll have another look tonight. But there wasn’t any change made related to how authentication work

@jeffharrell
Copy link

I'm seeing this issue as well. 400 API response from the camera component. If I don't change the user/pass, but change the account on my synology to be an admin it works as expected.

@mbrrg
Copy link
Contributor Author
mbrrg commented Oct 17, 2017

@snjoetw Yes it's configured to allow SurveillanceStation. Changing between manager/spectator also doesn't help. I will try to figure out exactly which call it is that fails tonight, the problem is reproducible using the Github code example for py-synology.

@mbrrg
Copy link
Contributor Author
mbrrg commented Oct 17, 2017

There was a difference small difference between how the auth call was made earlier, the "application session name" parameter that specifies the login scope was missing. This meant that access to DiskStation was necessary to be able to authenticate. I have submitted an issue and a PR for py-synology: snjoetw/py-synology#1

@snjoetw
Copy link
Contributor
snjoetw commented Oct 17, 2017

Thanks @mbrrg, I just released py-synology-0.1.5 (https://pypi.python.org/pypi/py-synology/0.1.5)

Do you want to update home-assistant to uptake latest version or I can do it, just let me know

@arsaboo
Copy link
Contributor
arsaboo commented Oct 17, 2017

@snjoetw Created a PR #9932

@snjoetw
Copy link
Contributor
snjoetw commented Oct 18, 2017

Thanks @arsaboo👍

@mvonh
Copy link
mvonh commented Oct 22, 2017

I have this issue too, I'm using two factory authentication, but only for admin access. Just upgraded to .56 still no cameras. Did this update make it into .56, in not how can I manual update py-synology? Promoting my camera user to Admin solves it. Thank for the work on this platform btw.

@jradwan
Copy link
jradwan commented Oct 22, 2017

Upgraded to 0.56 and my Synology cameras are working again (non-admin user, like in 0.54). But now my Nest cams are broken (issue #10018). 😦

@DavidDeSloovere
Copy link
Contributor

Synology fixed for me.

@snjoetw
Copy link
Contributor
snjoetw commented Oct 25, 2017

@mbrrg is this still an issue?

@mbrrg
Copy link
Contributor Author
mbrrg commented Oct 25, 2017

I'm afraid it is still an issue for me @snjoetw. The weird thing is that running the following snippet inside the Docker container works fine:

from synology.surveillance_station import SurveillanceStation
import logging
import sys

logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

api_url = 'https://xxxxxxxxxx.localdomain:5001'
username = 'homeassistant'
password = 'xxxxx'
verify_ssl = False
timeout = 15

surveillance = SurveillanceStation(api_url, username, password, verify_ssl=verify_ssl, timeout=timeout)
cameras = surveillance.get_all_cameras()
print([c.camera_id for c in cameras])

...but I still get the same error in the Home-Assistant log and the component doesn't load. I will see if I can get some time to troubleshoot this further during the weekend.

@JIOB
Copy link
JIOB commented Nov 3, 2017

Also still an issue for me .

HASS: 56.2

2017-11-03 07:16:51 ERROR (MainThread) [homeassistant.components.camera.synology] Error when initializing SurveillanceStation
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/components/camera/synology.py", line 54, in async_setup_platform
    timeout=timeout
  File "/config/deps/lib/python3.6/site-packages/synology/surveillance_station.py", line 9, in __init__
    self._api = Api(url, username, password, timeout, verify_ssl)
  File "/config/deps/lib/python3.6/site-packages/synology/api.py", line 56, in __init__
    self._initialize_api_sid()
  File "/config/deps/lib/python3.6/site-packages/synology/api.py", line 82, in _initialize_api_sid
    response = self._get_json(api['url'], payload)
  File "/config/deps/lib/python3.6/site-packages/synology/api.py", line 191, in _get_json
    raise ValueError('Invalid or failed response', content)
ValueError: ('Invalid or failed response', {'error': {'code': 400}, 'success': False})

@mbrrg
Copy link
Contributor Author
mbrrg commented Nov 3, 2017

It has started working for me again with the limited user and without any (seemingly relevant) changes to the HA configuration. I've restarted the Synology today though, could have been some temporary hickup...

@JIOB
Copy link
JIOB commented Dec 3, 2017

Am i the only one still experiencing this in 58.1?

@mbrrg
Copy link
Contributor Author
mbrrg commented Dec 6, 2017

Nope, it stopped working for me after upgrade to 58.1 the other day @tryingwebguy .

@xiti
Copy link
xiti commented Dec 13, 2017

Had the same problem with a brand new NVR216.

I was using special chars like % and $ in my 8-chars long password for a spectator user, I made a new one of 16 characters without special chars, and it seems to work fine now.
Looks like Surveillance Station doesn't support special passwords...

Finally 'solved' this shitty problem, so annoying.

@mbrrg
Copy link
Contributor Author
mbrrg commented Dec 30, 2017

This works for me as well now. The culprit was an old version of py-synology that for some reason was still around in my config/deps directory. Will remove the deps directory when I switch Docker images from now on.

@mbrrg mbrrg closed this as completed Dec 30, 2017
@DavidDeSloovere
Copy link
Contributor

I have noticed that I need to restart HA after installing an update on the Synology and I'm not getting the cams to show images.

@home-assistant home-assistant locked and limited conversation to collaborators May 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants
0