dsh-heat-loop: Closing the Loop Between Device Output and Physiological Feedback for Intensity Regulation

Preface

In DSH, connecting BLE devices is often done via one-way control: models or upper-layer logic send commands, the device executes, and the process ends. The model doesn’t know the current level or the real state of the other party; intensity often has to be “guessed for the next level”; if it only increases and decreases, it lacks automatic braking, and overload risks fall on the user. dsh-heat-loop connects the readable device state and physiological data (heart rate) into a loop, using short-term “heat” values to determine target output, and in feedback mode, uses configurable thresholds as hard safety gates. The following sections explain positioning, capabilities, installation, usage, and notes.

What is this

  • Name: dsh-heat-loop
  • Maintainer: hihikohaza
  • Category: Workflow (Community directory SkillHub)
  • Version: 0.1.0 (see repository package.json)
  • License: MIT
  • One-liner: Closed-loop intensity control for BLE devices — heat engine + physiological safety gates(闭环强度:热力引擎 + 生理反馈 + 安全闸)

The repository readme connects “device output” and “body reaction” into a loop: it reads device state and heart rate, maintains short-term heat (rises with stimulation, decays if idle, cools at peak), and then calculates device output intensity based on heat; in terms of judgment order, physiological data takes priority over “wanting more”.

Core Features

Heat Engine and Single Writer Collector

  1. Read device state (running / level / mode) and physiological data (heart rate).
  2. Maintain short-term “heat” value.
  3. Determine device target output based on heat, with safety gates (feedback mode).

The collector lib/watch.mjs is the only writer of the heat state; the regulator lib/driver.mjs handles heat → target level; the CLI lib/heatctl.mjs is used for viewing status, marking points, and resetting.

Two Drive Modes

Mode Behavior Safety Gate
feedback (default) Reads device + physiological data, closed-loop intensity adjustment Default thresholds active throughout
script Does not read physiological data, heat determined solely by upper-layer marking Heart rate threshold table is ineffective; WARNING log on startup

Environment variable example:

DRIVER_MODE=feedback   # default
DRIVER_MODE=script     # open-loop, does not read physiological data

Safety Gates in Feedback Mode (default values are configurable)

Threshold (Default) Behavior
134 bpm No further level increase
148 bpm Actively drop 3 levels
158 bpm Stop directly

Configuration items: HR_WARN / HR_DOWN / HR_STOP. Personalized measurement and setting lines can be found in the repository docs/CALIBRATION.md; copying others’ numbers is not advisable.

Additionally: state/auto.json is the regulator’s physical switch; deleting it stops the device in place; the regulator does not generate dialogue content, only changes intensity. The table above is ineffective in script mode; safety is the user’s responsibility. The repository specifies it is for adults; do not use it in scenarios where it cannot be interrupted at any time.

Local Dependency Services

If any are missing, the corresponding part is skipped and the process does not crash:

  • TOY_DAEMON (default 127.0.0.1:7970): BLE control, GET /state
  • HR_URL (default 127.0.0.1:7971): Physiological data, GET /health

The device-side implementation is borrowed from RadeyesDrosophilaProMax/dsh-tf-bhpro; this repository is responsible for the heat engine, collector, regulator, and DSH HTTP exposure.

DSH Settings Page and HTTP API

After installation, a separate tab “Closed-loop Intensity” is added to settings: mode switching, 30-second resting heart rate sampling, three safety thresholds, per-minute decay, physiological data address, etc.; after saving, it writes to state/settings.json, and the collector and regulator re-read periodically, no restart required.

The HTTP routes registered by the plugin include: GET /heat/api, GET /heat/state, POST /heat/api/set, POST /heat/api/reset, POST /heat/api/auto, etc. (see README for details).

Time Scale with Other Plugins

This plugin only manages “this session’s” minute-level heat; long-term emotions and long-term accumulation can be handed over to projects like dsh-fish-mood and dsh-libido-panel; they can be accessed via applyEvent() by your own engine.

Installation and Activation

Runtime environment: Node.js >= 20; peer dependency @deepseek-ai/cordis ^4.0.1.

The method of obtaining and mounting is given in the README. Clone the target directory named dsh-heat-loop:

git clone <this-repo> dsh-heat-loop
cd dsh-heat-loop

Insert the plugin in the DSH profile via cordis.patch.yml:

- insert:
    - id: heat-loop
      name: dsh-heat-loop

In package.json, dsh.bundle.patch points to ./cordis.patch.yml, dsh.client is web, and immediately: true.

After activation, three processes need to be run (can be separate or use systemd / pm2):

node lib/watch.mjs     # collector
node lib/driver.mjs    # regulator (with safety gates)
node lib/heatctl.mjs     # CLI: status / marking points / reset

npm scripts equivalents: npm run watch, npm run driver, npm run status.

Please review the GitHub source code and the MIT license before installing; the plugin runs with the current DSH process permissions and involves BLE and physiological data local HTTP services; confirm network binding and data source trustworthiness before deployment.

Typical Usage

View current heat and status:

node lib/heatctl.mjs

Manual marking (adds to queue, consumed by collector):

node lib/heatctl.mjs +8 "reason"

End the current session:

node lib/heatctl.mjs reset

Enable closed-loop adjustment: create state/auto.json, or call POST /heat/api/auto with { "on": true }. Stop: delete state/auto.json.

For agent integration, you can first read IMPLEMENTATION.md in the repository (frame parsing, state determination, self-excitation, and multi-writer race conditions, etc.).

Suitable Scenarios and Notes

More suitable for: Users who already have a local BLE daemon and (in feedback mode) a heart rate service, want intensity to change with real reactions, and are willing to self-test thresholds according to CALIBRATION.md.

Not suitable or requires caution: script open-loop mode without automatic physiological protection; scenarios where one cannot wear or provide heart rate data but still needs a safety gate should choose feedback and configure the service correctly.

The community directory is an independent site and has no official affiliation with DeepSeek / Hypothesis; GitHub star count is 1 at the time of directory scraping and is for reference only.

Conclusion

dsh-heat-loop provides the closed-loop intensity concept of “heat + feedback + safety gate” under the DSH workflow category. Compared to one-way command issuance, it adds readable state and heart rate basis. Further details are based on the repository README, docs/CALIBRATION.md, and IMPLEMENTATION.md.

  • Directory page: https://www.skillhub.cn/plugins/hihikohaza/dsh-heat-loop
  • GitHub: https://github.com/hihikohaza/dsh-heat-loop
羽毛球分组比赛记分
小程序二维码

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

Xiaoye