Skip to content

feat(mqtt): expose MQTT to CLI — events mqtt-tail, doctor check, capabilities surface#9

Closed
chenliuyun wants to merge 3 commits intomainfrom
feat/mqtt-cli-exposure
Closed

feat(mqtt): expose MQTT to CLI — events mqtt-tail, doctor check, capabilities surface#9
chenliuyun wants to merge 3 commits intomainfrom
feat/mqtt-cli-exposure

Conversation

@chenliuyun
Copy link
Copy Markdown
Collaborator

Summary

  • switchbot events mqtt-tail — new subcommand that connects to the configured MQTT broker via SwitchBotMqttClient and streams shadow events as JSONL. Supports --topic (default #) and --max (stop after N events). Requires SWITCHBOT_MQTT_HOST / SWITCHBOT_MQTT_USERNAME / SWITCHBOT_MQTT_PASSWORD; exits 2 with a clear error if missing.
  • doctor check chore: bump version to 2.0.1 #8 — adds an mqtt check: warn if env vars are unset, ok with mqtts://<host>:<port> detail when configured. No live connectivity test (keeps doctor offline-safe).
  • capabilities surface — adds surfaces.mqtt object with mode, envVars, cliCmd, mcpResource, protocol, and configured (bool). Agents can now discover the MQTT surface programmatically.
  • --help Environment section — all 4 MQTT env vars documented alongside SWITCHBOT_TOKEN / SWITCHBOT_SECRET.

Test plan

  • npm run build && npm test — all 692 tests green
  • switchbot events mqtt-tail (no env vars) → exit 2 + clear error
  • SWITCHBOT_MQTT_HOST=x ... switchbot doctor --json | jq '.data.checks[] | select(.name=="mqtt")'ok
  • switchbot capabilities --json | jq '.data.surfaces.mqtt' → object with configured, cliCmd: "events mqtt-tail", mcpResource: "switchbot://events"
  • switchbot --help → Environment section shows all 4 MQTT vars

chenliuyun 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 chenliuyun closed this Apr 19, 2026
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>
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.
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.
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.

1 participant