Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make several reflection decorators generic and untangle Manufacturer Proprietary CC implementations #4701

Merged
merged 12 commits into from
Jun 9, 2022
Merged
12 changes: 7 additions & 5 deletions packages/cc/src/cc/AlarmSensorCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ import { getEnumMemberName, pick } from "@zwave-js/shared/safe";
import { validateArgs } from "@zwave-js/transformers";
import { CCAPI, PhysicalCCAPI } from "../lib/API";
import {
API,
CCCommand,
ccValue,
commandClass,
CommandClass,
expectedCCResponse,
gotDeserializationOptions,
implementedVersion,
type CCCommandOptions,
type CommandClassDeserializationOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import { AlarmSensorCommand, AlarmSensorType } from "../lib/_Types";

export function getAlarmSensorStateValueId(
Expand Down
12 changes: 7 additions & 5 deletions packages/cc/src/cc/AssociationCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@ import { validateArgs } from "@zwave-js/transformers";
import { distinct } from "alcalzone-shared/arrays";
import { CCAPI, PhysicalCCAPI } from "../lib/API";
import {
API,
CCCommand,
ccValue,
commandClass,
CommandClass,
expectedCCResponse,
gotDeserializationOptions,
implementedVersion,
type CCCommandOptions,
type CommandClassDeserializationOptions,
type CommandClassOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import * as ccUtils from "../lib/utils";
import { AssociationCommand, type AssociationAddress } from "../lib/_Types";

Expand Down
12 changes: 7 additions & 5 deletions packages/cc/src/cc/AssociationGroupInfoCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ import { cpp2js, getEnumMemberName, num2hex } from "@zwave-js/shared/safe";
import { validateArgs } from "@zwave-js/transformers";
import { CCAPI, PhysicalCCAPI } from "../lib/API";
import {
API,
CCCommand,
ccKeyValuePair,
ccValue,
commandClass,
CommandClass,
expectedCCResponse,
gotDeserializationOptions,
implementedVersion,
type CCCommandOptions,
type CommandClassDeserializationOptions,
type CommandClassOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import {
AssociationGroupInfoCommand,
AssociationGroupInfoProfile,
Expand Down
12 changes: 7 additions & 5 deletions packages/cc/src/cc/BarrierOperatorCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@ import {
throwWrongValueType,
} from "../lib/API";
import {
API,
CCCommand,
ccValue,
ccValueMetadata,
commandClass,
CommandClass,
expectedCCResponse,
gotDeserializationOptions,
implementedVersion,
type CCCommandOptions,
type CommandClassDeserializationOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import {
BarrierOperatorCommand,
BarrierState,
Expand Down
12 changes: 7 additions & 5 deletions packages/cc/src/cc/BasicCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@ import {
throwWrongValueType,
} from "../lib/API";
import {
API,
CCCommand,
ccValue,
ccValueMetadata,
commandClass,
CommandClass,
expectedCCResponse,
gotDeserializationOptions,
implementedVersion,
type CCCommandOptions,
type CommandClassDeserializationOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import { BasicCommand } from "../lib/_Types";

export function getTargetValueValueId(endpoint?: number): ValueID {
Expand Down
12 changes: 7 additions & 5 deletions packages/cc/src/cc/BatteryCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ import {
throwUnsupportedProperty,
} from "../lib/API";
import {
API,
CCCommand,
ccValue,
ccValueMetadata,
commandClass,
CommandClass,
expectedCCResponse,
implementedVersion,
type CommandClassDeserializationOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import {
BatteryChargingStatus,
BatteryCommand,
Expand Down
12 changes: 7 additions & 5 deletions packages/cc/src/cc/BinarySensorCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@ import {
throwUnsupportedProperty,
} from "../lib/API";
import {
API,
CCCommand,
ccValue,
commandClass,
CommandClass,
expectedCCResponse,
gotDeserializationOptions,
implementedVersion,
type CCCommandOptions,
type CommandClassDeserializationOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import { BinarySensorCommand, BinarySensorType } from "../lib/_Types";

export function getBinarySensorValueId(
Expand Down
12 changes: 7 additions & 5 deletions packages/cc/src/cc/BinarySwitchCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@ import {
throwWrongValueType,
} from "../lib/API";
import {
API,
CCCommand,
ccValue,
ccValueMetadata,
commandClass,
CommandClass,
expectedCCResponse,
gotDeserializationOptions,
implementedVersion,
type CCCommandOptions,
type CommandClassDeserializationOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import { BinarySwitchCommand } from "../lib/_Types";

function getCurrentValueValueId(endpoint?: number): ValueID {
Expand Down
12 changes: 7 additions & 5 deletions packages/cc/src/cc/CRC16CC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ import {
import type { ZWaveApplicationHost, ZWaveHost } from "@zwave-js/host/safe";
import { CCAPI } from "../lib/API";
import {
API,
CCCommand,
CommandClass,
commandClass,
expectedCCResponse,
gotDeserializationOptions,
implementedVersion,
type CCCommandOptions,
type CommandClassDeserializationOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import { CRC16Command } from "../lib/_Types";

// @noSetValueAPI
Expand Down
12 changes: 7 additions & 5 deletions packages/cc/src/cc/CentralSceneCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,20 @@ import {
throwWrongValueType,
} from "../lib/API";
import {
API,
CCCommand,
ccValue,
ccValueMetadata,
commandClass,
CommandClass,
expectedCCResponse,
gotDeserializationOptions,
implementedVersion,
type CCCommandOptions,
type CommandClassDeserializationOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import * as ccUtils from "../lib/utils";
import { CentralSceneCommand, CentralSceneKeys } from "../lib/_Types";
import { AssociationGroupInfoCC } from "./AssociationGroupInfoCC";
Expand Down
12 changes: 7 additions & 5 deletions packages/cc/src/cc/ClimateControlScheduleCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ import { validateArgs } from "@zwave-js/transformers";
import { padStart } from "alcalzone-shared/strings";
import { CCAPI } from "../lib/API";
import {
API,
CCCommand,
ccKeyValuePair,
ccValue,
commandClass,
CommandClass,
expectedCCResponse,
gotDeserializationOptions,
implementedVersion,
type CCCommandOptions,
type CommandClassDeserializationOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import {
decodeSetbackState,
decodeSwitchpoint,
Expand Down
12 changes: 7 additions & 5 deletions packages/cc/src/cc/ClockCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ import { validateArgs } from "@zwave-js/transformers";
import { padStart } from "alcalzone-shared/strings";
import { CCAPI } from "../lib/API";
import {
API,
CCCommand,
commandClass,
CommandClass,
expectedCCResponse,
gotDeserializationOptions,
implementedVersion,
type CCCommandOptions,
type CommandClassDeserializationOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import { ClockCommand, Weekday } from "../lib/_Types";

// @noSetValueAPI - This CC has no simple value to set
Expand Down
12 changes: 7 additions & 5 deletions packages/cc/src/cc/ColorSwitchCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,21 @@ import {
throwWrongValueType,
} from "../lib/API";
import {
API,
CCCommand,
ccValue,
ccValueMetadata,
commandClass,
CommandClass,
expectedCCResponse,
gotDeserializationOptions,
implementedVersion,
type CCCommandOptions,
type CommandClassDeserializationOptions,
type CommandClassOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import {
ColorComponent,
ColorComponentMap,
Expand Down
14 changes: 8 additions & 6 deletions packages/cc/src/cc/ConfigurationCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,19 @@ import {
throwWrongValueType,
} from "../lib/API";
import {
API,
CCCommand,
commandClass,
CommandClass,
expectedCCResponse,
CommandClassOptions,
gotDeserializationOptions,
implementedVersion,
type CCCommandOptions,
type CommandClassDeserializationOptions,
type CommandClassOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import { ConfigurationCommand, ConfigValue } from "../lib/_Types";

function configValueToString(value: ConfigValue): string {
Expand Down
4 changes: 2 additions & 2 deletions packages/cc/src/cc/DeviceResetLocallyCC.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { CommandClasses } from "@zwave-js/core/safe";
import { CommandClass } from "../lib/CommandClass";
import {
CCCommand,
commandClass,
CommandClass,
implementedVersion,
} from "../lib/CommandClass";
} from "../lib/CommandClassDecorators";
import { DeviceResetLocallyCommand } from "../lib/_Types";

// @noAPI: We can only receive this command
Expand Down
12 changes: 7 additions & 5 deletions packages/cc/src/cc/DoorLockCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,20 @@ import {
throwWrongValueType,
} from "../lib/API";
import {
API,
CCCommand,
ccValue,
ccValueMetadata,
commandClass,
CommandClass,
expectedCCResponse,
gotDeserializationOptions,
implementedVersion,
type CCCommandOptions,
type CommandClassDeserializationOptions,
} from "../lib/CommandClass";
import {
API,
CCCommand,
commandClass,
expectedCCResponse,
implementedVersion,
} from "../lib/CommandClassDecorators";
import {
DoorHandleStatus,
DoorLockCommand,
Expand Down
Loading