Homeassistant and Zoneminder problems with self-signed cert

I just started using Home Assistant. I’m running Hass.io in a Docker container on an Ubuntu 18.04 PC. I run ZoneMinder on a second Ubuntu 18.04 machine.

A couple of other people have had this problem:

I tried to follow gooorooo’s suggesting to edit zoneminder.py, but “/usr/lib/python3.6/site-packages/homeassistant/components/zoneminder.py” doesn’t exist on my machine. I followed some instructions on StackExchange to look around inside the Docker container, and I found the file inside the Docker container, but every time I restart hassio my changes are lost.

It would be great if the Zoneminder section in configuration.yaml had an option to ignore cert errors. Otherwise, is there some way I can add the cert from my ZoneMinder box to some kind of circle of trust?

Here’s the relevant part from my homeassistant.log file:

2018-07-17 14:12:41 ERROR (MainThread) [homeassistant.setup] Error during setup of component zoneminder
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/usr/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 343, in _make_request
self._validate_conn(conn)
File “/usr/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 849, in validate_conn
conn.connect()
File “/usr/lib/python3.6/site-packages/urllib3/connection.py”, line 356, in connect
ssl_context=context)
File "/usr/lib/python3.6/site-packages/urllib3/util/ssl
.py", line 372, in ssl_wrap_socket
return context.wrap_socket(sock)
File “/usr/lib/python3.6/ssl.py”, line 407, in wrap_socket
_context=self, _session=session)
File “/usr/lib/python3.6/ssl.py”, line 814, in init
self.do_handshake()
File “/usr/lib/python3.6/ssl.py”, line 1068, in do_handshake
self._sslobj.do_handshake()
File “/usr/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:777)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/requests/adapters.py”, line 445, in send
timeout=timeout
File “/usr/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File “/usr/lib/python3.6/site-packages/urllib3/util/retry.py”, line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘192.168.1.240’, port=443): Max retries exceeded with url: /zm//index.php (Caused by SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)’),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/setup.py”, line 146, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/lib/python3.6/site-packages/homeassistant/components/zoneminder.py”, line 67, in setup
return login()
File “/usr/lib/python3.6/site-packages/homeassistant/components/zoneminder.py”, line 80, in login
req = requests.post(ZM[‘url’] + ‘/index.php’, data=login_post)
File “/usr/lib/python3.6/site-packages/requests/api.py”, line 112, in post
return request(‘post’, url, data=data, json=json, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/api.py”, line 58, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/sessions.py”, line 512, in request
resp = self.send(prep, **send_kwargs)
File “/usr/lib/python3.6/site-packages/requests/sessions.py”, line 622, in send
r = adapter.send(request, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/adapters.py”, line 511, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host=‘192.168.1.240’, port=443): Max retries exceeded with url: /zm//index.php (Caused by SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)’),))

I ended up reverse proxying my ZoneMinder box through another machine that has a valid SSL certificate.