Skip to content
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

Synology Camera's stopt working after 0.35.3 #5095

Closed
csandke opened this issue Dec 28, 2016 · 7 comments
Closed

Synology Camera's stopt working after 0.35.3 #5095

csandke opened this issue Dec 28, 2016 · 7 comments

Comments

@csandke
Copy link

csandke commented Dec 28, 2016

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

**Home Assistant release (hass --version):0.35.3

**Python release (python3 --version):3.4

**Component/platform:Raspberry

Description of problem:
16-12-27 19:31:19 homeassistant.components.camera: Setting up camera.synology 16-12-27 19:31:20 aiohttp.client: Attempt to decode JSON with unexpected mimetype: text/plain; charset="utf-8" 16-12-27 19:31:21 aiohttp.client: Attempt to decode JSON with unexpected mimetype: text/plain; charset="utf-8" 16-12-27 19:31:22 homeassistant.components.camera: Error while setting up platform synology Traceback (most recent call last): File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 145, in _async_setup_platform entity_platform.async_add_entities, discovery_info File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/camera/synology.py", line 134, in async_setup_platform cameras = camera_resp['data']['cameras'] KeyError: 'data' 16-12-27 19:31:22 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=camera>

Expected:

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

Traceback (if applicable):

Additional info:

@pvizeli
Copy link
Member

pvizeli commented Dec 29, 2016

CC @jgriff2 I see that 1-2 issue exists with KeyError errors...

@nugget
Copy link
Contributor

nugget commented Jan 29, 2017

I'm seeing this same problem, except for me it worked in .36 and broke in .36.1. It does not work on my raspbian production box, but I'm unable to reproduce the problem on my development box (ubuntu-server), both talking to the same synology using the same configuration and credentials. My current suspicion is a python/asyncio/aiohttp version discrepancy. I'll continue to investigate.

My nonworking box is also an older python 3.4 and the working box is 3.5.

@nugget
Copy link
Contributor

nugget commented Jan 29, 2017

After further investigation, the JSON mimetype warning appears to be a red herring. I think that always happens and looking at the aiohttp source it's only a warning message. I'm seeing the same warning on my working box as I am on the non-working box.

This appears to be something that broke in aiohttp 1.2.0. It has something to do with authentication. If I print out the contents of camera_req I see valid JSON with all the camera date on the 1.1.6 machine. On the 1.2.0 machine I see {'error': {'code': 105}, 'success': False}. The synology API docs indicate that code 105 is an authentication rejection.

Still digging, but that's what it looks like so far.

@nugget
Copy link
Contributor

nugget commented Jan 29, 2017

I think this is it. It's Python 3.4.2 that's implicated with cookie handling problems (which is interfering with session_id usage on API calls). See aio-libs/aiohttp#1485

@nugget
Copy link
Contributor

nugget commented Jan 30, 2017

After further testing I'm pretty sure this is a bug in aiohttp 1.2.0. I've produced a short script which reproduces the problem and submitted an issue to the aiohttp project here: aio-libs/aiohttp#1566

I believe that we could work around the problem by migrating the synology platform to use aiohttp's CookieJar facility to handle the session_id if the aiohttp project is unresponsive. That's a completely different code path that doesn't seem to be affected by this bug.

@balloob
Copy link
Member

balloob commented Apr 10, 2017

Can you retest? We have upgraded to aiohttp 2

@nugget
Copy link
Contributor

nugget commented Apr 10, 2017

Confirmed working fine for me with release homeassistant (0.42.2) and corresponding aiohttp version (2.0.5). All my synology cameras are successfully streaming in the frontend.

@balloob balloob closed this as completed Apr 12, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Jul 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants