Introduction¶
The DeepSeek Harness (DSH) ecosystem emphasizes pluggability. For agents that need to interface with smart home devices, safely retrieving device lists, reading statuses, and executing commands is a common requirement. The dsh-mihome plugin provides this capability. It allows DSH agents to operate Mijia devices and enforces a human approval workflow for all state-change requests.
Plugin Overview¶
dsh-mihome is an online tool plugin maintained by SiriusWJ, aiming to provide a Mijia control interface for DeepSeek Harness agents.
- Core features: list homes and rooms, read device properties, control devices (requiring approval), wait for device state changes, and generate Web UI dashboard cards.
- Open-source license: MIT.
- Repository: siriuswj/dsh-mihome.
Core Features¶
The plugin provides a set of tool functions covering the full workflow from querying to controlling:
- Connection check (
mi_health): validates the account, region, and number of homes and devices. - Device query (
mi_list_homes,mi_list_devices): retrieves home and room information, and lists device details (including category and online status, with filtering support). - State reading (
mi_get_state): retrieves common properties for a single device, such as switch status, brightness, temperature, humidity, and so on. - Device control (
mi_turn,mi_control): executes switch actions or anymiIO/raw_command. Note that both functions are behind an approval gate. - State polling (
mi_wait_for_state): continuously polls the property until the device reaches or leaves the specified state. - Dashboard (
mi_dashboard): renders real-time whole-home status dashboard cards in the Web UI, grouped by category and room, and displays recent changes.
Installation and Activation¶
Before using the plugin, ensure DSH is version 0.1.0-rc.7 or later (validated with 0.1.1-rc.2).
Install the plugin via npm:
dsh plugin --profile web add dsh-mihome
After installation, restart dsh --profile web. Manage this plugin on the Web UI settings page.
Typical Usage¶
The plugin supports two operating modes: demo mode and cloud connection mode.
Demo Mode¶
Without a real Mijia account, you can use the built-in mock server for testing.
- Clone the repository and install dependencies:
git clone https://github.com/SiriusWJ/dsh-mihome
cd dsh-mihome && pnpm install
- Start the mock server:
pnpm demo:mi
This starts a fake Mijia cloud at `http://127.0.0.1:8125`.
- Enable the plugin in the DSH configuration:
- id: mihome
config:
mode: demo
baseUrl: http://127.0.0.1:8125
The agent can then operate through natural-language commands (for example, “Check Mijia and list all devices”).
Cloud Connection Mode¶
Connecting to the real Mijia cloud requires account credentials.
- Set environment variables (or use a
.envfile):
MIHOME_USERNAME=<mi-account> MIHOME_PASSWORD=<mi-password> dsh --profile web
- Specify cloud mode and region in the DSH plugin configuration:
- id: mihome
config:
mode: cloud
region: cn # 可选:cn / de / ru / us / tw / sg / in …
usernameEnv: MIHOME_USERNAME
passwordEnv: MIHOME_PASSWORD
requireApproval: true
allowedCategories: [light, outlet, climate] # 可选:允许操作的类别白名单
Credentials are resolved through DSH's credential gate (process environment variables take priority, followed by the `.env` file), so updated credentials take effect on the next call.
Security and Considerations¶
The security of this plugin is built on DSH’s approval mechanism.
- Approval gate: All state-changing operations (
mi_turn,mi_control) are gated by default throughrequireApproval. If a category cannot be resolved, the invocation is rejected, following the principle of least privilege. - Protocol nature: The cloud adapter implements the community-documented Mijia App API, which is an unofficial protocol. If Mijia updates the app, the protocol may change (see the workflow of
Xiaomi-cloud-tokens-extractororpython-miio). - Error messages: For accounts that require a CAPTCHA or two-factor authentication (2FA), the plugin returns explicit error information instead of vague failure messages.
- Runtime dependencies: The plugin itself requires no additional host dependencies and uses only Node.js’s built-in
cryptoandfetchmodules.
Conclusion¶
dsh-mihome provides DeepSeek Harness with standardized Mijia integration capabilities. By placing control operations behind an approval workflow and enforcing whitelist restrictions at the category resolution level, it provides secure infrastructure for agents to control physical devices.