dsh-smarthome: Integrating Home Assistant into DeepSeek Harness

Preface

Developers running DeepSeek Harness (DSH) often write code, research information, and chat with agents on the same machine. If Home Assistant (HA) is already used to manage devices at home, the common approach is to open a separate app or write a script to call the REST API; on the agent side, one must remember entity IDs, service names, and parameters, and add an extra layer of confirmation for write operations. @tianxiaohei6/dsh-smarthome encapsulates HA’s read status, history lookup, and service calls into DSH tools. Read operations are immediately usable, while service calls that modify state default to requiring manual approval. Below, we introduce what it is, what it can do, and how to install and configure it.

Plugin Positioning

Maintainer tianxiaohei6 open-sourced dsh-smarthome on GitHub, with the npm package named @tianxiaohei6/dsh-smarthome (current documentation version 1.5.1, license MIT). It is categorized as a Workflow in community directories like SkillHub; the directories have no official affiliation with DeepSeek / Hyperscience, but it is a third-party extension within the DSH “everything is a plugin” ecosystem.

The plugin is described as: Home Assistant control for DSH agents—reading entity states, querying history, and calling services; all calls that change state default to stopping before manual approval. In terms of implementation, aside from the harness itself, there are no extra runtime dependencies. It uses the HA built-in REST API and Node’s built-in WebSocket for real-time events and area registry queries; it does not depend on MQTT or a separate daemon process.

The plugin runs on the same computer as dsh and does not provide a separate mobile app or bridge service. It accesses the configured HA address and token with the permissions of the current dsh process; before installing, it is advisable to review the repository source code and license yourself to decide whether to enable it.

Core Capabilities

Tool Overview

Tool Function Approval
ha_health Check connection, return instance name, version, timezone, WebSocket status Read-only
ha_list_entities List entities, filter by domain, text Read-only
ha_list_areas List rooms (areas) via WebSocket Read-only
ha_list_devices List physical devices via WebSocket Read-only
ha_get_state Single entity state and attributes Read-only
ha_history State change timeline within specified time window Read-only
ha_events Recently buffered state_changed events via WebSocket Read-only
ha_list_scenes List one-click scenes Read-only
ha_dashboard Render whole-house snapshot cards in Web UI chat Read-only
ha_wait_for_state Poll until entity reaches or leaves a state Read-only
ha_notify Send notifications via HA (persistent / phone / speaker) No approval gate
ha_weather Weather entity and structured forecast Read-only
ha_call_service Call HA service (entity / area / device / scene) Requires approval
ha_render_template Server-side rendering of Jinja2 templates Requires approval

Security-related default behavior: requireApproval defaults to true, and ha_call_service and ha_render_template go through the harness approval interface; allowedDomains can further restrict the domains allowed to be called (leaving it empty means no extra restriction). HA long-lived tokens have significant permissions within the instance; the documentation suggests using tokenEnv to reference the token to avoid writing it into the configuration file and into the version repository.

Typical Conversation Intents

You describe your requirements in natural language, and the agent selects a combination of tools from the table above to complete the task, for example:

  • Scan which devices are still on in the whole house: ha_list_entities / ha_get_state summary.
  • View dashboard in conversation: ha_dashboard.
  • Notify after washing machine finishes: ha_wait_for_state then ha_notify.
  • Adjust brightness of a specific light or turn off all living room lights by area: ha_call_service (will pop up for approval).
  • Activate a scene (e.g., Movie Mode): ha_call_service or the scene entity.
  • View recent changes at home: ha_events or ha_history.

The repository provides docs/demo.html to simulate a complete conversation and approval process; when connected to the built-in HA simulator, the console can perform real API calls on the simulated instance without needing to connect physical hardware first.

Installation and Enablement

You need dsh ≥ 0.2.0 (the README states that the current runtime targeted for verification is 0.2.2-rc.1). Please install the scoped package and do not confuse it with the unmaintained package dsh-smarthome on npm.

  1. Add the plugin under the corresponding profile:
dsh plugin --profile <profile> add @tianxiaohei6/dsh-smarthome

<profile> is the directory name under ~/.dsh/profiles/ (e.g., web, desktop).

  1. After installation, restart dsh --profile <profile>; it can be managed at Settings → Plugins. If upgrading from the old bundle dsh-smarthome, you need to remove the old package first (both share the smarthome row ID and cannot be enabled simultaneously).

When installing from GitHub source code, the official documentation gives dsh plugin --profile <profile> add github:tianxiaohei6/dsh-smarthome, and when pnpm refuses git dependencies prepare, configure allowBuilds in <profile>/pnpm-workspace.yaml. Generally, the prebuilt npm package is more recommended.

Configure Home Assistant

  1. Create a long-lived access token in HA: Profile → Security → Long-lived access tokens.

  2. Configure the plugin in the profile’s cordis.patch.yml (lower layers override upper layers), for example:

- id: smarthome
  config:
    baseUrl: http://192.168.1.10:8123
    token: ''
    tokenEnv: HOME_ASSISTANT_TOKEN
    timeoutMs: 15000
    requireApproval: true
    allowedDomains: []
    maxHistoryEvents: 200
    wsEnabled: true
    eventBufferSize: 50

baseUrl defaults to http://homeassistant.local:8123. When no token is configured, the plugin will still load, and it returns a clear error upon invocation without causing the harness to crash. tokenEnv is parsed through the harness credentials interface (environment variables, profile .env, $DSH_HOME/.env, etc.). The token is re-parsed for every request, so changes take effect immediately without needing to restart.

  1. Start with the token environment variable:
HOME_ASSISTANT_TOKEN=<token> dsh --profile <profile>

For local testing, the documentation examples can point baseUrl to the simulator address (e.g., http://127.0.0.1:8124) and HOME_ASSISTANT_TOKEN=demo-token. For more complete demos / production / approval disabled examples, see examples/cordis.patch.yml in the repository.

Compatibility and Notes

  • Uses HA v1 REST API and WebSocket API (states, services, history, templates, area and device registries, etc.), requires a long-lived access token.
  • Does not support self-signed HTTPS; restricted tokens will cause ha_call_service to fail.
  • DeepSeek Harness is still in developer preview; if the harness is upgraded and is incompatible, an issue needs to be filed in the repository.
  • Can be combined with other DSH plugins in the community (e.g., voice input plugins, see GitHub dsh-plugin topic), achieving scenarios like turning on lights while speaking under the premise of “approval passed”; write operations still rely on this plugin’s approval gate.

Conclusion

@tianxiaohei6/dsh-smarthome turns Home Assistant into a set of DSH tools: reading states and history can be done directly in the conversation, and changing device states defaults to waiting for your approval. It is suitable for developers who are already using HA and want their agent to check and control their home within the same window.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye