Skip to content

Commit

Permalink
Upgrade to Z-Wave JS v12.5 (#40)
Browse files Browse the repository at this point in the history
- Update dependencies
- Update Z-Wave JS to [v12.5.4](https://github.com/zwave-js/node-zwave-js/releases/tag/v12.5.4)
- Update Z-Wave JS Server to [v1.35.0-beta.1](https://github.com/zwave-js/zwave-js-server/releases/tag/1.35.0-beta.1)
- Add env vars for Long Range security keys
- Add env var for RF Region
  • Loading branch information
kpine authored Apr 13, 2024
1 parent 55e3cc0 commit 42d7c6f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .arg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ZWAVE_JS_VERSION=12.4.4
ZWAVE_JS_SERVER_VERSION=1.34.0
ZWAVE_JS_VERSION=12.5.4
ZWAVE_JS_SERVER_VERSION=1.35.0-beta.1
4 changes: 2 additions & 2 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
VERSION 0.7
VERSION 0.8

FROM alpine:3.18

WORKDIR /app

RUN apk add --no-cache \
nodejs=18.19.1-r0 \
nodejs=18.20.1-r0 \
tzdata

all:
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ S2_ACCESS_CONTROL_KEY=7764841BC794A54442E324682A550CEF
S2_AUTHENTICATED_KEY=66EA86F088FFD6D7497E0B32BC0C8B99
S2_UNAUTHENTICATED_KEY=2FAB1A27E19AE9C7CC6D18ACEB90C357
S0_LEGACY_KEY=17DFB0C1BED4CABFF54E4B5375E257B3
LR_S2_ACCESS_CONTROL_KEY=61BEF779F9DF0827CD9870B719D074BB
LR_S2_AUTHENTICATED_KEY=905B869063266296AE5159EEDBEE038D
RF_REGION=USA (Long Range)
```

### Run with a volume mount
Expand Down Expand Up @@ -48,10 +51,13 @@ services:
image: ghcr.io/kpine/zwave-js-server:latest
restart: unless-stopped
environment:
S2_ACCESS_CONTROL_KEY: "7764841BC794A54442E324682A550CEF"
S2_AUTHENTICATED_KEY: "66EA86F088FFD6D7497E0B32BC0C8B99"
S2_UNAUTHENTICATED_KEY: "2FAB1A27E19AE9C7CC6D18ACEB90C357"
S0_LEGACY_KEY: "17DFB0C1BED4CABFF54E4B5375E257B3"
- "S2_ACCESS_CONTROL_KEY=7764841BC794A54442E324682A550CEF"
- "S2_AUTHENTICATED_KEY=66EA86F088FFD6D7497E0B32BC0C8B99"
- "S2_UNAUTHENTICATED_KEY=2FAB1A27E19AE9C7CC6D18ACEB90C357"
- "S0_LEGACY_KEY=17DFB0C1BED4CABFF54E4B5375E257B3"
- "LR_S2_ACCESS_CONTROL_KEY=61BEF779F9DF0827CD9870B719D074BB"
- "LR_S2_AUTHENTICATED_KEY=905B869063266296AE5159EEDBEE038D"
- "RF_REGION=USA (Long Range)"
devices:
- "/dev/serial/by-id/usb-0658_0200-if00:/dev/zwave"
volumes:
Expand All @@ -70,6 +76,9 @@ services:
- `S2_AUTHENTICATED_KEY`: The network key for the S2 Authenticated security class.
- `S2_UNAUTHENTICATED_KEY`: The network key for the S2 Unauthenticated security class.
- `S0_LEGACY_KEY`: The network key for the S0 (Legacy) security class.
- `LR_S2_ACCESS_CONTROL_KEY`: The network key for the Long Range S2 Access Control security class.
- `LR_S2_AUTHENTICATED_KEY`: The network key for the Long Range S2 Authenticated security class.
- `RF_REGION`: The [RF region](https://github.com/zwave-js/node-zwave-js/blob/0c2e03ea57490f1b361f600b32d595b25f26c1a6/packages/core/src/capabilities/RFRegion.ts#L2-L14) the radio should be tuned to. If set, the driver will ensure the region is set to the specified value. The default is unset, which means the controller will keep its current region setting.
- `USB_PATH`: The device path of the Z-Wave USB controller. Defaults to `/dev/zwave`. Use of this variable is unnecessary if the controller device path is mapped from the host as `/dev/zwave`.
- `FIRMWARE_UPDATE_API_KEY`: The API key used to access the Z-Wave JS Firmware Update Service. By default, no key is configured. Usually it is not necessary to configure this, unless you are a commercial user. See the [Firmware Update API Key](#firmware-update-api-key) section for details.
- `ENABLE_DNS_SD`: Set this to `true` to enable DNS Service Discovery. The default is disabled. Enabling this only works if you are using host networking.
Expand Down
28 changes: 28 additions & 0 deletions files/app/options.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const safe = require('zwave-js/safe')

function getLogConfig() {
let config = {
forceConsole: true,
Expand Down Expand Up @@ -36,6 +38,22 @@ function getSecurityKeys() {
return keys;
}

function getLongRangeSecurityKeys() {
const env_keys = {
S2_AccessControl: process.env.LR_S2_ACCESS_CONTROL_KEY,
S2_Authenticated: process.env.LR_S2_AUTHENTICATED_KEY,
};

let keys = {};
for (const [name, key] of Object.entries(env_keys)) {
if (key) {
keys[name] = key;
}
}

return keys;
}

function getApiKeys() {
let fw_key = process.env.FIRMWARE_UPDATE_API_KEY;

Expand All @@ -52,13 +70,23 @@ function getApiKeys() {
return { firmwareUpdateService: fw_key };
}

function getRFSettings() {
if (!process.env.RF_REGION) {
return undefined;
}

return { region: safe.RFRegion[process.env.RF_REGION] };
}

module.exports = {
logConfig: getLogConfig(),
storage: {
cacheDir: "/cache",
deviceConfigPriorityDir: "/cache/config",
},
securityKeys: getSecurityKeys(),
securityKeysLongRange: getLongRangeSecurityKeys(),
apiKeys: getApiKeys(),
userAgent: { "kpine/zwave-js-server": process.env.BUILD_VERSION || "unknown" },
rf: getRFSettings(),
};

0 comments on commit 42d7c6f

Please sign in to comment.