question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Connect Timeout in Synology DSM integration

See original GitHub issue

The problem

I followed the configuration guide for the Synology DSM integration. Created beforehand a new admin user with OTP enabled. The setup went smooth without any actual problems and i managed to configure some UI cards to test it out with.

But after some time (max 15-20 minutes). The device / entities became unavailable and the integration showed a ConnectTimeout error. I tried following, but without success:

  • reload the Integration (multiple times after every change)
  • add more rights to the Synology account
  • restart the Synology NAS
  • enabled debug logging (as proposed in other issues) but not much info is shown to me
  • restart Home Assistant

And finally removed the integration. But when i now want to readd it, i get the same error not being able to connect.

This leaves me with the question why did it work the first time and ever since keeps timing out. Also i am perfectly capable of logging into the device with multiple accounts using the web view and OTP.

What version of Home Assistant Core has the issue?

2022.12.8

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

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2022-12-24 01:12:10.977 ERROR (MainThread) [homeassistant.components.synology_dsm.config_flow] {'api': None, 'code': -1, 'reason': 'Unknown', 'details': "ConnectTimeout = (<urllib3.connection.HTTPSConnection object at 0x7f36b216ee30>, 'Connection to 192.168.1.9 timed out. (connect timeout=30)')"}

Additional information

No response

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mib1185commented, Dec 24, 2022

Hi @stefanborghys

please enable debug logging, restart HA and provide the home-assistant.log after xxxx To do so add the following to your configuration.yaml:

logger:
  default: info
  logs:
    homeassistant.components.synology_dsm: debug
    synology_dsm: debug

Note: it is better to drag the log into the comment (which will add it as an attachment) and not copy paste as it is hard to read logs in GitHub.

0reactions
NoAdOcommented, Jan 2, 2023

home-assistant_2023-01-02T14-56-27.736Z.log This should act better. HA container started at 13:21 and at 14:55 i’ve got the last history record.

2023-01-02 14:29:57.313 DEBUG (SyncWorker_6) [synology_dsm.synology_dsm] Request Method: GET
2023-01-02 14:29:57.438 DEBUG (SyncWorker_6) [synology_dsm.synology_dsm] Request url: https://***.***.***.100:5001/webapi/entry.cgi?api=SYNO.Core.System&version=3&method=info&_sid=********&SynoToken=********
2023-01-02 14:29:57.439 DEBUG (SyncWorker_6) [synology_dsm.synology_dsm] Response status_code: 200
2023-01-02 14:29:57.439 DEBUG (SyncWorker_6) [synology_dsm.synology_dsm] Response headers: {'Server': 'nginx', 'Date': 'Mon, 02 Jan 2023 11:29:57 GMT', 'Content-Type': 'application/json; charset="UTF-8"', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=20', 'Set-Cookie': 'id=mignxFdxbQsqV8wwGvfxnf8uH4gmaW-vYt9Qpdf2XQYW9GUuOHVHnNQ8V2JlCi9gG0LLHr3c1dn2WBtfDLBOpc;expires=Mon, 09-Jan-2023 11:29:57 GMT;path=/;HttpOnly', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Cache-Control': 'max-age=0, no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0'}
2023-01-02 14:29:57.439 DEBUG (SyncWorker_6) [synology_dsm.synology_dsm] Successful returned data
2023-01-02 14:29:57.439 DEBUG (SyncWorker_6) [synology_dsm.synology_dsm] RESPONSE: {'data': {'cpu_clock_speed': 1500, 'cpu_cores': '4', 'cpu_family': 'Celeron', 'cpu_series': 'J3455', 'cpu_vendor': 'INTEL', 'enabled_ntp': True, 'external_pci_slot_info': [], 'firmware_date': '2022/12/07', 'firmware_ver': 'DSM 7.1.1-42962 Update 3', 'model': 'DS918+', 'ntp_server': 'pool.ntp.org', 'ram_size': 8192, 'sata_dev': [], 'serial': '18B0PDN158903', 'support_esata': 'yes', 'sys_temp': 40, 'sys_tempwarn': False, 'systempwarn': False, 'temperature_warning': False, 'time': '2023-01-02 14:29:57', 'time_zone': 'Baghdad', 'time_zone_desc': '(GMT+03:00) Baghdad', 'up_time': '1:35:5', 'usb_dev': [{'cls': 'hub', 'pid': '0411', 'producer': 'Realtek Semiconductor Corp.', 'product': '4-Port USB 3.0 Hub', 'rev': '1.17', 'vid': '0bda'}, {'cls': 'other', 'pid': '7523', 'producer': 'QinHeng Electronics', 'product': 'HL-340 USB-Serial adapter', 'rev': '2.64', 'vid': '1a86'}, {'cls': 'hub', 'pid': '5411', 'producer': 'Realtek Semiconductor Corp.', 'product': '4-Port USB 2.0 Hub', 'rev': '1.17', 'vid': '0bda'}, {'cls': 'ups', 'pid': '0002', 'producer': 'American Power Conversion', 'product': 'Uninterruptible Power Supply', 'rev': '1.06', 'vid': '051d'}, {'cls': 'other', 'pid': '0001', 'producer': 'Cambridge Silicon Radio, Ltd', 'product': 'Bluetooth Dongle (HCI mode)', 'rev': '88.91', 'vid': '0a12'}]}, 'success': True}
2023-01-02 14:29:57.439 DEBUG (SyncWorker_6) [synology_dsm.synology_dsm] API: SYNO.Core.Upgrade.Server
2023-01-02 14:29:57.439 DEBUG (SyncWorker_6) [synology_dsm.synology_dsm] Request Method: GET
2023-01-02 14:30:07.454 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Connection error during update of '18B0PDN158903' with exception: {'api': None, 'code': -1, 'reason': 'Unknown', 'details': "ReadTimeout = HTTPSConnectionPool(host='***.***.***.100', port=5001): Read timed out. (read timeout=10)"}
2023-01-02 14:30:07.454 WARNING (MainThread) [homeassistant.components.synology_dsm.common] Connection error during update, fallback by reloading the entry
2023-01-02 14:30:07.497 ERROR (MainThread) [homeassistant.components.synology_dsm.coordinator] Unexpected error fetching ***.***.***.100 SynologyDSMCentralUpdateCoordinator data: The config entry ***.***.***.100 (synology_dsm) with entry_id ee88924a760c2463c18ec64ad8f50dcc cannot be unloaded because it is not in a recoverable state (ConfigEntryState.SETUP_IN_PROGRESS)
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.10/http/client.py", line 1374, in getresponse
    response.begin()
  File "/usr/local/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.10/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.10/socket.py", line 705, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.10/ssl.py", line 1274, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.10/ssl.py", line 1130, in read
    return self._sslobj.read(len, buffer)
TimeoutError: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.10/site-packages/urllib3/packages/six.py", line 770, in reraise
    raise value
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 451, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 340, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='***.***.***.100', port=5001): Read timed out. (read timeout=10)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 294, in _execute_request
    response = self._session.get(
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 600, in get
    return self.request("GET", url, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 578, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='***.***.***.100', port=5001): Read timed out. (read timeout=10)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/synology_dsm/common.py", line 276, 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 292, in _update
    self.dsm.update(self._with_information)
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/synology_dsm.py", line 368, in update
    self._upgrade.update()
  File "/usr/local/lib/python3.10/site-packages/synology_dsm/api/core/upgrade.py", line 17, in update
    raw_data = self._dsm.get(self.API_SERVER_KEY, "check")
  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 336, in _execute_request
    raise SynologyDSMRequestException(exp) from exp
synology_dsm.exceptions.SynologyDSMRequestException: {'api': None, 'code': -1, 'reason': 'Unknown', 'details': "ReadTimeout = HTTPSConnectionPool(host='***.***.***.100', port=5001): Read timed out. (read timeout=10)"}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 225, 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 286, in async_update
    await self._hass.config_entries.async_reload(self._entry.entry_id)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1108, in async_reload
    unload_result = await self.async_unload(entry_id)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1092, in async_unload
    raise OperationNotAllowed(
homeassistant.config_entries.OperationNotAllowed: The config entry ***.***.***.100 (synology_dsm) with entry_id ee88924a760c2463c18ec64ad8f50dcc cannot be unloaded because it is not in a recoverable state (ConfigEntryState.SETUP_IN_PROGRESS)
2023-01-02 14:30:08.154 DEBUG (MainThread) [homeassistant.components.synology_dsm.coordinator] Finished fetching ***.***.***.100 SynologyDSMCentralUpdateCoordinator data in 13.476 seconds (success: False)
2023-01-02 14:30:28.157 DEBUG (SyncWorker_6) [synology_dsm.synology_dsm] Creating new session
2023-01-02 14:30:28.157 DEBUG (SyncWorker_6) [synology_dsm.synology_dsm] API: SYNO.API.Info```
Read more comments on GitHub >

github_iconTop Results From Across the Web

Security | DSM - Knowledge Center - Synology
Logout timer (minutes): Users will be automatically logged out from DSM if they are inactive for the time period specified here. Enter any...
Read more >
Synology DSM timeout Error when HA starts 0.112.0 #37310
The problem. I get an error in the log when HA starts related to synolgy dsm integration. Environment. Home Assistant Core release with...
Read more >
Synology integration stops working - Configuration
It works fine when I create and configure the integration, but after HA restart it won't come up again as the initialization runs...
Read more >
Solving DDNS connection timeout issues
It sounds like a inbound firewall rule on the NAS is blocking the connection on your laptop. Check your firewall logs to see...
Read more >
Connection not estasblished to my Synology NAS
We are happy to announce a new integration of our remote connectivity solution for @SlackHQ. Users can now launch web-based #TeamViewer remote ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found