QNAP NAS Support

Hi,

I’d like to voice a request for QNAP NAS support, along with the security camera features. Ideally something similar to the support for Synology DSM would be great, as they’re quite similar.

1 Like

Hey @matts1900,

I’m actually working on this right now, and it is based off the Synology DSM code :slight_smile: I’m about 70% done - I’ve got ~20 sensors defined, and I’m able to pull their data. Here’s a screenshot of where I’m at now:

That’s showing about half of the sensors, and there are definitely some number formatting and unit issues I need to clear up. I’m hoping to have those resolved this weekend.

I’m not currently working on any security camera features though - just data about the NAS itself.

Once I get those final issues resolved, would you be interested in helping me test it? What model QNAP do you have?

1 Like

Hi @colinodell

I have a TS-453 Pro and could help test if needed …

Thanks for the offer @nodecentral!

How familiar are you with Linux and installing Python packages? I created a library which fetches the information from the QNAP by emulating the web interface: https://pypi.python.org/pypi/qnapstats If you could help me test that it would be a huge help! Basically:

  1. Use any system on your network that has Python 3 installed (perhaps your HA server)
  2. Follow the Installation steps in the documentation
  3. Run the sample script, changing the host, port, username, and password in that third line of code
  4. Let me know if it runs fine - maybe even post a copy of the output

If you could do that it would be a huge help! And if not no worries.

Hi @colinodell

I’m afraid I’m not familiar with Python at all, but will give it a go when I can find time. Before is start, I think I might be missing something. Why do you need to know the details/stats of my NAS?

This looks :+1: great

@nodecentral I don’t need to know the details themselves, just that my Python library obtains the correct stats for your system.

Anyway, support for QNAP sensors have been merged into the codebase! I’m expecting it’ll be included with the 0.38 release. Please give it a try and let me know if you have any issues.

I did try the component for first time today with the 0.38 relaease, but unfortunatelly I didn’t manage as it seems to get it work. It seems that somethings wrong with the authentication.

In the beginning I tried with a user that’s in the administrators group but that has a two factor authentication and didn’t work.
Then I added a new user that was just in the everyone group in the beginning and then in the administrator group too without two factor authentication but both of the times didn’t authenticate.

My configuration looks like the following:

- platform: qnap
  host: host_ip
  username: uname
  password: password
  ssl: true
  port: 443
  monitored_conditions:
    - status
    - cpu_usage
    - memory_percent_used
    - network_tx
    - volume_percentage_used

and I can see the following errors in the log

17-02-12 11:37:28 ERROR (Thread-5) [homeassistant.components.sensor.qnap] Failed to fetch QNAP stats from the NAS.

requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=‘https’, port=80): Max retries exceeded with url: //host_ip:443/cgi-bin/authLogin.cgi (Caused by NewConnectionError(‘<requests.packages.urllib3.connection.HTTPConnection object at 0x6cdc86b0>: Failed to establish a new connection: [Errno -2] Name or service not known’,))

I guess both of the error depends on that it didn’t sucessfully authenticated.

@dimmanramone This PR will likely resolve your issue: https://github.com/home-assistant/home-assistant/pull/5919

Ok. I guess this change is coming with the next update of the 0.38 so I don’t have to make the changes by myself :slight_smile:

@colinodell I tried to install the PR manually by updating the qnapstats and the qnap.py component with no luck.
I still get the same error even if I updated my configuration with verify_ssl: false

Probably it is me that I didn’t really manage to updated the component. Any help would be appreciated.

Hi,

I just upgraded to 0.39.0 and I can confirm that, with verify_ssl: false, the component works with my TS-253A :slight_smile:
Great work!

Sebastian

I finally got the chance to add the entry to my configuration.yaml, and it works well. And I created a group for it.

group:
QNAP:
name: QNAP Status
entities:
- sensor.abcdefg_volume_used_datavol1
- sensor.abcdefg_cpu_usage
- sensor.abcdefg_memory_usage
- sensor.abcdefg_network_up_eth0
- sensor.abcdefg_network_up_eth1
- sensor.abcdefg_network_up_eth2
- sensor.abcdefg_network_up_eth3
- sensor.abcdefg_status
- sensor.abcdefg_volume_used_datavol1