QNAP sensor error KeyError: 'authPassed

I get the error KeyError: 'authPassed while trying to use the QNAP sensor with my QNAP TS-453A with firmware 4.3.4.0675

Failed to fetch QNAP stats from the NAS
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/components/sensor/qnap.py", line 190, in update
    self.data["system_stats"] = self._api.get_system_stats()
  File "/usr/local/lib/python3.6/site-packages/qnapstats/qnap_stats.py", line 207, in get_system_stats
    force_list=("DNS_LIST")
  File "/usr/local/lib/python3.6/site-packages/qnapstats/qnap_stats.py", line 67, in _get_url
self._init_session()
  File "/usr/local/lib/python3.6/site-packages/qnapstats/qnap_stats.py", line 49, in _init_session
    if self._login() is False:
  File "/usr/local/lib/python3.6/site-packages/qnapstats/qnap_stats.py", line 57, in _login
    result = self._execute_post_url("authLogin.cgi", data, False)
  File "/usr/local/lib/python3.6/site-packages/qnapstats/qnap_stats.py", line 98, in _execute_post_url
    return self._handle_response(resp, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/qnapstats/qnap_stats.py", line 112, in _handle_response
    auth_passed = data['authPassed']
KeyError: 'authPassed

The configuration I have:
- platform: qnap
host: !secret qnap_ip
username: !secret qnap_username
password: !secret qnap_password
verify_ssl: false
monitored_conditions:
- status
- system_temp
- cpu_usage
- memory_free
- memory_used
- network_link_status
- network_tx
- network_rx
- drive_smart_status
- drive_temp
- volume_percentage_used

When I try from the command line of the HomeAssistant:
#!/usr/bin/env python3
from qnapstats import QNAPStats
from pprint import pprint
qnap = QNAPStats('ip', port, 'user', 'password')
pprint(qnap.get_system_stats())

I get the same error message. I made sure the password is correct even created an additional user with a simple password (e.g. not containing complex characters) to try but still got the same error message.

Hi – did you ever manage to solve this?

I’ve just tried the QNAP sensor and am getting the same error

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.7/site-packages/qnapstats/qnap_stats.py", line 207, in get_system_stats
    force_list=("DNS_LIST")
  File "/usr/local/lib/python3.7/site-packages/qnapstats/qnap_stats.py", line 67, in _get_url
    self._init_session()
  File "/usr/local/lib/python3.7/site-packages/qnapstats/qnap_stats.py", line 49, in _init_session
    if self._login() is False:
  File "/usr/local/lib/python3.7/site-packages/qnapstats/qnap_stats.py", line 57, in _login
    result = self._execute_post_url("authLogin.cgi", data, False)
  File "/usr/local/lib/python3.7/site-packages/qnapstats/qnap_stats.py", line 98, in _execute_post_url
    return self._handle_response(resp, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/qnapstats/qnap_stats.py", line 112, in _handle_response
    auth_passed = data['authPassed']
KeyError: 'authPassed'