Synology integration stops working

Hi, I have a strange issue with my Synology 412+ (I know, quite an old device, but still running strong). It works fine when I create and configure the integration, but after HA restart it won’t come up again as the initialization runs into a timeout - and also HA start takes significantly longer. Deleting and recreating the integration works, but is not a real option of course.
I don’t have the logs atm, but they are not quite useful anyhow.
Any pointers what the issue might be to dig deeper?

Just an idea … have you trying increasing the timeout value from ‘Options’ in the Synology DSM Integration?

image

I have the same behaviour, it seems there was some github activity for the integration but it is indeed not stable for me since…

I have these error types:
Timeout fetching 172NNNNNN000_cameras data

Unexpected error fetching 1720NNNNN7000_switches data: {'api': None, 'code': -1, 'reason': 'Unknown', 'details': 'RequestException = Bad Gateway'}

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/synology_dsm/synology_dsm.py", line 318, in _execute_request
    raise RequestException(response)
requests.exceptions.RequestException: <Response [502]>

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 173, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 143, in _async_update_data
    return await self.update_method()
  File "/usr/src/homeassistant/homeassistant/components/synology_dsm/__init__.py", line 257, in async_coordinator_update_data_switches
    "home_mode": await hass.async_add_executor_job(
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.8/site-packages/synology_dsm/api/surveillance_station/__init__.py", line 142, in get_home_mode_status
    return self._dsm.get(self.HOME_MODE_API_KEY, "GetInfo")["data"]["on"]
  File "/usr/local/lib/python3.8/site-packages/synology_dsm/synology_dsm.py", line 204, in get
    return self._request("GET", api, method, params, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/synology_dsm/synology_dsm.py", line 255, in _request
    response = self._execute_request(request_method, url, params, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/synology_dsm/synology_dsm.py", line 321, in _execute_request
    raise SynologyDSMRequestException(exp) from exp
synology_dsm.exceptions.SynologyDSMRequestException: {'api': None, 'code': -1, 'reason': 'Unknown', 'details': 'RequestException = Bad Gateway'}

And this is in:
image

what should that solve? Just increasing the timeout until it fails? I have to try tonight and get some logs to dig deeper what may cause this. My NAS is reachable 24/7 and runs stable, is not heavily loaded… so this is no performance issue

I’m having the same issue on two Synologys so your hardware shouldn’t be a problem.
If I disable / enable the integration it starts working again.
I just doubled the minutes between scans and timeout settings for one NAS, will see if that makes a difference.

I have re-added the integration and have upped the timeout to 30sec, but left the scan to 15min.
I will monitor the integration and have a look into the logs at the next failure.

When you first described the problem you said that it was entering a timeout, I thought that as the 412+ was old then it might be worth seeing what would happen if you extended the timeout period in the integration options.

As it happens I have an old 412+ that I only use for backups so I installed the SynologyDSM integration for this last night and it appears to be running fine:

If there is anything you want me to try out on my system to try and assist you in trouble-shooting your problem then just let me know.

I’m not yet sure when my integration stops working but think it runs a couple of days without issues and a HA restart doesn’t seem to break it. Will try to monitor it from now on.

I’m currently on 2021.4.4 and OS 5.13 on a RPi3B.

same problem here… :-/ image

My integration worked for three days after restart, now I’ve only contact with one NAS. Log says “Connection error during update, fallback by reloading the entry” and
“Error setting up entry 192.168.1.21 for synology_dsm”.

I have been running the integration for 9 days now with the enlarged timeout and it survived a few restarts and upgrades for now. Let’s see how long this will last :slight_smile: