Integrating OpenClaw with Home Assistant Assist pipeline#37
Conversation
- Introduced `enable_openai_api` option in config.yaml to enable OpenAI-compatible Chat Completions endpoint. - Updated `apply_gateway_settings` function to handle OpenAI API settings. - Enhanced documentation in DOCS.md for integrating OpenClaw with Home Assistant Assist pipeline. - Added translations for `enable_openai_api` in English, Bulgarian, German, Spanish, and Polish. - Bumped version to 0.5.37 in config.yaml.
There was a problem hiding this comment.
Pull request overview
Adds an add-on option to expose an OpenAI-compatible Chat Completions endpoint from the OpenClaw Gateway, wires that option into startup/config patching, and documents how to use it with Home Assistant’s Assist pipeline.
Changes:
- Add
enable_openai_apito the add-on options/schema and surface it in translations. - Pass the new option through
run.shintooc_config_helper.py, which writesgateway.http.endpoints.chatCompletions.enabled. - Expand
DOCS.mdwith a new section describing HA Assist pipeline integration via Extended OpenAI Conversation.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| openclaw_assistant/config.yaml | Adds enable_openai_api option + schema entry; bumps add-on version. |
| openclaw_assistant/run.sh | Reads enable_openai_api from options and passes it to the config helper. |
| openclaw_assistant/oc_config_helper.py | Extends gateway settings patching to toggle Chat Completions endpoint enablement. |
| DOCS.md | Documents the new option and provides HA Assist pipeline integration steps. |
| openclaw_assistant/translations/en.yaml | Adds UI strings for enable_openai_api. |
| openclaw_assistant/translations/bg.yaml | Adds UI strings for enable_openai_api. |
| openclaw_assistant/translations/de.yaml | Adds UI strings for enable_openai_api. |
| openclaw_assistant/translations/es.yaml | Adds UI strings for enable_openai_api. |
| openclaw_assistant/translations/pl.yaml | Adds UI strings for enable_openai_api. |
Comments suppressed due to low confidence (1)
openclaw_assistant/run.sh:242
- In this
if ! python3 ...; thenpattern,rc=$?captures the exit status of the negated condition (from!), not the underlyingpython3exit code. That will typically setrcto 0 on failure, causingexit "${rc}"to exit successfully and mask startup failures. Refactor to capture thepython3exit code directly (run command, store$?, then branch on non-zero) so the add-on fails fast with the real error code.
if ! python3 "$HELPER_PATH" apply-gateway-settings "$GATEWAY_MODE" "$GATEWAY_BIND_MODE" "$GATEWAY_PORT" "$ENABLE_OPENAI_API" "$ALLOW_INSECURE_AUTH"; then
rc=$?
echo "ERROR: Failed to apply gateway settings via oc_config_helper.py (exit code ${rc})."
echo "ERROR: Gateway configuration may be incorrect; aborting startup."
exit "${rc}"
fi
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # http.endpoints.chatCompletions should be nested inside gateway | ||
| if "http" not in gateway: | ||
| gateway["http"] = {} | ||
| if "endpoints" not in gateway["http"]: | ||
| gateway["http"]["endpoints"] = {} | ||
| if "chatCompletions" not in gateway["http"]["endpoints"]: | ||
| gateway["http"]["endpoints"]["chatCompletions"] = {} |
There was a problem hiding this comment.
This function will create/modify nested gateway.http.endpoints.chatCompletions keys and may persist them via write_config(). Today, if read_config() fails to parse an existing config file it returns None, and the caller treats that as {} and proceeds, which can overwrite an existing (but temporarily malformed/JSON5) openclaw.json with a partial JSON config. Consider failing fast when the config file exists but cannot be parsed (return False and do not write), and only initializing an empty config when the file truly does not exist.
Merge upstream PR techartdev#37: OpenAI-compatible Chat Completions endpoint for Home Assistant Assist pipeline integration. New enable_openai_api option with translations in all 5 languages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge upstream PR techartdev#37: OpenAI-compatible Chat Completions endpoint for Home Assistant Assist pipeline integration. New enable_openai_api option with translations in all 5 languages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
enable_openai_apioption in config.yaml to enable OpenAI-compatible Chat Completions endpoint.apply_gateway_settingsfunction to handle OpenAI API settings.enable_openai_apiin English, Bulgarian, German, Spanish, and Polish.