colinodell/python-qnapstats

TS-673 Compatability

joebrands opened this issue · 8 comments

"Failed to fetch QNAP stats from the NAS". I am not sure if I need to allow permissions somewhere on my QNAP or if it is a comparability issue with TS-673/v4.5.2

Device Model Number: TS-673

QTS Version: 4.5.2

configuration.yaml

sensor:
  - platform: qnap
    host: 192.168.1.69
    port: 443
    username: notmyusername
    password: notmyactualpassword
    ssl: true
    verify_ssl: false
    monitored_conditions:
      - status
      - cpu_usage
      - memory_percent_used
      - network_tx
      - volume_percentage_used
      - drive_smart_status

XML/Debug Output:

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 267, in get_system_stats
    for dns in root["dnsInfo"]["DNS_LIST"]:
TypeError: 'NoneType' object is not subscriptable

Worth noting that I did also try port: 8080 with no ssl and same result

Check whether the user is an admin user - it seems QNAP devices only provide this information to users with admin permissions. See #19 (comment)

Yep, they are an admin user. Is this an ssl access error or an permissions access error? Ive turned off a lot of services on the QNAP to limit vulnerabilities so I am wondering if one of those needs to be on

Well, it seems the error is that the "dnsInfo" key does not exist in the data being returned from the QNAP. It's very possible this is indeed a compatibility issue where your device never provides that, or it could be something related to security where something is locked down and causing QNAP to not provide that.

Would you be able to run the debug.py script from this library and share the output? (You may want to review and redact certain values for privacy/security, but please try to keep the overall structure as-is if possible.) It will output the raw data this library gets back from the QNAP and will help us determine what data (if any) is being provided and may help us narrow down this issue.

Well apparently not:

2021-03-16 18:26:12 ERROR (MainThread) [custom_components.pyscript.file.debug] Exception in </config/pyscript/debug.py> line 6:
    host = input("192.168.1.69") #prefix with 'https://' if needed
           ^
NameError: name 'input' is not defined

I just tried running it with Pyscript in HASS

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Hello,
Some device cannot have DnsInfo, i open PullRequest #63 to avoid TypeError.
And to start debug, you don't need to add your IP in input you can only run script, you will have prompt to add your ip, port, login, password.

Fixed via #63