QNAP integration not working

I’m struggling to configure/make the QNAP integration work.

Setup: hassio 115.6 on Raspberry Pi 4.
No 3rd party modifications (HACS, etc.)
QNAP configuration section in configuration.yaml looks like this:

# QNAP
sensor:
  - platform: qnap
    host: qnap.local
    port: 443
    ssl: true
    verify_ssl: false
    timeout: 60
    username: <redacted>
    password: <redacted>
    monitored_conditions:
      - status
      - cpu_usage
      - memory_percent_used
      - network_tx
      - volume_percentage_used
      - cpu_temp
      - system_temp
      - network_link_status
      - network_rx
      - drive_smart_status
      - drive_temp
      - volume_percentage_used

2fa has been disabled without making any difference.
The device is located in the local network. I can reach it from the hassio terminal with IP and name (tested with curl).

Error message:



Logger: homeassistant.components.qnap.sensor
Source: components/qnap/sensor.py:194
Integration: qnap (documentation, issues)
First occurred: 11:45:15 (7 occurrences)
Last logged: 11:55:47
Failed to fetch QNAP stats from the NAS

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/qnap/sensor.py", line 194, in update
    self.data["system_stats"] = self._api.get_system_stats()
  File "/usr/local/lib/python3.8/site-packages/qnapstats/qnap_stats.py", line 205, in get_system_stats
    resp = self._get_url(
  File "/usr/local/lib/python3.8/site-packages/qnapstats/qnap_stats.py", line 69, in _get_url
    result = self._execute_get_url(url, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/qnapstats/qnap_stats.py", line 82, in _execute_get_url
    self._debuglog("Appending access_token (SID: " + self._sid + ") to url")
TypeError: can only concatenate str (not "NoneType") to str

Any idea what I could try to make things work?

1 Like

Did you try to put the IP Address in the field host: instead of the hostname? The docs say to use the IP, they don’t say anything about hostnames.

Yes, I started with the IP address.
The current config is just the latest version I tried.

And you get the same error with the IP address?

Error with same config but IP address instead of hostname:



Logger: homeassistant.components.qnap.sensor
Source: components/qnap/sensor.py:194
Integration: qnap (documentation, issues)
First occurred: 12:08:06 (1 occurrences)
Last logged: 12:08:06
Failed to fetch QNAP stats from the NAS

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/qnap/sensor.py", line 194, in update
    self.data["system_stats"] = self._api.get_system_stats()
  File "/usr/local/lib/python3.8/site-packages/qnapstats/qnap_stats.py", line 205, in get_system_stats
    resp = self._get_url(
  File "/usr/local/lib/python3.8/site-packages/qnapstats/qnap_stats.py", line 69, in _get_url
    result = self._execute_get_url(url, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/qnapstats/qnap_stats.py", line 82, in _execute_get_url
    self._debuglog("Appending access_token (SID: " + self._sid + ") to url")
TypeError: can only concatenate str (not "NoneType") to str

And the user you try to connect with is in the admin group? Is your model in the supported list here?

Shouldn’t the port number be 3493?

1 Like

The default is 8080, it should be the port one uses to access the QNAP web interface.

It’s an admin user.
But the port number might be the issue. My QNAP web interface is running on 443, though.

I’m using a TS-213P with 4.4.3.1439
So, not listed there. But the version should be fine. Maybe that’s the problem then.

443 should be the right port. There is no plain text communication on my device and the SSL port is 443 here.

So, the only remaining obstacle that I can see is the hardware. The 213P is officially not tested. The software should not be the issue, I guess.

Interestingly, I do not see anything in the logs on the QNAP. Not even a failed connect. Weird. I would expect some login to work. That should be independent of the hardware itself.

Found the issue:

The problem was in fact the QNAP configuration.
Home Assistant was dumped into the blacklist because I needed a few tries until I got the configuration right.

So: Control Panel/Security and there was an entry for Home Assistant being blocked. Removed it and it works now.

Thank you for your help! Your questions ultimately pointed me in the right direction.

1 Like

Did you need to disable 2FA to make this work? I checked my blacklist and didnt notice any Home Assistant entries.

Yes. 2fa is not working for me

hello for multiple nas what is the correct configuration?

Just add another configuration block to your configuration.yaml, i.e. like the following:

# QNAP TS-xxx
    - platform: qnap
      host: !secret qnapts_host
      username: !secret qnapts_usr
      password: !secret qnapts_pwd
      monitored_conditions:
        - status
        - cpu_usage
        - system_temp
        - memory_percent_used
        - network_tx
        - volume_percentage_used
        - network_link_status
        - network_rx
        - drive_smart_status
        - drive_temp

# QNAP TVS-xxx
    - platform: qnap
      host: !secret qnaptvs_host
      username: !secret qnaptvs_usr
      password: !secret qnaptvs_pwd
      port: !secret qnaptvs_prt
      monitored_conditions:
        - status
        - cpu_usage
        - system_temp
        - memory_percent_used
        - network_tx
        - volume_percentage_used
        - network_link_status
        - network_rx
        - drive_smart_status
        - drive_temp
1 Like

the sencond nas not work…
not sensor available…

Have you configured the 2nd. NAS correctly to allow access from HA?

Also check compatibility here.

do I have to do some configuration on the nas?

Yup. Check the access control configuration on the NAS.

The QNAP integration was broken for a while (since QTS 4.5.4) and works again since HA 8.6. I eventually got it to work but it only works for me without 2FA. Has anyone managed to get it to work with 2FA? how?