Skip to content

Commit

Permalink
Merge branch 'master' into pr/jtbraun/6401-1
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone committed Jan 19, 2024
2 parents c58c2fa + fb93b59 commit 01039de
Show file tree
Hide file tree
Showing 44 changed files with 790 additions and 186 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,37 @@
<!--
Add placeholder for next release with `wip` snippet
-->
## 12.4.1 (2023-12-09)
### Bugfixes
* Handle more cases of unexpected Serial API restarts (#6551)

### Config file changes
* Add wakeup instructions for Nexia ZSENS930 (#6545)
* Correct parameter 5 size for Zooz ZEN34 (#6546)

## 12.4.0 (2023-11-30)
### Features
* Expose rebuild routes progress as a controller property (#6525)

### Bugfixes
* On devices that should/must not support `Basic CC`, but use it for reporting, only the `currentValue` is now exposed. This allows applications to consider it a sensor, not an actor (#6526)

## 12.3.2 (2023-11-29)
### Config file changes
* Correct firmware version condition for Zooz ZSE40 v3.0 (#6519)

### Changes under the hood
* Add mocks for `Multilevel Sensor CC`
* Upgrade transitive dependency `axios` to a non-vulnerable version (#6520)

## 12.3.1 (2023-11-20)
### Bugfixes
* Fixed an issue where the unresponsive controller recovery could put "immediate" commands to a sleeping node on the wrong queue, blocking all outgoing communication (#6507)

### Config file changes
* Add missing units and firmware condition for Heatit Z-Temp2 (#6500)
* Correct device label for Airzone Aidoo Control HVAC unit (#6493)

## 12.3.0 (2023-10-31)
### Features
* Allow disabling the unresponsive controller recovery feature (#6480)
Expand Down
2 changes: 2 additions & 0 deletions docs/api/config-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ interface GenericDeviceClass {
readonly requiresSecurity?: boolean;
readonly supportedCCs: readonly CommandClasses[];
readonly controlledCCs: readonly CommandClasses[];
readonly maySupportBasicCC: boolean;
readonly specific: ReadonlyMap<number, SpecificDeviceClass>;
}
```
Expand All @@ -429,6 +430,7 @@ interface SpecificDeviceClass {
readonly requiresSecurity?: boolean;
readonly supportedCCs: readonly CommandClasses[];
readonly controlledCCs: readonly CommandClasses[];
readonly maySupportBasicCC: boolean;
}
```

Expand Down
8 changes: 8 additions & 0 deletions docs/api/controller.md
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,14 @@ readonly isRebuildingRoutes: boolean;

Returns whether the routes are currently being rebuilt for one or more nodes.

### `rebuildRoutesProgress`

```ts
readonly rebuildRoutesProgress: ReadonlyMap<number, RebuildRoutesStatus> | undefined;
```

If routes are currently being rebuilt for the entire network, this returns the current progress as a map of each node's ID and its status.

### `inclusionState`

```ts
Expand Down
2 changes: 2 additions & 0 deletions docs/api/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ interface GenericDeviceClass {
readonly requiresSecurity?: boolean;
readonly supportedCCs: readonly CommandClasses[];
readonly controlledCCs: readonly CommandClasses[];
readonly maySupportBasicCC: boolean;
readonly specific: ReadonlyMap<number, SpecificDeviceClass>;
}
```
Expand All @@ -921,6 +922,7 @@ interface SpecificDeviceClass {
readonly requiresSecurity?: boolean;
readonly supportedCCs: readonly CommandClasses[];
readonly controlledCCs: readonly CommandClasses[];
readonly maySupportBasicCC: boolean;
}
```

Expand Down
6 changes: 6 additions & 0 deletions maintenance/schemas/deviceClasses.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"controlledCCs": {
"$ref": "#/definitions/CCs"
},
"maySupportBasicCC": {
"const": false
},
"specific": {
"type": "object",
"patternProperties": {
Expand All @@ -45,6 +48,9 @@
},
"controlledCCs": {
"$ref": "#/definitions/CCs"
},
"maySupportBasicCC": {
"const": false
}
},
"required": ["label"],
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zwave-js/repo",
"version": "12.3.0",
"version": "12.4.1",
"private": true,
"description": "Z-Wave driver written entirely in JavaScript/TypeScript",
"keywords": [],
Expand Down Expand Up @@ -32,8 +32,8 @@
"@actions/exec": "^1.1.1",
"@actions/github": "^5.0.3",
"@alcalzone/jsonl-db": "^3.1.0",
"@alcalzone/monopack": "^1.2.1",
"@alcalzone/release-script": "~3.6.0",
"@alcalzone/monopack": "^1.2.2",
"@alcalzone/release-script": "~3.7.0",
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@dprint/formatter": "^0.2.0",
Expand Down
32 changes: 28 additions & 4 deletions packages/cc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1723,6 +1723,8 @@ export class BasicCC extends CommandClass {
// (undocumented)
ccCommand: BasicCommand;
// (undocumented)
getDefinedValueIDs(applHost: ZWaveApplicationHost_2): ValueID_2[];
// (undocumented)
interview(applHost: ZWaveApplicationHost_2): Promise<void>;
// (undocumented)
refreshValues(applHost: ZWaveApplicationHost_2): Promise<void>;
Expand Down Expand Up @@ -1811,7 +1813,7 @@ export const BasicCCValues: Readonly<{
readonly minVersion: 1;
readonly supportsEndpoints: true;
readonly stateful: false;
readonly autoCreate: (applHost: ZWaveApplicationHost_2, endpoint: IZWaveEndpoint_2) => boolean;
readonly autoCreate: false;
};
};
restorePrevious: {
Expand Down Expand Up @@ -12133,26 +12135,48 @@ export interface MultilevelSensorCCReportOptions extends CCCommandOptions {
//
// @public (undocumented)
export class MultilevelSensorCCSupportedScaleReport extends MultilevelSensorCC {
constructor(host: ZWaveHost_2, options: CommandClassDeserializationOptions);
constructor(host: ZWaveHost_2, options: CommandClassDeserializationOptions | MultilevelSensorCCSupportedScaleReportOptions);
// (undocumented)
readonly sensorType: number;
// (undocumented)
serialize(): Buffer;
// (undocumented)
readonly supportedScales: readonly number[];
// (undocumented)
toLogEntry(applHost: ZWaveApplicationHost_2): MessageOrCCLogEntry_2;
}

// Warning: (ae-missing-release-tag) "MultilevelSensorCCSupportedScaleReportOptions" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface MultilevelSensorCCSupportedScaleReportOptions extends CCCommandOptions {
// (undocumented)
sensorType: number;
// (undocumented)
supportedScales: readonly number[];
}

// Warning: (ae-missing-release-tag) "MultilevelSensorCCSupportedSensorReport" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export class MultilevelSensorCCSupportedSensorReport extends MultilevelSensorCC {
constructor(host: ZWaveHost_2, options: CommandClassDeserializationOptions);
constructor(host: ZWaveHost_2, options: CommandClassDeserializationOptions | MultilevelSensorCCSupportedSensorReportOptions);
// (undocumented)
serialize(): Buffer;
// (undocumented)
readonly supportedSensorTypes: readonly number[];
supportedSensorTypes: readonly number[];
// (undocumented)
toLogEntry(applHost: ZWaveApplicationHost_2): MessageOrCCLogEntry_2;
}

// Warning: (ae-missing-release-tag) "MultilevelSensorCCSupportedSensorReportOptions" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface MultilevelSensorCCSupportedSensorReportOptions extends CCCommandOptions {
// (undocumented)
supportedSensorTypes: readonly number[];
}

// Warning: (ae-missing-release-tag) "MultilevelSensorCCValues" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down
2 changes: 1 addition & 1 deletion packages/cc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zwave-js/cc",
"version": "12.3.0",
"version": "12.4.1",
"description": "zwave-js: Command Classes",
"keywords": [],
"publishConfig": {
Expand Down
5 changes: 4 additions & 1 deletion packages/cc/src/cc/BasicCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,15 @@ remaining duration: ${basicResponse.duration?.toString() ?? "undefined"}`;
ret.push(...super.getDefinedValueIDs(applHost));
}

// Add the compat event value if it should be exposed
if (
!!applHost.getDeviceConfig?.(endpoint.nodeId)?.compat
?.treatBasicSetAsEvent
) {
// Add the compat event value if it should be exposed
ret.push(BasicCCValues.compatEvent.endpoint(endpoint.index));
} else if (endpoint.controlsCC(CommandClasses.Basic)) {
// Otherwise, only expose currentValue on devices that only control Basic CC
ret.push(BasicCCValues.currentValue.endpoint(endpoint.index));
}

return ret;
Expand Down
75 changes: 56 additions & 19 deletions packages/cc/src/cc/MultilevelSensorCC.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Scale, getDefaultScale } from "@zwave-js/config";
import { timespan } from "@zwave-js/core";
import { encodeBitMask, timespan } from "@zwave-js/core";
import type {
IZWaveEndpoint,
MessageOrCCLogEntry,
Expand All @@ -13,8 +13,6 @@ import {
type MaybeNotKnown,
MessagePriority,
ValueMetadata,
ZWaveError,
ZWaveErrorCodes,
encodeFloatWithScale,
parseBitMask,
parseFloatWithScale,
Expand Down Expand Up @@ -829,22 +827,41 @@ export class MultilevelSensorCCGet extends MultilevelSensorCC {
}
}

// @publicAPI
export interface MultilevelSensorCCSupportedSensorReportOptions
extends CCCommandOptions
{
supportedSensorTypes: readonly number[];
}

@CCCommand(MultilevelSensorCommand.SupportedSensorReport)
export class MultilevelSensorCCSupportedSensorReport
extends MultilevelSensorCC
{
public constructor(
host: ZWaveHost,
options: CommandClassDeserializationOptions,
options:
| CommandClassDeserializationOptions
| MultilevelSensorCCSupportedSensorReportOptions,
) {
super(host, options);
validatePayload(this.payload.length >= 1);
this.supportedSensorTypes = parseBitMask(this.payload);

if (gotDeserializationOptions(options)) {
validatePayload(this.payload.length >= 1);
this.supportedSensorTypes = parseBitMask(this.payload);
} else {
this.supportedSensorTypes = options.supportedSensorTypes;
}
}

// TODO: Use this during interview to precreate values
@ccValue(MultilevelSensorCCValues.supportedSensorTypes)
public readonly supportedSensorTypes: readonly number[];
public supportedSensorTypes: readonly number[];

public serialize(): Buffer {
this.payload = encodeBitMask(this.supportedSensorTypes);
return super.serialize();
}

public toLogEntry(applHost: ZWaveApplicationHost): MessageOrCCLogEntry {
return {
Expand All @@ -869,20 +886,35 @@ export class MultilevelSensorCCSupportedSensorReport
@expectedCCResponse(MultilevelSensorCCSupportedSensorReport)
export class MultilevelSensorCCGetSupportedSensor extends MultilevelSensorCC {}

// @publicAPI
export interface MultilevelSensorCCSupportedScaleReportOptions
extends CCCommandOptions
{
sensorType: number;
supportedScales: readonly number[];
}

@CCCommand(MultilevelSensorCommand.SupportedScaleReport)
export class MultilevelSensorCCSupportedScaleReport extends MultilevelSensorCC {
public constructor(
host: ZWaveHost,
options: CommandClassDeserializationOptions,
options:
| CommandClassDeserializationOptions
| MultilevelSensorCCSupportedScaleReportOptions,
) {
super(host, options);

validatePayload(this.payload.length >= 2);
this.sensorType = this.payload[0];
this.supportedScales = parseBitMask(
Buffer.from([this.payload[1] & 0b1111]),
0,
);
if (gotDeserializationOptions(options)) {
validatePayload(this.payload.length >= 2);
this.sensorType = this.payload[0];
this.supportedScales = parseBitMask(
Buffer.from([this.payload[1] & 0b1111]),
0,
);
} else {
this.sensorType = options.sensorType;
this.supportedScales = options.supportedScales;
}
}

public readonly sensorType: number;
Expand All @@ -894,6 +926,14 @@ export class MultilevelSensorCCSupportedScaleReport extends MultilevelSensorCC {
)
public readonly supportedScales: readonly number[];

public serialize(): Buffer {
this.payload = Buffer.concat([
Buffer.from([this.sensorType]),
encodeBitMask(this.supportedScales, 4, 0),
]);
return super.serialize();
}

public toLogEntry(applHost: ZWaveApplicationHost): MessageOrCCLogEntry {
return {
...super.toLogEntry(applHost),
Expand Down Expand Up @@ -935,11 +975,8 @@ export class MultilevelSensorCCGetSupportedScale extends MultilevelSensorCC {
) {
super(host, options);
if (gotDeserializationOptions(options)) {
// TODO: Deserialize payload
throw new ZWaveError(
`${this.constructor.name}: deserialization not implemented`,
ZWaveErrorCodes.Deserialization_NotImplemented,
);
validatePayload(this.payload.length >= 1);
this.sensorType = this.payload[0];
} else {
this.sensorType = options.sensorType;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/cc/src/cc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ export type {
MultilevelSensorCCGetOptions,
MultilevelSensorCCGetSupportedScaleOptions,
MultilevelSensorCCReportOptions,
MultilevelSensorCCSupportedScaleReportOptions,
MultilevelSensorCCSupportedSensorReportOptions,
} from "./MultilevelSensorCC";
export {
MultilevelSensorCC,
Expand Down
4 changes: 4 additions & 0 deletions packages/config/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,8 @@ export class GenericDeviceClass {
// (undocumented)
readonly label: string;
// (undocumented)
readonly maySupportBasicCC: boolean;
// (undocumented)
readonly requiresSecurity?: boolean;
// (undocumented)
readonly specific: ReadonlyMap<number, SpecificDeviceClass>;
Expand Down Expand Up @@ -975,6 +977,8 @@ export class SpecificDeviceClass {
// (undocumented)
readonly label: string;
// (undocumented)
readonly maySupportBasicCC: boolean;
// (undocumented)
readonly requiresSecurity?: boolean;
// (undocumented)
readonly supportedCCs: readonly CommandClasses[];
Expand Down
Loading

0 comments on commit 01039de

Please sign in to comment.