Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Add skip verify cli flag #55

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions homeassistant_satellite/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ async def main() -> None:
choices=("http", "https"),
help="Home Assistant protocol",
)
parser.add_argument("--skip-verify", action="store_true", help="Skip verification of the SSL certificate")
#
parser.add_argument("--mic-device", help="Name of ALSA microphone device")
parser.add_argument("--snd-device", help="Name of ALSA sound device")
Expand Down Expand Up @@ -235,6 +236,7 @@ async def main() -> None:
host=args.host,
protocol=args.protocol,
port=args.port,
skip_verify=args.skip_verify,
token=token,
) as ha_connection:
while state.is_running:
Expand Down
4 changes: 2 additions & 2 deletions homeassistant_satellite/ha_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class HAConnection:
messages arrive in different order.
"""

def __init__(self, host: str, protocol: str, token: str, port: int = 8123):
def __init__(self, host: str, protocol: str, token: str, port: int = 8123, skip_verify: bool = False):
self._token = token
self._message_id = 1

Expand All @@ -38,8 +38,8 @@ def __init__(self, host: str, protocol: str, token: str, port: int = 8123):

ws_protocol = "wss" if protocol == "https" else "ws"
url = f"{ws_protocol}://{host}:{port}/api/websocket"
self._session = aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=not skip_verify))

self._session = aiohttp.ClientSession()
self._websocket_context = self._session.ws_connect(url)

self.__websocket: Optional[aiohttp.ClientWebSocketResponse] = None
Expand Down