Skip to content

feat: support embedding Z-Wave JS UI in other software#4520

Merged
robertsLando merged 15 commits intomasterfrom
external-port-setting
Feb 3, 2026
Merged

feat: support embedding Z-Wave JS UI in other software#4520
robertsLando merged 15 commits intomasterfrom
external-port-setting

Conversation

@AlCalzone
Copy link
Member

@AlCalzone AlCalzone commented Jan 16, 2026

This PR adds support for embedding Z-Wave JS UI in other software, e.g. a Home Assistant addon.

In this mode, several settings are managed externally and will be unavailable in Z-Wave JS UI.

Controller port

Set using the env variable ZWAVE_PORT:
grafik

Security keys, RF and log configuration

Set using the env variable ZWAVE_EXTERNAL_SETTINGS

@coveralls
Copy link

coveralls commented Jan 16, 2026

Pull Request Test Coverage Report for Build 21627130537

Details

  • 0 of 275 (0.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.2%) to 19.288%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/stores/base.js 0 7 0.0%
api/lib/ZwaveClient.ts 0 11 0.0%
api/app.ts 0 25 0.0%
api/lib/externalSettings.ts 0 232 0.0%
Totals Coverage Status
Change from base Build 21469973205: -0.2%
Covered Lines: 4052
Relevant Lines: 22295

💛 - Coveralls

@AlCalzone AlCalzone force-pushed the external-port-setting branch 3 times, most recently from 4bc6ebd to 2b226db Compare January 16, 2026 12:38
@AlCalzone
Copy link
Member Author

Before merging, we need to delete the tarball again. I had to upload it for testing.

@AlCalzone AlCalzone force-pushed the external-port-setting branch from 2b226db to ec54863 Compare January 16, 2026 12:44
@AlCalzone AlCalzone marked this pull request as draft January 16, 2026 19:33
@AlCalzone AlCalzone changed the title feat: support setting controller port through env variable ZWAVE_PORT feat: support embedding Z-Wave JS UI in other software Jan 16, 2026
@AlCalzone AlCalzone removed the request for review from robertsLando January 16, 2026 19:34
Copy link
Member

@robertsLando robertsLando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from tarball the code changes look good to me 👍🏼

@AlCalzone
Copy link
Member Author

Did a few more changes. Once we're ready to merge and release, I'll delete the tarballs again.

Copy link
Member

@robertsLando robertsLando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good. I'm wondering if in UI it makes sense to make inputs disabled instead of hiding them. WDYT?

Copy link
Member

@robertsLando robertsLando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would also be nice to mention this on docs somewhere

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for embedding Z-Wave JS UI in other software (e.g., Home Assistant addon) by allowing external management of certain settings through environment variables and a JSON configuration file.

Changes:

  • Adds new externalSettings.ts module to load and merge external Z-Wave settings from a JSON file specified via ZWAVE_EXTERNAL_SETTINGS environment variable
  • Implements ZWAVE_PORT environment variable to force-enable Z-Wave and override the configured port, disabling serial port enumeration
  • Updates Settings UI to conditionally hide fields for externally managed settings using isSettingManagedExternally checks
  • Adds managedExternally array to frontend store to track which settings are managed externally

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
api/lib/externalSettings.ts New module providing functions to load external settings from JSON file, merge them into Z-Wave config, apply driver-only settings, and generate list of externally managed setting paths
api/lib/ZwaveClient.ts Adds ZWAVE_PORT environment variable handling to force-enable and override port, and applies external driver settings after security key parsing
api/app.ts Integrates external settings by merging them before ZwaveClient initialization, constructs managedExternally array for API responses, and skips serial port enumeration when ZWAVE_PORT is set
src/stores/base.js Adds managedExternally state array and isSettingManagedExternally getter function to check if a setting path is externally managed
src/views/Settings.vue Adds conditional rendering (v-if directives) to hide UI controls for externally managed settings across Z-Wave, security keys, RF configuration, logging, and Home Assistant sections; adds computed properties to check when all settings in a group are externally managed
.env.app.example Documents new ZWAVE_PORT and ZWAVE_EXTERNAL_SETTINGS environment variables
api/lib/utils.ts Removes outdated TODO comment about using ??= operator
package.json Bumps version to 11.10.2-alpha.6

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@AlCalzone
Copy link
Member Author

@copilot add documentation for the new features in this PR to the end of the usage/setup section in the docs

Copy link
Contributor

Copilot AI commented Feb 3, 2026

@AlCalzone I've opened a new pull request, #4533, to work on those changes. Once the pull request is ready, I'll request review from you.

AlCalzone and others added 2 commits February 3, 2026 11:26
Adds documentation for embedding Z-Wave JS UI in other software (e.g.,
Home Assistant add-ons) where settings are managed externally via
environment variables.

### Documentation Added

- **Controller Port Override** (`ZWAVE_PORT`): Force-enable Z-Wave and
override configured port, disables serial port enumeration in UI
- **External Settings Management** (`ZWAVE_EXTERNAL_SETTINGS`): Path to
JSON file with externally managed driver/server settings, hides
corresponding UI controls
- **Supported External Settings**: Complete reference for all
configurable settings:
  - Logging (UI + driver-only options)
  - RF configuration (region, auto power levels)
  - Storage settings (cache dir, throttle mode)
  - Security keys (S0, S2, Long Range)
  - Z-Wave JS Server configuration
  - Driver presets
- **Example Configuration**: Real-world Home Assistant add-on setup with
JSON structure

### External Settings File Example

```json
{
  "logEnabled": true,
  "logLevel": "info",
  "rf": {
    "region": 0,
    "autoPowerlevels": true
  },
  "securityKeys": {
    "S0_Legacy": "0102030405060708090A0B0C0D0E0F10",
    "S2_Authenticated": "2122232425262728292A2B2C2D2E2F30"
  },
  "serverEnabled": true,
  "serverPort": 3000
}
```

Documentation placed at end of `docs/usage/setup.md` as requested.

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: AlCalzone <17641229+AlCalzone@users.noreply.github.com>
@robertsLando robertsLando marked this pull request as ready for review February 3, 2026 10:45
@robertsLando
Copy link
Member

@AlCalzone Lookd good to me, did you checked also #4520 (review) ?

@AlCalzone
Copy link
Member Author

I had them disabled at first, but eventually decided to hide them completely. The settings felt unnecessarily noisy with all those disabled fields the user couldn't use at all.

@robertsLando robertsLando merged commit 9b081cc into master Feb 3, 2026
12 checks passed
@robertsLando robertsLando deleted the external-port-setting branch February 3, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants