Error using new QNAP component

I get this error with my TS-419P+ QNAP NAS:

17-02-12 21:09:56 ERROR (Thread-6) [homeassistant.components.sensor.qnap] Failed to fetch QNAP stats from the NAS.
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/sensor/qnap.py", line 187, in update
    self.data["system_stats"] = self._api.get_system_stats()
  File "/home/pi/.homeassistant/deps/qnapstats/qnap_stats.py", line 230, in get_system_stats
    "model": root["cpu_model"],
KeyError: 'cpu_model'
17-02-12 21:09:56 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform qnap
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/sensor/qnap.py", line 123, in setup_platform
    nics = api.data["system_stats"]["nics"].keys()
KeyError: 'system_stats'

Here is my configuration:

sensor:
  - platform: qnap
    host: 192.168.1.91
    username: ********
    password: *************
    monitored_conditions:
      - status
      - cpu_usage
      - memory_percent_used
      - network_tx
      - volume_percentage_used

(Note - I’m not sure how to quote the text so that it shows up properly).

I’m getting the same errors with a TS-231

Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/qnap.py", line 187, in update
    self.data["system_stats"] = self._api.get_system_stats()
  File "/home/homeassistant/.homeassistant/deps/qnapstats/qnap_stats.py", line 232, in get_system_stats
    "temp_c": int(root["cpu_tempc"]),
KeyError: 'cpu_tempc'
17-02-23 19:52:52 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform qnap
Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/qnap.py", line 123, in setup_platform
    nics = api.data["system_stats"]["nics"].keys()
KeyError: 'system_stats'
  host: 192.168.0.168
  username: !secret qnap_user
  password: !secret qnap_pass
  monitored_conditions:
    - status
    - cpu_usage
    - cpu_temp
    - drive_temp
    - volume_percentage_used
    - memory_percent_used
    - network_link_status
    - network_tx```

Any help with this would be most appreciated.

Will

same issue using 4.3.3 (which is not listed on the project site…maybe thats the issue?)

17-04-21 02:33:49 ERROR (Thread-9) [homeassistant.components.sensor.qnap] Failed to fetch QNAP stats from the NAS.
Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/homeassistant/components/sensor/qnap.py”, line 207, in update
self.data[“system_stats”] = self._api.get_system_stats()
File “/var/opt/homeassistant/deps/qnapstats/qnap_stats.py”, line 204, in get_system_stats
force_list=(“DNS_LIST”)
File “/var/opt/homeassistant/deps/qnapstats/qnap_stats.py”, line 69, in _get_url
result = self._execute_get_url(url, **kwargs)
File “/var/opt/homeassistant/deps/qnapstats/qnap_stats.py”, line 82, in _execute_get_url
self._debuglog("Appending access_token (SID: " + self._sid + “) to url”)
TypeError: Can’t convert ‘NoneType’ object to str implicitly

With the 0.42 release, I no longer have this problem. It works great!

My sensor was giving me a similar error. I just needed to change the port and now its up.

  - platform: qnap
    host: 192.168.1.200
    port: 5985
    username: !secret qnap_username
    password: !secret qnap_pass
    monitored_conditions:
      - status
      - cpu_usage
      - memory_percent_used
      - network_tx
      - volume_percentage_used

you don’t need to change the port.

just explicitly state, that your port is 8080. although the component description says that 8080 is set by default, it doesn’t.

Hi,
Got this error while settting up qnap sensor:

2018-04-12 09:18:25 ERROR (SyncWorker_1) [homeassistant.components.sensor.qnap] Failed to fetch QNAP stats from the NAS
Traceback (most recent call last):
File “/usr/src/app/homeassistant/components/sensor/qnap.py”, line 192, in update
self.data[“system_stats”] = self._api.get_system_stats()
File “/usr/local/lib/python3.6/site-packages/qnapstats/qnap_stats.py”, line 204, in get_system_stats
force_list=(“DNS_LIST”)
File “/usr/local/lib/python3.6/site-packages/qnapstats/qnap_stats.py”, line 69, in _get_url
result = self._execute_get_url(url, **kwargs)
File “/usr/local/lib/python3.6/site-packages/qnapstats/qnap_stats.py”, line 82, in _execute_get_url
self._debuglog(“Appending access_token (SID: " + self._sid + “) to url”)
TypeError: must be str, not NoneType
2018-04-12 09:18:34 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/src/app/homeassistant/components/discovery.py”, line 133, in scan_devices
results = await hass.async_add_job(_discover, netdisco)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/app/homeassistant/components/discovery.py”, line 159, in _discover
netdisco.scan()
File “/usr/local/lib/python3.6/site-packages/netdisco/discovery.py”, line 69, in scan
self.daikin.scan()
File “/usr/local/lib/python3.6/site-packages/netdisco/daikin.py”, line 32, in scan
self.update()
File “/usr/local/lib/python3.6/site-packages/netdisco/daikin.py”, line 46, in update
sock.bind((”", UDP_SRC_PORT))
OSError: [Errno 98] Address already in use

Can anyone help me?

B/rgs Mads