Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions appdaemon/plugins/hass/hassplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,11 @@ def create_session(self) -> aiohttp.ClientSession:
"""Handles creating an :py:class:`~aiohttp.ClientSession` with the cert information from the plugin config
and the authorization headers for the `REST API <https://developers.home-assistant.io/docs/api/rest>`_.
"""
ssl_context = ssl.create_default_context(capath=self.config.cert_path)
conn = aiohttp.TCPConnector(ssl_context=ssl_context)
if self.config.cert_path is not None or self.config.cert_verify is not False:
ssl_context = ssl.create_default_context(capath=self.config.cert_path)
conn = aiohttp.TCPConnector(ssl_context=ssl_context, ssl=True)
else:
conn = aiohttp.TCPConnector(ssl=False)

connect_timeout_secs = self.config.connect_timeout.total_seconds()
return aiohttp.ClientSession(
Expand Down
2 changes: 0 additions & 2 deletions docs/CONFIGURE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,6 @@ An example of the HASS plugin configured with YAML could look like the following
type: hass
ha_url: <some_url>
token: <token>
cert_path: <path/to/root/CA/cert>
cert_verify: True
namespace: default

Expand Down Expand Up @@ -583,7 +582,6 @@ Or in TOML:
type = "hass"
ha_url = "<some_url>"
token = "<token>"
cert_path = "<path/to/root/CA/cert>"
cert_verify = true
namespace = "default"

Expand Down
3 changes: 0 additions & 3 deletions docs/HASS_API_REFERENCE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ This is the full list of configuration options available for the `Hass` plugin.
* - ``cert_verify``
- optional
- Flag for adding an SSL context around the ``aiohttp.ClientSession``. Set to ``False`` to disable (e.g., with internal IPs)
* - ``cert_path``
- optional
- Path to the SSL certificate file. This is only used if ``cert_verify`` is set to ``True``.
* - ``api_port``
- optional
- Port the AppDaemon RESTful API will listen on. If not specified, API is disabled
Expand Down
Loading