# Debug JS files in VSC with a debugger (how-to)

**URL:** <https://community.openhab.org/t/debug-js-files-in-vsc-with-a-debugger-how-to/168861>\
**Category:** Beginners\
**Created:** [March 22, 2026, 10:01am UTC](https://community.openhab.org/t/debug-js-files-in-vsc-with-a-debugger-how-to/168861 "2026-03-22T10:01:03Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![s0170071](https://community.openhab.org/user_avatar/community.openhab.org/s0170071/32/20561_2.png) [@s0170071](https://community.openhab.org/u/s0170071)\
**Post date:** [March 22, 2026, 10:01am UTC](https://community.openhab.org/t/debug-js-files-in-vsc-with-a-debugger-how-to/168861/1 "2026-03-22T10:01:03Z")

</div>

Hi all,  
anyone ever wished they could debug their OH rules with a debugger ? I mean like using breakpoints, watching variables and all that ? Here you go (JS files only) 🙂

> **[GitHub - s0170071/OH\_JS\_Debug: GraalJS Remote Debugging for OpenHAB 5 on Docker —...](https://github.com/s0170071/OH_JS_Debug)**
>
> GraalJS Remote Debugging for OpenHAB 5 on Docker — setup scripts and guide

OpenHAB ships GraalJS but not the debug instrument. You supply it. Four steps:

1. **Download 3 JARs, patch their manifest.** The JARs (`chromeinspector-tool`, `profiler-tool`, `json`) are plain Maven artifacts. They need one manifest header added (`Fragment-Host: org.openhab.osgiify.org.graalvm.truffle.truffle-api`) so OSGi merges them into the Truffle classloader. A Python script does this automatically — downloads, patches, deploys to `/openhab/addons/`:

2. **Copy a launch config to VS Code.** Paste this into `.vscode/launch.json`:

3. **Expose port 9229 and add JVM flags** (Docker only). In `docker-compose.yaml`:

4. **Restart.** `docker compose stop openhab && docker compose rm -f openhab && docker compose up -d openhab`

That’s it. Trigger any JS rule, then press ▶ in VS Code’s debug panel. The rest of this document explains _why_ each step is needed and what to do when something goes wrong.

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/0/8/08aba4d059aab593ccb62580e8ca3b2e73a710db.png)

For more details visit the repo. And ask claude to set it up for you…

Next steps (to make this even easier): Someone add the OSGI wrapped .jar files to the OpenHAB distribution 😉

---

<div class="post-metadata">

**Author:** ![florian-h05](https://community.openhab.org/user_avatar/community.openhab.org/florian-h05/32/117524_2.png) [@florian-h05](https://community.openhab.org/u/florian-h05)\
**Post date:** [March 22, 2026, 4:03pm UTC](https://community.openhab.org/t/debug-js-files-in-vsc-with-a-debugger-how-to/168861/2 "2026-03-22T16:03:24Z")

</div>

Nice you got it working! I also tried, but lost interest.

> [@s0170071](#):
>
> Next steps (to make this even easier): Someone add the OSGI wrapped .jar files to the OpenHAB distribution 😉

I still have [Add Graal chromeinspector-tool by florian-h05 · Pull Request #89 · openhab/openhab-osgiify · GitHub](https://github.com/openhab/openhab-osgiify/pull/89), which I can modify to OSGi-fy all required JARs and add them to the Distro.

Just one thing:  
Fragment-Bundle is rather bad practise IMO, rather service loading should be set up properly.

EDIT: I was able to get ServiceLoader working in the OSGi-fied Graal bundles.

---

<div class="post-metadata">

**Author:** ![patrik\_gfeller](https://community.openhab.org/user_avatar/community.openhab.org/patrik_gfeller/32/118631_2.png) [@patrik\_gfeller](https://community.openhab.org/u/patrik_gfeller)\
**Post date:** [March 22, 2026, 8:10pm UTC](https://community.openhab.org/t/debug-js-files-in-vsc-with-a-debugger-how-to/168861/3 "2026-03-22T20:10:39Z")

</div>

I currently try to find out if there is a maintainer for the vs-code extension, as I have interest to get this part of the project active again. openHAB with the possibility to maintain rules in git repo including regression tests, using the extension to keep them in sync with the server - combined with the debugger. Sounds like a real **USP** for openHAB …

I’m not aware of another system that could claim to offer web based rule editing, including [Blockly &nbsp;|&nbsp; Google for Developers](https://developers.google.com/blockly) - or fully git tracked rules (including regression tests) and debugging in a local IDE.

see also:

> [@Managing openHAB Rules Like Production Software: Testing, Automation, and Troubleshooting](https://community.openhab.org/t/managing-openhab-rules-like-production-software-testing-automation-and-troubleshooting/168641):
>
> Hi all, as I’m using openHAB since more than 10 year regressions problems, and troubleshooting after upgrades are well known to me. So - as I tried to leverage AI agents to create a system to create testable rules and widgets - and I’m quite happy with the result. As usual, my time is very limited - especially as I want to finish the Jellyfin binding to make it available to all users (locally it is under testing with 5.1.2) … So I dared to task the AI to describe the setup - not idea…

What do you think?

with kind regards,  
Patrik

---

<div class="post-metadata">

**Author:** ![sihui](https://community.openhab.org/user_avatar/community.openhab.org/sihui/32/55674_2.png) [@sihui](https://community.openhab.org/u/sihui)\
**Post date:** [March 22, 2026, 9:01pm UTC](https://community.openhab.org/t/debug-js-files-in-vsc-with-a-debugger-how-to/168861/4 "2026-03-22T21:01:23Z")

</div>

> [@patrik\_gfeller](#):
>
> I currently try to find out if there is a maintainer for the vs-code extension

Not sure, but at least some modifications recently:

> [@VSCode extension for js rules and variables](https://community.openhab.org/t/vscode-extension-for-js-rules-and-variables/168387/16):
>
> Check this out:

---

<div class="post-metadata">

**Author:** ![florian-h05](https://community.openhab.org/user_avatar/community.openhab.org/florian-h05/32/117524_2.png) [@florian-h05](https://community.openhab.org/u/florian-h05)\
**Post date:** [March 24, 2026, 1:05pm UTC](https://community.openhab.org/t/debug-js-files-in-vsc-with-a-debugger-how-to/168861/5 "2026-03-24T13:05:06Z")

</div>

Hi @s0170071 and @patrik_gfeller,

I have now properly OSGi-ified the required GraalVM JARs (using OSGi’s ServiceLoader mediator), added them as feature dependency to JS Scripting and implemented a configuration option for JS Scripting to enable/disable the debugger and set its port.  
Using this is similar to what @s0170071 has done, but it’s easier to get it running as it only requires changing an add-on setting and restarting openHAB.  
See [[jsscripting] Implement debugger support by florian-h05 · Pull Request #20440 · openhab/openhab-addons · GitHub](https://github.com/openhab/openhab-addons/pull/20440).

Testing that PR is a bit difficult as you cannot simply drop the JAR into your addons folder, but you also need to deploy the feature dependencies and setup their start-levels so ServiceLoader mediator works properly.  
Maybe you want to wait a bit till you can try it out in the snapshot builds.

---

<div class="post-metadata">

**Author:** ![florian-h05](https://community.openhab.org/user_avatar/community.openhab.org/florian-h05/32/117524_2.png) [@florian-h05](https://community.openhab.org/u/florian-h05)\
**Post date:** [April 25, 2026, 8:37am UTC](https://community.openhab.org/t/debug-js-files-in-vsc-with-a-debugger-how-to/168861/6 "2026-04-25T08:37:37Z")

</div>

Hi all,

my PR has been merged (and we now also have integration tests for JS Scripting), you can use the debugger in the latest snapshot builds.  
It has to be enabled in the add-on settings and is then available for all scripts after a restart.

@patrik_gfeller @s0170071 Do you know how to debug scripts that are created through the UI? For file-based, it’s pretty straightforward, but how does the mapping between breakpoints and UI scripts happen?

---

<div class="post-metadata">

**Author:** ![patrik\_gfeller](https://community.openhab.org/user_avatar/community.openhab.org/patrik_gfeller/32/118631_2.png) [@patrik\_gfeller](https://community.openhab.org/u/patrik_gfeller)\
**Post date:** [May 1, 2026, 12:18am UTC](https://community.openhab.org/t/debug-js-files-in-vsc-with-a-debugger-how-to/168861/7 "2026-05-01T00:18:36Z")

</div>

> [@florian-h05](#):
>
> Do you know how to debug scripts that are created through the UI? For file-based, it’s pretty straightforward, but how does the mapping between breakpoints and UI scripts happen?

@florian-h05 Not yet … At the moment I’m finishing the Jellyfin work to get this released. Then I propose to release a small update of the VS code extension with the changes we already did to verify that we can deploy to the official extension “marketplace”.

Once that works and Jellyfin is merged I’ll concentrate on JavaScript in the extension and start with the debugger. I hope I can integrate directly - but even if that does not work I’ve a backup idea which should work (would involve some more logic in the extension - therefore 2nd choice). I’ll give more details once we can deploy and the current binding work is done.

kind regards,  
Patrik

---

<div class="post-metadata">

**Author:** ![florian-h05](https://community.openhab.org/user_avatar/community.openhab.org/florian-h05/32/117524_2.png) [@florian-h05](https://community.openhab.org/u/florian-h05)\
**Post date:** [May 1, 2026, 11:51am UTC](https://community.openhab.org/t/debug-js-files-in-vsc-with-a-debugger-how-to/168861/8 "2026-05-01T11:51:16Z")

</div>

> [@patrik\_gfeller](#):
>
> Once that works and Jellyfin is merged I’ll concentrate on JavaScript in the extension and start with the debugger.

I’ll wait with the docs then, the feature is in and will be shipped with 5.2. Docs can be easily updated after the release.

---

<div class="post-metadata">

**Author:** ![patrik\_gfeller](https://community.openhab.org/user_avatar/community.openhab.org/patrik_gfeller/32/118631_2.png) [@patrik\_gfeller](https://community.openhab.org/u/patrik_gfeller)\
**Post date:** [May 8, 2026, 9:10am UTC](https://community.openhab.org/t/debug-js-files-in-vsc-with-a-debugger-how-to/168861/9 "2026-05-08T09:10:11Z")

</div>

Maybe we can target a 1.0.1 release of the extension together with 5.2 to make it visible again and to check if the release process to the marketplace works. There are already some small improvements - and of course the marketing aspect of it.

---

<div class="post-metadata">

**Author:** ![s0170071](https://community.openhab.org/user_avatar/community.openhab.org/s0170071/32/20561_2.png) [@s0170071](https://community.openhab.org/u/s0170071)\
**Post date:** [July 24, 2026, 10:11pm UTC](https://community.openhab.org/t/debug-js-files-in-vsc-with-a-debugger-how-to/168861/10 "2026-07-24T22:11:37Z")

</div>

No, sorry. I am not using the UI so I haven’t looked into it.
