mirror of
https://github.com/techartdev/OpenClawHomeAssistant.git
synced 2026-08-14 08:52:15 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0a0cc3f23 | ||
|
|
00df877305 | ||
|
|
a037d8311b | ||
|
|
beb59e8eb6 | ||
|
|
a6af4b78ac | ||
|
|
f658885c59 | ||
|
|
ceb9522648 | ||
|
|
ca2c7cab82 | ||
|
|
99be0ed6e6 | ||
|
|
ec825fa8c5 | ||
|
|
971e4bc8e0 | ||
|
|
c3a926299f | ||
|
|
883f5b8778 | ||
|
|
7608357297 | ||
|
|
9235903ef2 | ||
|
|
d5f3831131 | ||
|
|
b45e665bca | ||
|
|
0b799f5fb1 | ||
|
|
6129b62512 | ||
|
|
fe082864ec | ||
|
|
4d8fa8996a | ||
|
|
45d4066d2a | ||
|
|
28574b28ef | ||
|
|
089594a95b |
@@ -497,7 +497,7 @@ The **Model Context Protocol (MCP)** lets OpenClaw communicate directly with Hom
|
||||
3. Set **Auto-Configure MCP for Home Assistant** (`auto_configure_mcp`) to **ON**
|
||||
4. Restart the add-on
|
||||
|
||||
The add-on will automatically register Home Assistant as an MCP server named `HA` using `mcporter`. It auto-detects the HA API URL (supervisor proxy when available, otherwise `localhost:8123`). Check the logs for:
|
||||
The add-on bundles `mcporter` and automatically registers Home Assistant as an MCP server named `HA`. It auto-detects the HA API URL (supervisor proxy when available, otherwise `localhost:8123`). Check the logs for:
|
||||
```
|
||||
INFO: MCP server 'HA' registered — OpenClaw can now control Home Assistant
|
||||
```
|
||||
@@ -543,7 +543,7 @@ MCP setup requires an AI model that understands tool/skill invocation. Budget mo
|
||||
|
||||
| Symptom | Fix |
|
||||
|---|---|
|
||||
| `mcporter: command not found` | Run `openclaw onboard` first, then restart the add-on |
|
||||
| `mcporter: command not found` | Upgrade to add-on `0.5.84` or newer. Older builds did not bundle `mcporter`; as a temporary workaround, install it manually in the add-on terminal and restart. |
|
||||
| MCP add fails with auth error | Verify your long-lived token is valid and not expired |
|
||||
| OpenClaw doesn’t see HA entities | Run `mcporter call home-assistant.GetLiveContext` to refresh |
|
||||
| Model says “what’s MCP?” | Switch to a more capable model for the initial session (see above) |
|
||||
|
||||
@@ -2,6 +2,48 @@
|
||||
|
||||
All notable changes to the OpenClaw Assistant Home Assistant Add-on will be documented in this file.
|
||||
|
||||
## [0.5.87] - 2026-08-10
|
||||
|
||||
### Fixed
|
||||
- Correct the bundled OpenClaw npm package version in the Docker image build for add-on `0.5.86`, fixing failed installs that requested the nonexistent `openclaw@2026.7.1-2-2`.
|
||||
|
||||
## [0.5.85] - 2026-07-21
|
||||
|
||||
### Changed
|
||||
- Bump OpenClaw to `2026.7.1-2`.
|
||||
|
||||
## [0.5.84] - 2026-07-17
|
||||
|
||||
### Changed
|
||||
- Bundle `mcporter@0.12.3` in the add-on image so `auto_configure_mcp` can register Home Assistant out of the box on fresh installs without a manual global install workaround.
|
||||
- Replace the misleading startup hint that told users to run `openclaw onboard` when `mcporter` was missing. The message now correctly points to a broken image state instead.
|
||||
|
||||
## [0.5.82] - 2026-07-15
|
||||
|
||||
### Fixed
|
||||
- Repair add-on startup automatically when the bundled OpenClaw CLI is older than the persisted `/config/.openclaw/openclaw.json` format version. On mismatch, the add-on now restores the newer runtime before launching the gateway instead of silently coming up broken after a Home Assistant OS update or add-on rebuild.
|
||||
- Regenerate malformed `lan_https` CA/server certificates with proper X.509 extensions (`basicConstraints`, `keyUsage`, `extendedKeyUsage`) so Python/OpenSSL strict verification accepts the built-in HTTPS proxy certificates.
|
||||
|
||||
## [0.5.81] - 2026-07-14
|
||||
|
||||
### Changed
|
||||
- Bump OpenClaw to `2026.7.1`.
|
||||
|
||||
## [0.5.80] - 2026-06-26
|
||||
|
||||
### Changed
|
||||
- Bump OpenClaw to `2026.6.10`.
|
||||
|
||||
## [0.5.78] - 2026-06-16
|
||||
|
||||
### Changed
|
||||
- Bump OpenClaw through the `2026.5.28` and `2026.6.6` upstream releases.
|
||||
|
||||
## [0.5.76] - 2026-05-29
|
||||
|
||||
### Changed
|
||||
- Bump OpenClaw to `2026.5.27`.
|
||||
|
||||
## [0.5.75] - 2026-05-28
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -4,7 +4,7 @@ FROM ${BUILD_FROM}
|
||||
# Base image is Debian Bookworm (glibc). This avoids musl-related native module issues
|
||||
# that occur on Alpine (e.g. clipboard, node-llama-cpp).
|
||||
|
||||
# Install base packages (without nodejs/npm - we'll get Node 22 from NodeSource)
|
||||
# Install base packages (without nodejs/npm - we'll get Node 24 from NodeSource)
|
||||
# build-essential provides gcc/cc needed by Homebrew for OpenClaw's brew-managed dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
bash \
|
||||
@@ -34,19 +34,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Node.js 22 LTS from NodeSource (Debian Bookworm ships Node 18, but OpenClaw requires 20+)
|
||||
# Use explicit keyring + apt source instead of setup_22.x pipe script for deterministic builds.
|
||||
# Install Node.js 24 LTS from NodeSource.
|
||||
# OpenClaw supports Node >=24.15.0, and this keeps the image compatible with the
|
||||
# current mcporter releases without relying on an older pinned CLI line.
|
||||
# Use explicit keyring + apt source instead of setup_24.x pipe script for deterministic builds.
|
||||
RUN mkdir -p /etc/apt/keyrings \
|
||||
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
|
||||
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
|
||||
&& chmod 644 /etc/apt/keyrings/nodesource.gpg \
|
||||
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" \
|
||||
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_24.x nodistro main" \
|
||||
> /etc/apt/sources.list.d/nodesource.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends nodejs \
|
||||
&& NODE_VERSION="$(node -v)" \
|
||||
&& echo "$NODE_VERSION" \
|
||||
&& echo "$NODE_VERSION" | grep -E '^v22\.' \
|
||||
&& echo "$NODE_VERSION" | grep -E '^v24\.' \
|
||||
&& rm -f /etc/apt/sources.list.d/nodesource.list /etc/apt/keyrings/nodesource.gpg \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
@@ -113,11 +115,13 @@ RUN if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then \
|
||||
fi
|
||||
USER root
|
||||
|
||||
# Install OpenClaw globally
|
||||
# Bundle node-llama-cpp in the image so the default local memory/embeddings
|
||||
# provider works in HAOS without requiring manual npm installs in /usr/lib.
|
||||
# Install OpenClaw globally.
|
||||
# Bundle node-llama-cpp so the default local memory/embeddings provider works
|
||||
# in HAOS without requiring manual npm installs in /usr/lib.
|
||||
# Bundle mcporter so Home Assistant MCP auto-configuration works out of the box.
|
||||
# The image now ships Node 24, so use the current mcporter line.
|
||||
RUN npm config set fund false && npm config set audit false \
|
||||
&& npm install -g openclaw@2026.5.27 node-llama-cpp@3.18.1
|
||||
&& npm install -g openclaw@2026.7.1-2 node-llama-cpp@3.18.1 mcporter@0.12.3
|
||||
|
||||
# Shell aliases and color options for interactive use
|
||||
RUN tee -a /etc/bash.bashrc <<'EOF'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: OpenClaw Assistant
|
||||
version: "0.5.76"
|
||||
version: "0.5.87"
|
||||
slug: openclaw_assistant
|
||||
description: Run OpenClaw Assistant (OpenClaw-compatible) as a Home Assistant add-on.
|
||||
url: https://github.com/techartdev/OpenClawHomeAssistant
|
||||
|
||||
+140
-22
@@ -542,6 +542,69 @@ if ! command -v openclaw >/dev/null 2>&1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
get_openclaw_version() {
|
||||
local raw
|
||||
raw="$(openclaw --version 2>/dev/null | head -n 1 || true)"
|
||||
printf '%s\n' "$raw" | grep -oE '[0-9]{4}\.[0-9]+\.[0-9]+' | head -n 1 || true
|
||||
}
|
||||
|
||||
version_is_less_than() {
|
||||
local left="$1"
|
||||
local right="$2"
|
||||
[ -n "$left" ] && [ -n "$right" ] && [ "$left" != "$right" ] && \
|
||||
[ "$(printf '%s\n%s\n' "$left" "$right" | sort -V | head -n 1)" = "$left" ]
|
||||
}
|
||||
|
||||
repair_runtime_version_mismatch() {
|
||||
local config_path="/config/.openclaw/openclaw.json"
|
||||
local runtime_version persisted_version refreshed_version
|
||||
|
||||
if [ ! -f "$config_path" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
runtime_version="$(get_openclaw_version)"
|
||||
persisted_version="$(python3 - "$config_path" <<'PY'
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
path = Path(sys.argv[1])
|
||||
try:
|
||||
data = json.loads(path.read_text(encoding="utf-8"))
|
||||
except Exception:
|
||||
print("", end="")
|
||||
raise SystemExit(0)
|
||||
|
||||
value = data.get("meta", {}).get("lastTouchedVersion", "")
|
||||
print(value if isinstance(value, str) else "", end="")
|
||||
PY
|
||||
)"
|
||||
|
||||
if [ -z "$runtime_version" ] || [ -z "$persisted_version" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if ! version_is_less_than "$runtime_version" "$persisted_version"; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "WARN: Persisted OpenClaw config was last written by newer version $persisted_version, but bundled runtime is $runtime_version."
|
||||
echo "WARN: Attempting one-time runtime repair so the gateway can start after add-on rebuilds or Home Assistant OS updates."
|
||||
|
||||
if npm install -g "openclaw@${persisted_version}" >/tmp/openclaw-runtime-repair.log 2>&1; then
|
||||
refreshed_version="$(get_openclaw_version)"
|
||||
echo "INFO: OpenClaw runtime repair succeeded (${runtime_version} -> ${refreshed_version:-$persisted_version})."
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "ERROR: Automatic runtime repair failed; startup will continue with bundled OpenClaw $runtime_version."
|
||||
echo "ERROR: Review /tmp/openclaw-runtime-repair.log and rerun 'openclaw update' or 'npm install -g openclaw@${persisted_version}' once connectivity is available."
|
||||
return 0
|
||||
}
|
||||
|
||||
repair_runtime_version_mismatch
|
||||
|
||||
# Bootstrap minimal OpenClaw config ONLY if missing.
|
||||
# We do not overwrite or patch existing configs; onboarding owns everything else.
|
||||
OPENCLAW_CONFIG_PATH="/config/.openclaw/openclaw.json"
|
||||
@@ -635,6 +698,71 @@ if [ "$ENABLE_HTTPS_PROXY" = "true" ]; then
|
||||
CERT_DIR="/config/certs"
|
||||
mkdir -p "$CERT_DIR"
|
||||
|
||||
cert_ext_contains() {
|
||||
local cert_path="$1"
|
||||
local extension_name="$2"
|
||||
local expected="$3"
|
||||
openssl x509 -in "$cert_path" -noout -ext "$extension_name" 2>/dev/null | grep -Fq "$expected"
|
||||
}
|
||||
|
||||
local_ca_cert_is_valid() {
|
||||
local cert_path="$1"
|
||||
[ -f "$cert_path" ] && \
|
||||
cert_ext_contains "$cert_path" basicConstraints "CA:TRUE" && \
|
||||
cert_ext_contains "$cert_path" keyUsage "Certificate Sign, CRL Sign"
|
||||
}
|
||||
|
||||
gateway_server_cert_is_valid() {
|
||||
local cert_path="$1"
|
||||
[ -f "$cert_path" ] && \
|
||||
cert_ext_contains "$cert_path" extendedKeyUsage "TLS Web Server Authentication" && \
|
||||
cert_ext_contains "$cert_path" subjectAltName "DNS:localhost"
|
||||
}
|
||||
|
||||
generate_local_ca_cert() {
|
||||
cat > "$CERT_DIR/_ca.ext" <<'CAEOF'
|
||||
[v3_ca]
|
||||
basicConstraints=critical,CA:TRUE
|
||||
keyUsage=critical,keyCertSign,cRLSign
|
||||
subjectKeyIdentifier=hash
|
||||
authorityKeyIdentifier=keyid:always,issuer
|
||||
CAEOF
|
||||
|
||||
openssl genrsa -out "$CERT_DIR/ca.key" 2048 2>/dev/null
|
||||
openssl req -new -key "$CERT_DIR/ca.key" -out "$CERT_DIR/ca.csr" \
|
||||
-subj "/CN=OpenClaw Local CA" 2>/dev/null
|
||||
openssl x509 -req -in "$CERT_DIR/ca.csr" -signkey "$CERT_DIR/ca.key" \
|
||||
-out "$CERT_DIR/ca.crt" -days 3650 \
|
||||
-extfile "$CERT_DIR/_ca.ext" -extensions v3_ca 2>/dev/null
|
||||
|
||||
rm -f "$CERT_DIR/ca.csr" "$CERT_DIR/_ca.ext"
|
||||
chmod 600 "$CERT_DIR/ca.key"
|
||||
}
|
||||
|
||||
generate_gateway_server_cert() {
|
||||
openssl genrsa -out "$CERT_DIR/gateway.key" 2048 2>/dev/null
|
||||
openssl req -new -key "$CERT_DIR/gateway.key" -out "$CERT_DIR/gateway.csr" \
|
||||
-subj "/CN=OpenClaw Gateway" 2>/dev/null
|
||||
|
||||
cat > "$CERT_DIR/_server.ext" <<SERVER_EOF
|
||||
[v3_server]
|
||||
basicConstraints=critical,CA:FALSE
|
||||
keyUsage=critical,digitalSignature,keyEncipherment
|
||||
extendedKeyUsage=serverAuth
|
||||
subjectAltName=IP:${LAN_IP:-127.0.0.1},IP:127.0.0.1,DNS:localhost,DNS:homeassistant,DNS:homeassistant.local${EXTRA_SANS:+,${EXTRA_SANS}}
|
||||
subjectKeyIdentifier=hash
|
||||
authorityKeyIdentifier=keyid,issuer
|
||||
SERVER_EOF
|
||||
|
||||
openssl x509 -req -in "$CERT_DIR/gateway.csr" \
|
||||
-CA "$CERT_DIR/ca.crt" -CAkey "$CERT_DIR/ca.key" -CAcreateserial \
|
||||
-out "$CERT_DIR/gateway.crt" -days 3650 \
|
||||
-extfile "$CERT_DIR/_server.ext" -extensions v3_server 2>/dev/null
|
||||
|
||||
rm -f "$CERT_DIR/gateway.csr" "$CERT_DIR/_server.ext" "$CERT_DIR/ca.srl"
|
||||
chmod 600 "$CERT_DIR/gateway.key"
|
||||
}
|
||||
|
||||
# Detect primary LAN IP
|
||||
LAN_IP=$(hostname -I 2>/dev/null | awk '{print $1}')
|
||||
STORED_IP=$(cat "$CERT_DIR/.cert_ip" 2>/dev/null || echo "")
|
||||
@@ -642,12 +770,17 @@ if [ "$ENABLE_HTTPS_PROXY" = "true" ]; then
|
||||
# --- Local CA (generated once, persists across restarts) ---
|
||||
if [ ! -f "$CERT_DIR/ca.key" ] || [ ! -f "$CERT_DIR/ca.crt" ]; then
|
||||
echo "INFO: Generating local CA certificate (one-time)..."
|
||||
openssl genrsa -out "$CERT_DIR/ca.key" 2048 2>/dev/null
|
||||
openssl req -new -x509 -key "$CERT_DIR/ca.key" -out "$CERT_DIR/ca.crt" \
|
||||
-days 3650 -nodes -subj "/CN=OpenClaw Local CA" 2>/dev/null
|
||||
chmod 600 "$CERT_DIR/ca.key"
|
||||
generate_local_ca_cert
|
||||
STORED_IP="" # force server cert regeneration
|
||||
echo "INFO: Local CA created at $CERT_DIR/ca.crt"
|
||||
elif ! local_ca_cert_is_valid "$CERT_DIR/ca.crt"; then
|
||||
echo "WARN: Existing local CA certificate is missing required X.509 CA extensions."
|
||||
echo "WARN: Regenerating CA/server certificates for OpenSSL and Python strict verification compatibility."
|
||||
echo "WARN: Devices that trusted the old CA need the new /cert/ca.crt installed again."
|
||||
rm -f "$CERT_DIR/ca.key" "$CERT_DIR/ca.crt" "$CERT_DIR/gateway.key" "$CERT_DIR/gateway.crt"
|
||||
generate_local_ca_cert
|
||||
STORED_IP=""
|
||||
echo "INFO: Local CA rotated at $CERT_DIR/ca.crt"
|
||||
fi
|
||||
|
||||
# --- Extra SANs from gateway_additional_allowed_origins + gateway_public_url ---
|
||||
@@ -681,24 +814,9 @@ PY
|
||||
STORED_EXTRA_SANS=$(cat "$CERT_DIR/.cert_extra_sans" 2>/dev/null || echo "")
|
||||
|
||||
# --- Server cert (regenerated when LAN IP or SANs change) ---
|
||||
if [ ! -f "$CERT_DIR/gateway.crt" ] || [ ! -f "$CERT_DIR/gateway.key" ] || [ "$LAN_IP" != "$STORED_IP" ] || [ "$EXTRA_SANS" != "$STORED_EXTRA_SANS" ]; then
|
||||
if [ ! -f "$CERT_DIR/gateway.crt" ] || [ ! -f "$CERT_DIR/gateway.key" ] || [ "$LAN_IP" != "$STORED_IP" ] || [ "$EXTRA_SANS" != "$STORED_EXTRA_SANS" ] || ! gateway_server_cert_is_valid "$CERT_DIR/gateway.crt"; then
|
||||
echo "INFO: Generating server TLS certificate for IP: ${LAN_IP:-unknown}..."
|
||||
openssl genrsa -out "$CERT_DIR/gateway.key" 2048 2>/dev/null
|
||||
openssl req -new -key "$CERT_DIR/gateway.key" -out "$CERT_DIR/gateway.csr" \
|
||||
-subj "/CN=OpenClaw Gateway" 2>/dev/null
|
||||
|
||||
# SAN extension — include LAN IP, loopback, common mDNS names + user extras
|
||||
cat > "$CERT_DIR/_san.ext" <<SANEOF
|
||||
subjectAltName=IP:${LAN_IP:-127.0.0.1},IP:127.0.0.1,DNS:localhost,DNS:homeassistant,DNS:homeassistant.local${EXTRA_SANS:+,${EXTRA_SANS}}
|
||||
SANEOF
|
||||
|
||||
openssl x509 -req -in "$CERT_DIR/gateway.csr" \
|
||||
-CA "$CERT_DIR/ca.crt" -CAkey "$CERT_DIR/ca.key" -CAcreateserial \
|
||||
-out "$CERT_DIR/gateway.crt" -days 3650 \
|
||||
-extfile "$CERT_DIR/_san.ext" 2>/dev/null
|
||||
|
||||
rm -f "$CERT_DIR/gateway.csr" "$CERT_DIR/_san.ext" "$CERT_DIR/ca.srl"
|
||||
chmod 600 "$CERT_DIR/gateway.key"
|
||||
generate_gateway_server_cert
|
||||
printf '%s' "$LAN_IP" > "$CERT_DIR/.cert_ip"
|
||||
printf '%s' "$EXTRA_SANS" > "$CERT_DIR/.cert_extra_sans"
|
||||
echo "INFO: Server TLS certificate generated (SAN: IP:${LAN_IP:-127.0.0.1}${EXTRA_SANS:+,${EXTRA_SANS}})"
|
||||
@@ -802,7 +920,7 @@ if [ "$AUTO_CONFIGURE_MCP" = "true" ] && [ -n "$HA_TOKEN" ]; then
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "INFO: mcporter not available; skipping MCP auto-configuration (run 'openclaw onboard' first)"
|
||||
echo "WARN: mcporter is missing from the add-on image; skipping MCP auto-configuration"
|
||||
fi
|
||||
elif [ "$AUTO_CONFIGURE_MCP" = "true" ] && [ -z "$HA_TOKEN" ]; then
|
||||
echo "INFO: MCP auto-configure enabled but homeassistant_token not set — skipping"
|
||||
|
||||
Reference in New Issue
Block a user