Skip to content

Fix ha-ws passing SSL context to plain ws:// connections - #2

Open
ksanislo wants to merge 1 commit into
danbuhler:mainfrom
ksanislo:fix/ha-ws-ssl-on-plain-ws
Open

ksanislo wants to merge 1 commit into
danbuhler:mainfrom
ksanislo:fix/ha-ws-ssl-on-plain-ws

Conversation

@ksanislo

@ksanislo ksanislo commented Feb 6, 2026

Copy link
Copy Markdown

Summary

  • ha-ws and lovelace-sync unconditionally created an SSL context and passed it to websockets.connect(), which fails when HA_URL uses http:// or ws://
  • Only create and pass the SSL context when the WebSocket URL scheme is wss://

Test plan

  • Verify ha-ws connects successfully with an https:// / wss:// HA_URL
  • Verify ha-ws connects successfully with an http:// / ws:// HA_URL
  • Verify lovelace-sync connects successfully with both URL schemes

🤖 Generated with Claude Code

The connect method unconditionally created an SSL context and passed it
to websockets.connect(), which fails when HA_URL uses http:// or ws://.
Only create and pass the SSL context when the URL scheme is wss://.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ksanislo
ksanislo force-pushed the fix/ha-ws-ssl-on-plain-ws branch from 806a10c to 115a31c Compare February 6, 2026 23:27
@tulensrma

Copy link
Copy Markdown

Please merge this PR, solves an actual problem

nayot added a commit to nayot/homeassistant-claude-kit that referenced this pull request Sep 6, 2026
…ections

ha-ws and lovelace-sync at v1.0.0 build an SSL context and pass it to
websockets.connect() regardless of scheme. websockets >= 14 raises
ValueError("ssl argument is incompatible with a ws:// URI"), and install.sh
pulls the latest websockets, so both tools break on any install whose HA_URL
is plain HTTP. ha-ws had been failing here since the last HA OS update.

The fix itself is applied on the HA host (a local commit on top of v1.0.0 in
/config/claude-code-ha/, which install.sh never overwrites — it only chmods
and re-symlinks bin/). tools/patch_claude_code_ha_ssl.py is the idempotent
re-apply script for a fresh clone, and CLAUDE.md documents both.

Upstream danbuhler/claude-code-ha#2 and dcb#5 are open and unfixed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants