Introduction¶
The most direct way to integrate third-party hardware into DeepSeek Harness (DSH) is by invoking local CLI tools. Xiaomi Mijia currently has no official DSH plugin, but the local miloco-cli tool can control all logged-in Mijia devices. dsh-miloco is a concrete implementation of this need: it wraps the capabilities of miloco-cli into a set of DSH tools and provides a local control panel, enabling DSH to operate Mijia devices directly while surfacing behavior logs and pattern suggestions to DSH.
What It Is¶
dsh-miloco is a DSH client plugin maintained by Lzm1645. It integrates Xiaomi Miloco (Mijia) devices into DeepSeek Harness and provides two things:
- A set of command-line tools:
miloco_status,miloco_devices,miloco_props,miloco_control,miloco_ui,miloco_events,miloco_patterns; - A local control panel: accessible via browser at
http://127.0.0.1:5888/, featuring a dark theme, grouped by room, with on/off and brightness controls for lights, outlets, and air purifiers.
Dependencies¶
The following prerequisites must be met before use:
miloco-cliis installed and logged in on this machine, and the backend service is running (miloco-cli service statusreturnsrunning: true);- Node.js ≥ 20;
- DSH Desktop (web profile).
Installation¶
- Navigate to DSH’s desktop profile directory:
cd ~/.dsh/profiles/desktop
- Use Python to modify
package.jsonto add the dependency and bundle:
python3 - <<'PY'
import json
p='package.json'; d=json.load(open(p))
d.setdefault('dependencies',{})['dsh-miloco']='link:/path/to/dsh-miloco'
if 'dsh-miloco' not in d['dsh']['profile']['bundles']:
d['dsh']['profile']['bundles'].append('dsh-miloco')
open(p,'w').write(json.dumps(d,ensure_ascii=False,indent=2))
PY
- Create a symbolic link in the plugin directory:
ln -sfn /path/to/dsh-miloco node_modules/dsh-miloco
- Restart DSH (⌘Q). The plugin is only loaded at startup.
After installation, you can simply say “List my Mijia devices” or “Turn on Desk Lamp 1” in DSH, or call miloco_ui to get the control panel URL.
Tools¶
| Tool | Purpose |
|---|---|
miloco_status |
Account binding and backend service status |
miloco_devices |
Device list (name / room / category / online) |
miloco_props |
Read device properties (on / brightness / color-temperature) |
miloco_control |
Control properties; requires confirm=true; only allows on / brightness / color-temperature / mode / toggle |
miloco_ui |
Start or retrieve the local control panel URL |
miloco_events |
Recent behavior events (on/off changes) |
miloco_patterns |
Usage patterns and automation suggestions (e.g., “Turn on lights at 19:00 every day”) |
Security Boundaries¶
The plugin does not implement the Xiaomi login protocol, does not store credentials, and does not print tokens. Control operations are restricted to an allowlist of subcommands and properties, and every control action must be explicitly confirmed with confirm=true. The UI only listens on 127.0.0.1 and is not exposed to the network.
Behavior Logs & Smart Suggestions¶
A background process samples the on state of online controllable devices (lights / outlets / air purifiers / TVs) every 30 seconds. State changes are written to ~/.dsh/state/dsh-miloco/events.jsonl. miloco_patterns aggregates on-times by hour and generates suggestions such as “Lights are usually turned on at 19:00 — you could set up an automated schedule.” The panel includes a “Smart Suggestions / Recent Activity” section at the bottom. Behavior can be tuned via environment variables: DSH_MILOCO_LOG=0 to disable sampling, DSH_MILOCO_LOG_INTERVAL_MS to adjust the interval, and DSH_MILOCO_EVENTS to change the event file path.
DSH Client Integration¶
The plugin ships a client-side panel (client.js): it registers a “Mijia” tab in DSH’s right sidebar with the local control panel embedded. package.json declares exports['./client'] and dsh.client (web platform). After installing and restarting DSH, a “Mijia” tab will appear in the right sidebar.
UI Design¶
The panel follows Home Assistant dashboard principles: cards are color-coded by state, one action yields one result, only controls the device actually supports are displayed, and states are accurately greyed out when unavailable. It also draws on NN/g usability guidelines for smart devices: all device states are visible at a glance, and feedback is immediate after any interaction. Devices are grouped by room, with a top search bar, an online-device counter, a dark theme, and mobile-friendly responsive layout.
Demo mode: visit http://127.0.0.1:5888/?demo=1 to render with built-in sample devices (no real device names or household information included).
Verification¶
npm test # 4 unit tests (parsing / allowlist / redaction)
node scripts/verify-ui.mjs # Start local panel (127.0.0.1:5889) to verify with real devices
E2E has been verified on this machine: reading 11 devices, Desk Lamp 1 on=false→true→false round-trip, UI rendering with on/off and brightness controls.
Limitations¶
Currently scoped to device control and status reading; scenes are not displayed when the scene list is empty. Device capabilities (brightness / color temperature) vary by model — the UI only shows brightness controls for light and air-purifier types. Advanced Miloco features such as cameras, sensing, and identity databases are not implemented (may be extended in future versions).
Use Cases & Notes¶
Ideal for developers who want to directly control Xiaomi Mijia devices within DSH, especially those already using miloco-cli. The plugin runs with the permissions of the current DSH process; review the source code and license before installing. Current version is 0.1.5, licensed under MIT.
In Short¶
dsh-miloco wraps Xiaomi Mijia device capabilities into the DSH ecosystem, providing both command-line tools and a local control panel — well suited for scenarios requiring localized, user-controlled smart home integration.
- Directory page: https://www.skillhub.cn/plugins/Lzm1645/dsh-miloco
- GitHub: https://github.com/Lzm1645/dsh-miloco