Installation of DSM Integration fails

Tags: #<Tag:0x00007fc4138c2128>

At the initial setup of HA, my Synology (DS1515) was recognized. I decided to install other integrations first and get back to it later.

Now that I am trying to install the DSM integration I keep getting the “failed to connect”. DSM version: DSM 6.2.3-25426 Update 3

HA and Synology are in the same home network. Tot the outside world, my NAS is available using the Synology DNS service “example.diskstation.me”. All settings like port number are kept default.
Of course it’s also available from within the home network, based on ip and port: 192.168.1.115:5001.

Here’s what I did sofar:

  • created a new user on DSM gave it admin rights
  • install the integration
  • used http and https
  • tried with and without port number
  • used the external address and internal IP address of the NAS
  • tried connection with an existing user
  • install the configuration manually (in configuration.yaml)

According to this YT video, the new way of configuring the integration is to remove info from sensors.yaml and add the following lines to configuration.yaml:

 # Synology
 synology_dsm:
   host: http://[my_ip_address]
   port: 5001
   ssl: false
   username: [username]
   password: [password]

What I find strange is that HA sees the NAS, but there’s no way to connect to it.
Also in the Synology logs I see no attempts of a connection.

Is there any way (manually) to get this working?

Thanks!

AFAIK Synology DSM is now configured ONLY through UI - you can remove everything related to Synology from .conf files.

Thanks for reaching out!
I have no Synology entries in any yaml files. There just seems to be no way to reach the Syn from HA. Manually (using a webbrowser) from any device in my network I can reach it.
Tried all possible user/pass/port/ssl combo’s.

What surprises me is that HA does ‘see’ the Syn as a potential integration but there’s no way to connect to it. Not even do I see a login attempt in the Syn log files.

When you go to HA Integrations and there select Synology DSM, is there an error and what do you see there?
That is manual way of adding it.

The error I get while trying to connect (using all username/pw/port combos) is this:

The HA logs show the following error:

Logger: homeassistant.components.synology_dsm.config_flow
Source: components/synology_dsm/config_flow.py:201
Integration: Synology DSM (documentation, issues)
First occurred: 8:20:00 AM (1 occurrences)
Last logged: 8:20:00 AM

{'api': None, 'code': -1, 'reason': 'Unknown', 'details': 'ConnectionError = <urllib3.connection.HTTPConnection object at 0x7f6e97e4f0>: Failed to establish a new connection: [Errno -3] Try again'}

Is this same IP address as your Synology? If yes, did you maybe try 127.0.01? Sometimes there can be problem routing traffic internal if on same IP address. Or if using Docker, you can also try using Docker IP address (gateway address). Just for test.

No, HA runs native on a Pi4 (xxx.xxx.xxx.90).
Still surprised that HA detected Synology on first install, but it’s not available.
All other devices can reach Synology.

I will update to the latest version of DSM later today.

Upgrade to DSM 7 is done. Still no luck connecting.
I find this in the HA logs:

Logger: homeassistant.components.synology_dsm.config_flow
Source: components/synology_dsm/config_flow.py:201
Integration: Synology DSM (documentation, issues)
First occurred: 8:20:00 AM (12 occurrences)
Last logged: 3:29:48 PM

{'api': None, 'code': -1, 'reason': 'Unknown', 'details': 'ConnectionError = <urllib3.connection.HTTPSConnection object at 0x7f7146a310>: Failed to establish a new connection: [Errno -3] Try again'}
{'api': None, 'code': -1, 'reason': 'Unknown', 'details': 'ConnectionError = <urllib3.connection.HTTPConnection object at 0x7f6b56c0d0>: Failed to establish a new connection: [Errno -3] Try again'}
{'api': None, 'code': -1, 'reason': 'Unknown', 'details': 'ConnectionError = <urllib3.connection.HTTPSConnection object at 0x7f696d1550>: Failed to establish a new connection: [Errno -3] Try again'}
{'api': None, 'code': -1, 'reason': 'Unknown', 'details': 'ConnectionError = <urllib3.connection.HTTPSConnection object at 0x7f68d473a0>: Failed to establish a new connection: [Errno -3] Try again'}
{'api': None, 'code': -1, 'reason': 'Unknown', 'details': 'ConnectionError = <urllib3.connection.HTTPConnection object at 0x7f6b559550>: Failed to establish a new connection: [Errno -3] Try again'}

If I go to http://xxx.xxx.xxx.xxx using a webbrowser I get the popup the connection is not safe. I click Proceed Anyway and only then will I get to the logon prompt of the Synology. Could that be the case? That HA keeps trying (multiple times according to the logs) to connect using http:

If only there was an option to install this manually, like you explain in your video.

Hi
did you try with just the IP or the hostname in the host-field, on port 5001, like this? Sorry, UI is german, forgot to switch to english before taking the screenshot.

Armin

Hi Armin,

I tried all possible combinations for username/password/port/host/SSL etc.

My guess is that it’s something with DNS.

I see error messages in the HA logs, but zero login attempts on the Synology.

Hi
ok, the above worked for me yesterday evening on my test system.
Home Assistant 2021.9.3, Core Installation in Python 3.8 venv
Synology DSM 7.0-41890
Works also on my LIVE System with 2021.9.6, connected to the Synology, but I can’t recall how I entered the connection information

Checked the firewall on the Synology?
There is also configuration to block devices after a certain number of failed logins. Control Panel / Security / Protection. Perhaps you locked your Pi4 out when trying to connect.

Armin

Hi Armin,
Thanks again, but I think I tried all the options.
At some point I removed all the firewall / blocking options in the DSM and even whitelisted the HA ip address. My Synology can be reached from anywhere in the world yet not my HA on a PI that’s in the same rack :frowning:

After the latest HA update I tried all of the above settings / combinations again, but no luck:

Logger: homeassistant.components.synology_dsm.config_flow
Source: components/synology_dsm/config_flow.py:181
Integration: Synology DSM (documentation, issues)
First occurred: 9:16:34 AM (2 occurrences)
Last logged: 9:16:53 AM

{'api': None, 'code': -1, 'reason': 'Unknown', 'details': 'ConnectionError = <urllib3.connection.HTTPConnection object at 0x7f9ec34670>: Failed to establish a new connection: [Errno -3] Try again'}
{'api': None, 'code': -1, 'reason': 'Unknown', 'details': 'ConnectionError = <urllib3.connection.HTTPSConnection object at 0x7f9ee8ee20>: Failed to establish a new connection: [Errno -3] Try again'}

Some more actions I tried:

  • enable quickconnect;
  • added entry in HA hosts file to point to Synology

nothing :frowning:

Hi
can you put this into your configuration.yaml

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

Should enable debug logging for synology_dsm component and the library(?). Not sure if this is the right terminology.

Doing this my test system gets very verbose for the Synology and writes detailled information about the communication:

2021-10-07 18:33:37 DEBUG (SyncWorker_3) [synology_dsm.synology_dsm] Creating new session
2021-10-07 18:33:37 DEBUG (SyncWorker_3) [synology_dsm.synology_dsm] Request url: https://192.168.x.x:5001/webapi/query.cgi?api=SYNO.API.Info&version=1&method=query
2021-10-07 18:33:37 DEBUG (SyncWorker_3) [synology_dsm.synology_dsm] Request status_code: 200

followed by all the details about the sensors… I guess your’s shoud throw errors already with the first request.
Armin

have a look here, there is an open issue on git hub :face_with_thermometer:

saw that, many similarities. probably only a few people encountering this problem.

I enabled the extra logging, but the (only) error I get is the same:

Logger: homeassistant.components.synology_dsm.config_flow
Source: components/synology_dsm/config_flow.py:181
Integration: synology_dsm (documentation, issues)
First occurred: 12:09:03 PM (1 occurrences)
Last logged: 12:09:03 PM

{'api': None, 'code': -1, 'reason': 'Unknown', 'details': 'ConnectionError = <urllib3.connection.HTTPConnection object at 0x7f8751e9d0>: Failed to establish a new connection: [Errno -3] Try again'}

Hi
that’s all in the home-assistant.log file?

sorry, no other idea then,
you might want to open an issue on github for the synology_dsm integration, perhaps one of the developers for the integration picks it up…

Armin

Thanks armin!
Maybe I just have to get myself a new NAS :wink:

one more thought…
the log you are posting seems to be what’s is displayed in the Configuration/Logs-UI, what you see when you click on one of Warnings or Errors posted there.

Do you have access to the real home-assistant.log file stored in the Home Assistant folder on disk or did you press the “LOAD FULL HOME ASSISTANT LOG”-Button in the “Logs” screen?
THis contains the log in the format I posted yesterday together with the logger configuration.

I believe the “Logs”-Screen in the Web-UI only shows the “Error” and “Warning” content of the logs, the DEBUG-Information is not shown there.

Armin