Home Assistant release with the issue:
0.88.2
Last working Home Assistant release (if known):
Operating environment (Hass.io/Docker/Windows/etc.):
MacOS X Mojave
Component/platform:
Netatmo
Description of problem:
Getting en setup error for Netatmo component. API, KEY, User and Password are correct, but still error persists. Tried to go back to severeal previous version of HA but still doesn't work.
2019-03-10 12:27:28 ERROR (MainThread) [homeassistant.setup] Error during setup of component netatmo
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/homeassistant/setup.py", line 154, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/homeassistant/components/netatmo/__init__.py", line 48, in setup
'read_station read_camera access_camera '
File "/Users/Pinuccio/.homeassistant/deps/lib/python/site-packages/pyatmo.py", line 85, in __init__
self._accessToken = resp["access_token"]
TypeError: 'NoneType' object is not subscriptable
Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):
netatmo:
api_key: !secret netatmo_api_key
secret_key: !secret netatmo_secret_key
username: !secret netatmo_user
password: !secret netatmo_password
Traceback (if applicable):
Additional information:
Same problem on 0.89.1
Same problem 0.89.2
I fixed it. Problem was with socat in hassio supervisor container. Socat cannot start because apparmor settings not allow to load neccessary libraries.
Sounds great but could you explain more what you did exactly ?
sudo nano /usr/share/hassio/apparmor/hassio-supervisor
find section:
profile /usr/bin/socat ....
add /lib/* mr,
reboot
Your aproach works wfor hassio which is supposed to run on a Raspberry Pi, but I have it installed on a macos powered device
In the end I solved my issue by restarting the whole Raspeberry Pi instead of just restarting Home Assistant.
Going to close this issue as it seems there are multiple possible fixes. Let me know if I misunderstood and i'll reopen.
I don鈥檛 have a fix right now....Issue is still there. what are these multiple possibilities ?
Might be related to #23380 and fixed with #23429.
@gcosta74 Is this still an issue with 0.92.1?
Unfortunately yes, just tried 92.1 a few days ago. Had also issues with zwave not updating to ozwave 0.1.4 so had to go back to 90.2
@gcosta74 I suspect that for some reason the authentication fails. Can you please run the following script and send me the errors
import pyatmo
import logging
from urllib.error import HTTPError
logging.basicConfig(level=logging.DEBUG)
_LOGGER = logging.getLogger(__name__)
_CLIENT_ID = '123456789abcd1234'
_CLIENT_SECRET = '123456789abcd1234'
_USERNAME = '[email protected]'
_PASSWORD = 'abcdef-123456-ghijkl'
try:
authorization = pyatmo.ClientAuth(clientId = _CLIENT_ID,
clientSecret = _CLIENT_SECRET,
username = _USERNAME,
password = _PASSWORD,
scope = "read_camera access_camera")
except (HTTPError, TypeError):
_LOGGER.error("Unable to connect to Netatmo API")
raise
print(authorization)
How do I run this on a macos x ? Tried with python and as a python_scripts in HA but shows me always errors
Just run this on the command line in the same venv as HA or in a separate if you prefer. It only requires pyatmo. Store as a file and run it with python3 <your_file>.py.
Seems that I found the error:
ModuleNotFoundError: No module named 'pyatmo'
I havent installed HA in a venv on osx.
Just installed python 3.6 and then istalled HA with command pip3 install homeassistant
pyatmo.py is present in folder HA-Folderdepslibpythonsite-packages
Just installed pyatmo 1.10 with command pip3 install pyatmo an run the script.
This is the result:
ERROR:smart_home:Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect
server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 817, in __init__
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1077, in do_handshake
self._sslobj.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/smart_home/__init__.py", line 39, in postRequest
if params
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)>
ERROR:__main__:Unable to connect to Netatmo API
Traceback (most recent call last):
File "python_scripts/netatmo.py", line 19, in <module>
scope = "read_camera access_camera")
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyatmo.py", line 85, in __init__
self._accessToken = resp["access_token"]
TypeError: 'NoneType' object is not subscriptable
Is this of any Help ? Seems like ssl issues.
I just uninstalled pyatmo again with command pip3 uninstall pyatmo.
when i run pip3 show pyatmo it shows me nothing.
Updated HA to 0.92.1 and started HA again with command hass --daemon
This is the log entry now:
2019-05-01 20:29:43 ERROR (SyncWorker_7) [homeassistant.util.package] Unable to install package homeassistant-pyozw==0.1.4: ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/1j/31wbb13d3xxg_cwxyr_v69_w0000gn/T/pip-install-_j3qtzlg/homeassistant-pyozw/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/1j/31wbb13d3xxg_cwxyr_v69_w0000gn/T/pip-record-9i10q1_x/install-record.txt --single-version-externally-managed --prefix '' --compile --user --prefix=:
ERROR: ImportError in : from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
sysargv ['-c', 'install', '--record', '/private/var/folders/1j/31wbb13d3xxg_cwxyr_v69_w0000gn/T/pip-record-9i10q1_x/install-record.txt', '--single-version-externally-managed', '--prefix', '', '--compile', '--user', '--prefix=']
Found SETUP_DIR : /private/var/folders/1j/31wbb13d3xxg_cwxyr_v69_w0000gn/T/pip-install-_j3qtzlg/homeassistant-pyozw
NameError in : class bdist_wheel(_bdist_wheel) - Use bdist_egg instead
<pyozw_setup.EmbedTemplate object at 0x105833dd8>
{'name': 'libopenzwave', 'sources': ['openzwave-embed/open-zwave-hass/python-openzwave/src-lib/libopenzwave/libopenzwave.cpp'], 'include_dirs': ['src-lib/libopenzwave/', 'openzwave-embed/open-zwave-hass/cpp/src', 'openzwave-embed/open-zwave-hass/cpp/src/value_classes', 'openzwave-embed/open-zwave-hass/cpp/src/platform', 'openzwave-embed/open-zwave-hass/cpp/build/mac'], 'define_macros': [('PY_LIB_VERSION', '0.1.4'), ('PY_SSIZE_T_CLEAN', 1), ('PY_LIB_FLAVOR', 'embed'), ('PY_LIB_BACKEND', 'cpp')], 'libraries': [], 'extra_objects': ['openzwave-embed/open-zwave-hass/libopenzwave.a'], 'extra_compile_args': ['-stdlib=libc++', '-mmacosx-version-min=10.7'], 'extra_link_args': ['-framework', 'CoreFoundation', '-framework', 'IOKit'], 'language': 'c++'}
['six', 'PyDispatcher>=2.0.5']
running install
flavor embed
running build_openzwave
Found g++ : /usr/bin/g++
Found gcc : /usr/bin/gcc
Found make : /usr/bin/make
Found gmake : None
Found cython : None
Found pkg-config : None
fetching https://raw.githubusercontent.com/home-assistant/python-openzwave/hass/archives/open-zwave-hass-0.1.4.zip into openzwave-embed/open-zwave.zip for version 0.1.4
error: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)>
----------------------------------------
ERROR: Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/1j/31wbb13d3xxg_cwxyr_v69_w0000gn/T/pip-install-_j3qtzlg/homeassistant-pyozw/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/1j/31wbb13d3xxg_cwxyr_v69_w0000gn/T/pip-record-9i10q1_x/install-record.txt --single-version-externally-managed --prefix '' --compile --user --prefix=" failed with error code 1 in /private/var/folders/1j/31wbb13d3xxg_cwxyr_v69_w0000gn/T/pip-install-_j3qtzlg/homeassistant-pyozw/
2019-05-01 20:29:43 ERROR (MainThread) [homeassistant.requirements] Not initializing zwave because could not install requirement homeassistant-pyozw==0.1.4
2019-05-01 20:29:43 ERROR (MainThread) [homeassistant.setup] Setup failed for zwave: Could not install all requirements.
2019-05-01 20:29:47 ERROR (SyncWorker_7) [smart_home] Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect
server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 817, in __init__
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1077, in do_handshake
self._sslobj.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/Pinuccio/.homeassistant/deps/lib/python/site-packages/smart_home/__init__.py", line 39, in postRequest
if params
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)>
2019-05-01 20:29:47 ERROR (MainThread) [homeassistant.setup] Error during setup of component netatmo
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/homeassistant/setup.py", line 156, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/homeassistant/components/netatmo/__init__.py", line 91, in setup
'read_station read_camera access_camera '
File "/Users/Pinuccio/.homeassistant/deps/lib/python/site-packages/pyatmo.py", line 85, in __init__
self._accessToken = resp["access_token"]
TypeError: 'NoneType' object is not subscriptable
I'd suggest to use homebrew and install dependencies with brew install python3 openssl libffi. I'd also suggest to use a virtual env for HA to keep dependencies separated.
It is even easier that that.
Jus run the following on my mac:
/Applications/Python 3.6/Install Certificates.command
And this fixed it
So, we can close this?
sure I will do this
Most helpful comment
I fixed it. Problem was with socat in hassio supervisor container. Socat cannot start because apparmor settings not allow to load neccessary libraries.