Synology Diskstation integration fails to setup after upgrade to 2023.10.1

Hello,

after upgrading to 2023.10.1 and restarting HA, the Synology DS integration is failing to setup.

The integration was working since long time, going through several updates of HA and DS, but now it is not working anymore. Besides the HA update, no other changes on the DS and HA have been done.

I am using a dedicated user on the DS (homeassistant) with admin rights and 2FA active.

I have already tried to remove the integration, to restart the DS and HA and to enabled it again.
The configuration goes through successfully, also the 2FA is successful, but then no devices/entities are found.

I get only a single error in the log (code: 1330):

2023-10-10 13:53:23.302 DEBUG (MainThread) [synology_dsm.synology_dsm] API: SYNO.Core.SecurityScan.Status
2023-10-10 13:53:23.302 DEBUG (MainThread) [synology_dsm.synology_dsm] Request Method: GET
2023-10-10 13:53:23.314 DEBUG (MainThread) [synology_dsm.synology_dsm] Request url: https://192.168.xxx.xx:xxxx/webapi/entry.cgi?api=SYNO.Core.SecurityScan.Status&version=1&method=system_get&_sid=*********&SynoToken=*********
2023-10-10 13:53:23.314 DEBUG (MainThread) [synology_dsm.synology_dsm] Response status_code: 200
2023-10-10 13:53:23.314 DEBUG (MainThread) [synology_dsm.synology_dsm] Response headers: {'Server': 'nginx', 'Date': 'Tue, 10 Oct 2023 11:53:23 GMT', 'Content-Type': 'application/json; charset="UTF-8"', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=20', 'Set-Cookie': 'id=IC_hG6pMJwq-BhTJAgyaXdz69ReSi3NdzQ4j7KNwjIg2ji7K3eLPNSl4OQB0WNLQgFOcNI4gc7HBenz0wYmhw0;expires=Tue, 17-Oct-2023 11:53:23 GMT;max-age=604800;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-10-10 13:53:23.316 DEBUG (MainThread) [synology_dsm.synology_dsm] Successful returned data
2023-10-10 13:53:23.316 DEBUG (MainThread) [synology_dsm.synology_dsm] RESPONSE: {'error': {'code': 1300}, 'success': False}
2023-10-10 13:53:23.316 DEBUG (MainThread) [synology_dsm.synology_dsm] Session error: 1300
2023-10-10 13:53:23.316 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Connection error during setup of '2180SKR2GY98Y' with exception: {'api': 'SYNO.Core.SecurityScan.Status', 'code': 1300, 'reason': 'Unknown', 'details': None}

I have found a similar issue in the forum, but it was in 2022 and has been fixed. indeed my DS integration was working with the previous HA version.

The DS is running with the DSM 7.2-64570 Update 1.

What could be the cause?
Thanks.

Weird: according to their API docs, error 1300 means “Failed to compress files/folders.” Can you log in to the admin web pages for your Synology and see if the logs show any complaints along those lines, or related to disk space, or scheduled jobs, or…something?

Hi,
thanks for the prompt feedback.
On the diskstation there are no error logs related to HA. Only some logs showing that the HA user has successfully signed in (also with 2FA), but nothing else.
I have also not found any other error on the DS. Space is more than enough. I have no scripts running and only one task that starts at boot time to setup a webpage.
I am a bit lost. Cannot find the root cause.

Here below some more logs just before the error comes up…

Creating new session
API: SYNO.API.Info
Request url: https://192.168.xxx.xxx:xxx/webapi/query.cgi?api=SYNO.API.Info&version=1&method=query
Response status_code: 200
Successful returned data
RESPONSE: ...

API: SYNO.API.Auth
Request url: https://192.168.xxx.xxx:xxx/webapi/entry.cgi?account=*********&passwd=*********&enable_device_token=yes&device_name=homeassistant&device_id=*********&api=SYNO.API.Auth&version=7&method=login
Response status_code: 200
Successful returned data
RESPONSE: ...
Authentication successful, token: ...

API: SYNO.DSM.Info
Request url: https://192.168.xxx.xxx:xxx/webapi/entry.cgi?api=SYNO.DSM.Info&version=2&method=getinfo&_sid=*********&SynoToken=*********
Response status_code: 200
Successful returned data
RESPONSE: ...

API: SYNO.Core.Upgrade.Server
Request url: https://192.168.xxx.xxx:xxx/webapi/entry.cgi?api=SYNO.Core.Upgrade.Server&version=4&method=check&_sid=*********&SynoToken=*********
Response status_code: 200
Successful returned data
RESPONSE: ...

API: SYNO.DSM.Network
Request url: https://192.168.xxx.xxx:xxx/webapi/entry.cgi?api=SYNO.DSM.Network&version=2&method=list&_sid=*********&SynoToken=*********
Response status_code: 200
Successful returned data
RESPONSE: ...

API: SYNO.Core.SecurityScan.Status
Request url: https://192.xxx.xxx.xxx:xxx/webapi/entry.cgi?api=SYNO.Core.SecurityScan.Status&version=1&method=system_get&_sid=*********&SynoToken=*********
Response status_code: 200
Successful returned data
RESPONSE: {'error': {'code': 1300}, 'success': False}
Session error: 1300
Connection error during setup of '2180SKR2GY98Y' with exception: {'api': 'SYNO.Core.SecurityScan.Status', 'code': 1300, 'reason': 'Unknown', 'details': None}

The error seems connected to the Security Scan reply.
On the DS I have no errors on security.
Any idea of where the problem can be?
Thanks.

Could you remove 2FA temporarily, to simplify the connection?

I tried, but then HA complaint that a 2FA connection was required. So I put it back.
On the HA I am somehow blocked and I do not know how to proceed.
On the DS however, I have opened a ticked to Synology, because I cannot run the Security Check app (all the rest is OK). I do not know if there is a connection between the 2 issues, but it is worth trying to check.

I have run some further tests and I get now this error message from HA:

Logger: homeassistant.config_entries
Source: config_entries.py:423
First occurred: 11:06:55 (3 occurrences)
Last logged: 11:26:32

Config entry '192.168.xxx.xxx' for synology_dsm integration could not authenticate: reason: Two-step authentication required for account: homeassistant

The problem is that the user “homeassistant” does have 2FA enabled on the DS and when I configure the integration in HA I am inserting the username/password/2FA code and all are accepted with success.

Hello,

the integration is still not working for me.

I have solved all the issues on the diskstation, but on the HA side I still cannot connect.
This is really annoying as it has been running for years until some weeks ago.

On the DSM I see in the logs that the user has passed the first authentication of the 2FA and then that has signed in successfully, but not that has passed the second authentication of the 2FA. does someone has this kind of logs on the DSM?

On the HA it says “successful” to both, but then no instances are found.
In the HA logs I find the following report:

Config entry 'xxx' for synology_dsm integration could not authenticate: reason: Two-step authentication required for account homeassistant

but the account homeassistant does have 2FA activated and HA is alsso asking for the code and giving a successful status when inserting it.

Is there eventually any cache I can delete where some info might still be configured in the wrong way?

Thanks.

Hello,
May I ask if this issue has been resolved?
I’m also encountering this problem now. I searched online for a long time but couldn’t find a suitable solution.

Hi,
I cannot say if the issue is solved, but I have found a workaround for me and I am using it now.
Here my comments Cannot connect anymore to Synology DSM · Issue #110848 · home-assistant/core · GitHub.

Hi,
Thank you for your reply. I saw this solution on github yesterday, but after trying it, it doesn’t seem to work for me. I’m trying to see if there are other methods.

Hej Vic,

Did you manage to get it working now? I’m trying to connect my 720+ to HA, but can’t figure out how to make it happen. I constantly get a ‘cannot connect’ or ‘unknown’ error. When i first set up HA this spring, i got notifications that HA discovered my NAS. At that time i did not need the integration, so i dismissed it. Now i do, but HA doesn’t discover my NAS and manually connecting won’t work. Hope you got it up and running and if so, can share how you did it.
Big thanks in advance,
Maan

Hi @miemamiman,

I have my DS connected to HA, but without F2A.
I could not find a way to connect the HA using F2A enabled till now.

I have created a dedicated user on the DS with admin rights, but without access to any application/service. In this way I have minimized the risk in case somebody is finding a way to use this user to get into my DS.
Then I have setup the connection from HA (add Integration / Synology NAS…) using this dedicated DS user, without the F2A, using the local IP address.

Hello Vic,
So kind of you to react so fast!!
I also have created a dedicated admin user with no rights other then Surveillance Station access and without 2FA.

Then i typed:

Host; 192.168.1.X
Username: ABCDE
Password: FGHIJ
Port: 1234 (I have changed the default port of my NAS)

Unticked ‘uses an SSL certificate’ and ‘verify SSL certificate’

Then, when i click submit i get a ‘failed to connect’

So frustrating!!

But thanks a lot for your info. I really appreiated it!

Kindest regards,

Maan

Hi Maan,
can you connect from another computer to the DS using the specific user and the parameters above?
If not, then you should check the user setup on the DS.
If yes, it might be a firewall issue either on the HA machine or on the DS itself.
On both my HA and DS I have closed all ports except for those I need.

Hi Vic,

Apologies for the late reply. I didn’t get a nofification that you had written to me. But…… YOU ARE A HERO!!! When i logged in with the new credentials, i noticed that for the admin group. 2FA was mandatory, so i had to remove that requirement for this user first.

BIG THANK YOU for your help!!! I really appreciate it.

Have a wonderful day. My best, Maan