Skip to content

Commit 3bdc84f

Browse files
committed
Add verify_ssl parameter
1 parent 445bbd1 commit 3bdc84f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Platform | Description
1212
-- | --
1313
`remote_homeassistant` | Link multiple Home-Assistant instances together .
1414

15-
The master instance connects to the Websocket APIs of the slaves, the connection options are specified via the `host`, `port`, and `secure` configuration parameters. An API password can also be set via `api_password`.
15+
The master instance connects to the Websocket APIs of the slaves, the connection options are specified via the `host`, `port`, and `secure` configuration parameters. An API password can also be set via `api_password`. To ignore SSL warnings in secure mode, set the `verify_ssl` parameter to false.
1616

1717
After the connection is completed, the remote states get populated into the master instance.
1818
The entity ids can optionally be prefixed via the `entity_prefix` parameter.
@@ -61,6 +61,7 @@ remote_homeassistant:
6161
- host: localhost
6262
port: 8125
6363
secure: true
64+
verify_ssl: false
6465
access_token: !secret access_token
6566
api_password: !secret http_password
6667
entity_prefix: "slave02_"
@@ -82,6 +83,11 @@ secure:
8283
description: Use TLS (wss://) to connect to the remote instance.
8384
required: false
8485
type: bool
86+
verify_ssl:
87+
description: Enables / disables verification of the SSL certificate of the remote instance.
88+
required: false
89+
type: bool
90+
default: true
8591
access_token:
8692
description: Access token of the remote instance, if set. Mutually exclusive with api_password
8793
required: false

custom_components/remote_homeassistant/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
CONF_INSTANCES = 'instances'
2929
CONF_SECURE = 'secure'
30+
CONF_VERIFY_SSL = 'verify_ssl'
3031
CONF_ACCESS_TOKEN = 'access_token'
3132
CONF_API_PASSWORD = 'api_password'
3233
CONF_SUBSCRIBE_EVENTS = 'subscribe_events'
@@ -42,6 +43,7 @@
4243
vol.Required(CONF_HOST): cv.string,
4344
vol.Optional(CONF_PORT, default=8123): cv.port,
4445
vol.Optional(CONF_SECURE, default=False): cv.boolean,
46+
vol.Optional(CONF_VERIFY_SSL, default=True): cv.boolean,
4547
vol.Exclusive(CONF_ACCESS_TOKEN, 'auth'): cv.string,
4648
vol.Exclusive(CONF_API_PASSWORD, 'auth'): cv.string,
4749
vol.Optional(CONF_SUBSCRIBE_EVENTS,
@@ -77,6 +79,7 @@ def __init__(self, hass, conf):
7779
self._host = conf.get(CONF_HOST)
7880
self._port = conf.get(CONF_PORT)
7981
self._secure = conf.get(CONF_SECURE)
82+
self._verify_ssl = conf.get(CONF_VERIFY_SSL)
8083
self._access_token = conf.get(CONF_ACCESS_TOKEN)
8184
self._password = conf.get(CONF_API_PASSWORD)
8285
self._subscribe_events = conf.get(CONF_SUBSCRIBE_EVENTS)
@@ -99,7 +102,7 @@ async def async_connect(self):
99102
"""Connect to remote home-assistant websocket..."""
100103
url = self._get_url()
101104

102-
session = async_get_clientsession(self._hass)
105+
session = async_get_clientsession(self._hass, self._verify_ssl)
103106

104107
while True:
105108
try:

0 commit comments

Comments
 (0)