feat(mqtt): expose MQTT to CLI — events mqtt-tail, doctor check, capabilities surface#9
Closed
chenliuyun wants to merge 3 commits intomainfrom
Closed
feat(mqtt): expose MQTT to CLI — events mqtt-tail, doctor check, capabilities surface#9chenliuyun wants to merge 3 commits intomainfrom
chenliuyun wants to merge 3 commits intomainfrom
Conversation
added 3 commits
April 19, 2026 18:17
…bilities surface - events mqtt-tail: new subcommand that connects to the configured MQTT broker via SwitchBotMqttClient and streams shadow events as JSONL; supports --topic (default "#"), --max (stop after N events); requires SWITCHBOT_MQTT_HOST/USERNAME/PASSWORD env vars (UsageError if missing) - doctor: add 8th check 'mqtt' — warn if env vars unset, ok with host:port detail; no live connectivity test to keep doctor offline-safe - capabilities: add surfaces.mqtt object with mode, envVars, cliCmd, mcpResource, protocol, and configured (bool) — agents can now programmatically discover the MQTT surface - index.ts: extend Environment section in --help to list all 4 MQTT vars - tests: 4 new mqtt-tail tests (UsageError, JSONL output, JSON envelope, --max validation); 2 new doctor mqtt tests (warn/ok); 1 capabilities test for surfaces.mqtt shape
- mcp stdio mode: initialize EventSubscriptionManager and pass it to createSwitchBotMcpServer() so switchbot://events is registered in BOTH stdio and HTTP modes — was only available in HTTP mode before (Issue 1) - mcp help text: update "seven tools" → "eight tools", add account_overview to list, add switchbot://events resource section with MQTT env var note - events command description: replace webhook-only wording with description covering both tail (webhook) and mqtt-tail (MQTT stream) subcommands - doctor mqtt detail: explicitly state credentials are not verified and direct user to mqtt-tail for live connectivity testing (Issue 2 clarification)
…nt in both stdio and HTTP when MQTT is configured
chenliuyun
pushed a commit
that referenced
this pull request
Apr 20, 2026
Adds .alias('status') to the 'cache show' subcommand registration so that
'switchbot cache status' works alongside 'switchbot cache show', matching
the parallel quota command's UX.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
chenliuyun
pushed a commit
that referenced
this pull request
Apr 20, 2026
Document every fix landed in this branch beyond the history-aggregate feature: bugs #1, #4, #5, #6, #8, #9, #10, #11, #12, #13, #14, #15, #16, #17, #18 from the OpenClaw v2.4.0 smoke-test report. Call out the deferred items (#2, #7) explicitly so readers don't assume they were overlooked. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
4 tasks
chenliuyun
pushed a commit
that referenced
this pull request
Apr 20, 2026
Adds .alias('status') to the 'cache show' subcommand registration so that
'switchbot cache status' works alongside 'switchbot cache show', matching
the parallel quota command's UX.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
switchbot events mqtt-tail— new subcommand that connects to the configured MQTT broker viaSwitchBotMqttClientand streams shadow events as JSONL. Supports--topic(default#) and--max(stop after N events). RequiresSWITCHBOT_MQTT_HOST/SWITCHBOT_MQTT_USERNAME/SWITCHBOT_MQTT_PASSWORD; exits 2 with a clear error if missing.doctorcheck chore: bump version to 2.0.1 #8 — adds anmqttcheck:warnif env vars are unset,okwithmqtts://<host>:<port>detail when configured. No live connectivity test (keepsdoctoroffline-safe).capabilitiessurface — addssurfaces.mqttobject withmode,envVars,cliCmd,mcpResource,protocol, andconfigured(bool). Agents can now discover the MQTT surface programmatically.--helpEnvironment section — all 4 MQTT env vars documented alongsideSWITCHBOT_TOKEN/SWITCHBOT_SECRET.Test plan
npm run build && npm test— all 692 tests greenswitchbot events mqtt-tail(no env vars) → exit 2 + clear errorSWITCHBOT_MQTT_HOST=x ... switchbot doctor --json | jq '.data.checks[] | select(.name=="mqtt")'→okswitchbot capabilities --json | jq '.data.surfaces.mqtt'→ object withconfigured,cliCmd: "events mqtt-tail",mcpResource: "switchbot://events"switchbot --help→ Environment section shows all 4 MQTT vars