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
71.06k stars 29.72k forks source link

"Session expired" error for Synology Camera when restart HA #14590

Closed bieniu closed 5 years ago

bieniu commented 6 years ago

Home Assistant release with the issue: 0.69.1

Operating environment (Hass.io/Docker/Windows/etc.): RPi3/Raspbian

**Please provide details about your environment. Python 3.6.3/vitual_env

Component/platform: camera/synology

Description of problem: After a few days without restart/reboot when I am restarting HA or rebooting RPi at the HA startup, there is an error "session expired" and the camera isn't initiated. The next HA restart initiates the camera correctly.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

camera:
  platform: synology
  url: http://SYNOLOGY_IP:5000
  username: !secret synology_user
  password: !secret synology_password
  timeout: 15

Traceback (if applicable):

Error while setting up platform synology
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/synology/api.py", line 192, in _get_json_with_retry
    return self._get_json(url, payload)
  File "/srv/homeassistant/lib/python3.6/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 "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 210, in coro
    res = func(*args, **kw)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/camera/synology.py", line 54, in async_setup_platform
    timeout=timeout
  File "/srv/homeassistant/lib/python3.6/site-packages/synology/surveillance_station.py", line 16, in __init__
    self.update()
  File "/srv/homeassistant/lib/python3.6/site-packages/synology/surveillance_station.py", line 20, in update
    cameras = self._api.camera_list()
  File "/srv/homeassistant/lib/python3.6/site-packages/synology/api.py", line 101, in camera_list
    response = self._get_json_with_retry(api['url'], payload)
  File "/srv/homeassistant/lib/python3.6/site-packages/synology/api.py", line 195, in _get_json_with_retry
    return self._get_json(url, payload)
  File "/srv/homeassistant/lib/python3.6/site-packages/synology/api.py", line 205, in _get_json
    raise SessionExpiredException('Session expired')
synology.api.SessionExpiredException: Session expired
brent20 commented 6 years ago

I'm having the same issue on .70, but only when I added a second DSM running Surveillance Station. One DSM sets up fine and works, the other does not show camera thumbnails in the Front End, however the camera works when I click on the card.

balloobbot commented 6 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 :+1:

balloobbot commented 5 years ago

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍