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.6k stars 29.91k forks source link

Synology DS220+ Error SynologyDSMCentralUpdateCoordinator - AttributeError: 'NoneType' object has no attribute 'get' #74572

Closed zibous closed 1 year ago

zibous commented 2 years ago

The problem

2022-07-07 07:45:40 ERROR (MainThread) [homeassistant.components.synology_dsm.coordinator] Unexpected error fetching ****** SynologyDSMCentralUpdateCoordinator data: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/components/synology_dsm/coordinator.py", line 103, in _async_update_data
    await self.api.async_update()
  File "/usr/src/homeassistant/homeassistant/components/synology_dsm/common.py", line 265, in async_update
    await self._hass.async_add_executor_job(self._update)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/synology_dsm/common.py", line 281, in _update
    self.dsm.update(self._with_information)
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 344, in update
    self._information.update()
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/api/dsm/information.py", line 16, in update
    raw_data = self._dsm.get(self.API_KEY, "getinfo")
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 213, in get
    return self._request("GET", api, method, params, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 266, in _request
    response = self._execute_request(request_method, url, params, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 294, in _execute_request
    response = self._session.get(
AttributeError: 'NoneType' object has no attribute 'get'

What version of Home Assistant Core has the issue?

core-2022.7.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Synology DSM

Link to integration documentation on our website

https://www.home-assistant.io/integrations/synology_dsm/

Diagnostics information

config_entry-synology_dsm-04b7c92a650ea90dae9f37643c766129.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

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

synology_dsm documentation synology_dsm source (message by IssueLinks)

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

Hey there @hacf-fr, @quentame, @mib1185, mind taking a look at this issue as it has been labeled with an integration (synology_dsm) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

ielbury commented 2 years ago

Same for me ... been happening for a while now.

rsumner commented 2 years ago

Issue is still persistent in HA 2022.7.4. My Synology is a DS918+ running DSM 7.1-42661 Update 3. I enabled debug logging and here's more detail:

2022-07-14 11:24:36 DEBUG (SyncWorker_2) [synology_dsm.synology_dsm] API: SYNO.SurveillanceStation.Camera
2022-07-14 11:24:36 DEBUG (SyncWorker_2) [synology_dsm.synology_dsm] Request Method: GET
2022-07-14 11:24:36 DEBUG (SyncWorker_7) [synology_dsm.synology_dsm] API: SYNO.SurveillanceStation.HomeMode
2022-07-14 11:24:36 DEBUG (SyncWorker_7) [synology_dsm.synology_dsm] Request Method: GET
2022-07-14 11:24:36 ERROR (MainThread) [homeassistant.components.synology_dsm.coordinator] Unexpected error fetching synocam SynologyDSMCameraUpdateCoordinator data: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/opt/pkg/homeassistant/2022.7.4/lib/python3.9/site-packages/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/opt/pkg/homeassistant/2022.7.4/lib/python3.9/site-packages/homeassistant/components/synology_dsm/coordinator.py", line 130, in _async_update_data
    await self.hass.async_add_executor_job(surveillance_station.update)
  File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/opt/pkg/homeassistant/2022.7.4/lib/python3.9/site-packages/synology_dsm/api/surveillance_station/__init__.py", line 26, in update
    list_data = self._dsm.get(self.CAMERA_API_KEY, "List", max_version=7)["data"]
  File "/opt/pkg/homeassistant/2022.7.4/lib/python3.9/site-packages/synology_dsm/synology_dsm.py", line 213, in get
    return self._request("GET", api, method, params, **kwargs)
  File "/opt/pkg/homeassistant/2022.7.4/lib/python3.9/site-packages/synology_dsm/synology_dsm.py", line 266, in _request
    response = self._execute_request(request_method, url, params, **kwargs)
  File "/opt/pkg/homeassistant/2022.7.4/lib/python3.9/site-packages/synology_dsm/synology_dsm.py", line 294, in _execute_request
    response = self._session.get(
AttributeError: 'NoneType' object has no attribute 'get'
2022-07-14 11:24:36 DEBUG (MainThread) [homeassistant.components.synology_dsm.coordinator] Finished fetching synocam SynologyDSMCameraUpdateCoordinator data in 0.002 seconds (success: False)
rsumner commented 2 years ago

I added a little more debug code around line 295 and I can see that that session is null for these API calls:

2022-07-14 11:52:55 DEBUG (SyncWorker_3) [synology_dsm.synology_dsm] API: SYNO.SurveillanceStation.Camera
2022-07-14 11:52:55 DEBUG (SyncWorker_3) [synology_dsm.synology_dsm] Request Method: GET
2022-07-14 11:52:55 DEBUG (SyncWorker_3) [synology_dsm.synology_dsm] Session: None
2022-07-14 11:52:55 DEBUG (SyncWorker_1) [synology_dsm.synology_dsm] API: SYNO.SurveillanceStation.HomeMode
2022-07-14 11:52:55 DEBUG (SyncWorker_1) [synology_dsm.synology_dsm] Request Method: GET
2022-07-14 11:52:55 DEBUG (SyncWorker_1) [synology_dsm.synology_dsm] Session: None
rsumner commented 2 years ago

Problem still persists on version 2022.7.5.

thomascandrian commented 2 years ago

100% same stack here. Syno 1819+ running new DSM7 and newest Surveillance Station.

Effect: Cams do stop working. After host reboot, they work sometimes for few hours. Restarting only HA does not help. Remove and readd DSM integration fixes all issue for ~1hour.

Side-Effect: Some messages saying "Platform synology_dsm does not generate unique IDs.".

kevdliu commented 2 years ago

Is this only with DSM 7.1-42661 Update 3? I am still running update 1 on a DS118 with the latest version of SS and I'm not seeing this. If so I'm going to hold off on updating DSM.

ielbury commented 2 years ago

I am a DS1813+ Version: 7.0-41890 and have the same errors.

thomascandrian commented 2 years ago

DSM 7.1-42661 Update 2 here. After removing and re-adding DSM, it works for some hours, afterwards log gets flooded. Cameras don't apperar on dashboards, as well as as all information about drives, volumes and caches. Other information i.e. mempry, CPU-zugase aso reamin available.

First occurred: 24. Juli 2022 um 04:08:08 (5111 occurrences)
Last logged: 22:43:08
Unexpected error fetching 10.0.11.5 SynologyDSMCameraUpdateCoordinator data: 'NoneType' object has no attribute 'get'

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/components/synology_dsm/coordinator.py", line 130, in _async_update_data
    await self.hass.async_add_executor_job(surveillance_station.update)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/api/surveillance_station/__init__.py", line 26, in update
    list_data = self._dsm.get(self.CAMERA_API_KEY, "List", max_version=7)["data"]
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 213, in get
    return self._request("GET", api, method, params, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 266, in _request
    response = self._execute_request(request_method, url, params, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 294, in _execute_request
    response = self._session.get(
AttributeError: 'NoneType' object has no attribute 'get'
Logger: homeassistant.components.synology_dsm.coordinator
Source: components/synology_dsm/coordinator.py:74
Integration: Synology DSM (documentation, issues)
First occurred: 24. Juli 2022 um 04:08:08 (5111 occurrences)
Last logged: 22:43:08

Unexpected error fetching 10.0.11.5 SynologyDSMSwitchUpdateCoordinator data: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/components/synology_dsm/coordinator.py", line 74, in _async_update_data
    "home_mode": await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/api/surveillance_station/__init__.py", line 152, in get_home_mode_status
    return self._dsm.get(self.HOME_MODE_API_KEY, "GetInfo")["data"]["on"]
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 213, in get
    return self._request("GET", api, method, params, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 266, in _request
    response = self._execute_request(request_method, url, params, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 294, in _execute_request
    response = self._session.get(
AttributeError: 'NoneType' object has no attribute 'get'
Logger: homeassistant.components.synology_dsm.coordinator
Source: components/synology_dsm/common.py:281
Integration: Synology DSM (documentation, issues)
First occurred: 24. Juli 2022 um 04:22:38 (170 occurrences)
Last logged: 22:37:38

Unexpected error fetching 10.0.11.5 SynologyDSMCentralUpdateCoordinator data: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/components/synology_dsm/coordinator.py", line 103, in _async_update_data
    await self.api.async_update()
  File "/usr/src/homeassistant/homeassistant/components/synology_dsm/common.py", line 265, in async_update
    await self._hass.async_add_executor_job(self._update)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/synology_dsm/common.py", line 281, in _update
    self.dsm.update(self._with_information)
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 344, in update
    self._information.update()
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/api/dsm/information.py", line 16, in update
    raw_data = self._dsm.get(self.API_KEY, "getinfo")
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 213, in get
    return self._request("GET", api, method, params, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 266, in _request
    response = self._execute_request(request_method, url, params, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 294, in _execute_request
    response = self._session.get(
AttributeError: 'NoneType' object has no attribute 'get'

As i additionally habe these errors in log, I post them here. I'm nut 100% sure they are related to the error from TO, but as they appear since I have the issue, I think so.

Platform synology_dsm does not generate unique IDs. ID 19C0R5R04H7HX_SYNO.Core.Upgrade:update already exists - ignoring update.diskstation_dsm_update
23:00:16 – (FEHLER) Aktualisieren
Platform synology_dsm does not generate unique IDs. ID 19C0R5R04H7HX_SYNO.SurveillanceStation.HomeMode:home_mode already exists - ignoring switch.diskstation_surveillance_station_home_mode
23:00:16 – (FEHLER) Schalter
Platform synology_dsm does not generate unique IDs. ID 19C0R5R04H7HX_SYNO.Storage.CGI.Storage:disk_status_nvc1 already exists - ignoring sensor.diskstation_cache_device_1_1_status
23:00:16 – (FEHLER) Sensor - Die Nachricht ist zum ersten Mal um 23:00:15 aufgetreten und erscheint 36 mal
Platform synology_dsm does not generate unique IDs. ID 19C0R5R04H7HX_SYNO.SurveillanceStation.Camera:9 already exists - ignoring camera.diskstation_waschen
23:00:15 – (FEHLER) Kamera - Die Nachricht ist zum ersten Mal um 23:00:15 aufgetreten und erscheint 5 mal
Platform synology_dsm does not generate unique IDs. ID 19C0R5R04H7HX_reboot already exists - ignoring button.diskstation_reboot
23:00:15 – (FEHLER) Taste - Die Nachricht ist zum ersten Mal um 23:00:15 aufgetreten und erscheint 2 mal
Platform synology_dsm does not generate unique IDs. ID 19C0R5R04H7HX_SYNO.Storage.CGI.Storage:disk_below_remain_life_thr_sdh already exists - ignoring binary_sensor.diskstation_drive_8_below_min_remaining_life
23:00:15 – (FEHLER) Binärsensor - Die Nachricht ist zum ersten Mal um 23:00:15 aufgetreten und erscheint 21 mal
thomascandrian commented 2 years ago

I tried differnt thins, delete and reconnect did solve it for coule hours. Then deleted and clenaed recorder DB. That helped for 2 days.

Now i went to HA 2022.8, and everything runs smoothly, no errors anymore. Could not see anything in changelog, but hey, I'll take it :-)

mib1185 commented 2 years ago

may it be possible that you have multiple IPs from same subnet on different interfaces on your NAS (_see the note in the docs_)?

PcOnline2004 commented 1 year ago

I've got the same error. Just enable "vSwitch" from Network/Setting of Synology, it's work.

pitiriguisvi commented 1 year ago

i have enabled vswitch but didnt work for me

mib1185 commented 1 year ago

do you mind to give us an update and answer to question from https://github.com/home-assistant/core/issues/74572#issuecomment-1207182272 ?

Dackara commented 1 year ago

I'm French and my English is pretty bad, so I'm fine. I did not manage to understand the whole discussion, I may have mistranslated.

I have the same issue with a DS220+.

The problem seems to disappear by disabling "Surveillance Station".

But as soon as it is restarted, the error returns.

mib1185 commented 1 year ago

@Dackara please open a new issue report and provide as much information as possible about your issue.

I'm going to close this one, because the issue of the user's seems to be solved by reconfiguring their NAS.