diff --git a/maintenance/schemas/deviceClasses.json b/maintenance/schemas/deviceClasses.json index 0f7d1820d169..837030d46765 100644 --- a/maintenance/schemas/deviceClasses.json +++ b/maintenance/schemas/deviceClasses.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/schema#", + "$schema": "https://json-schema.org/draft-07/schema", "type": "object", "properties": { "basic": { @@ -22,12 +22,6 @@ "requiresSecurity": { "const": true }, - "supportedCCs": { - "$ref": "#/definitions/CCs" - }, - "controlledCCs": { - "$ref": "#/definitions/CCs" - }, "maySupportBasicCC": { "const": false }, @@ -43,12 +37,6 @@ "requiresSecurity": { "const": true }, - "supportedCCs": { - "$ref": "#/definitions/CCs" - }, - "controlledCCs": { - "$ref": "#/definitions/CCs" - }, "maySupportBasicCC": { "const": false } @@ -67,136 +55,5 @@ } }, "required": ["basic", "generic"], - "additionalProperties": false, - "definitions": { - "CCs": { - "type": "array", - "items": { - "enum": [ - "Alarm Sensor", - "Alarm Silence", - "All Switch", - "Anti-Theft", - "Anti-Theft Unlock", - "Application Capability", - "Application Status", - "Association", - "Association Command Configuration", - "Association Group Information", - "Authentication", - "Authentication Media Write", - "Barrier Operator", - "Basic", - "Basic Tariff Information", - "Basic Window Covering", - "Battery", - "Binary Sensor", - "Binary Switch", - "Binary Toggle Switch", - "Climate Control Schedule", - "Central Scene", - "Clock", - "Color Switch", - "Configuration", - "Controller Replication", - "CRC-16 Encapsulation", - "Demand Control Plan Configuration", - "Demand Control Plan Monitor", - "Device Reset Locally", - "Door Lock", - "Door Lock Logging", - "Energy Production", - "Entry Control", - "Firmware Update Meta Data", - "Generic Schedule", - "Geographic Location", - "Grouping Name", - "Hail", - "HRV Status", - "HRV Control", - "Humidity Control Mode", - "Humidity Control Operating State", - "Humidity Control Setpoint", - "Inclusion Controller", - "Indicator", - "IP Association", - "IP Configuration", - "IR Repeater", - "Irrigation", - "Language", - "Lock", - "Mailbox", - "Manufacturer Proprietary", - "Manufacturer Specific", - "Support/Control Mark", - "Meter", - "Meter Table Configuration", - "Meter Table Monitor", - "Meter Table Push Configuration", - "Move To Position Window Covering", - "Multi Channel", - "Multi Channel Association", - "Multi Command", - "Multilevel Sensor", - "Multilevel Switch", - "Multilevel Toggle Switch", - "Network Management Basic Node", - "Network Management Inclusion", - "Network Management Installation and Maintenance", - "Network Management Primary", - "Network Management Proxy", - "No Operation", - "Node Naming and Location", - "Node Provisioning", - "Notification", - "Powerlevel", - "Prepayment", - "Prepayment Encapsulation", - "Proprietary", - "Protection", - "Pulse Meter", - "Rate Table Configuration", - "Rate Table Monitor", - "Remote Association Activation", - "Remote Association Configuration", - "Scene Activation", - "Scene Actuator Configuration", - "Scene Controller Configuration", - "Schedule", - "Schedule Entry Lock", - "Screen Attributes", - "Screen Meta Data", - "Security", - "Security 2", - "Sensor Configuration", - "Simple AV Control", - "Sound Switch", - "Supervision", - "Tariff Table Configuration", - "Tariff Table Monitor", - "Thermostat Fan Mode", - "Thermostat Fan State", - "Thermostat Mode", - "Thermostat Operating State", - "Thermostat Setback", - "Thermostat Setpoint", - "Time", - "Time Parameters", - "Transport Service", - "User Code", - "Version", - "Wake Up", - "Window Covering", - "Z/IP", - "Z/IP 6LoWPAN", - "Z/IP Gateway", - "Z/IP Naming and Location", - "Z/IP ND", - "Z/IP Portal", - "Z-Wave Plus Info" - ] - }, - "additionalItems": false - } - } + "additionalProperties": false } diff --git a/packages/cc/src/cc/MultiChannelCC.ts b/packages/cc/src/cc/MultiChannelCC.ts index 43e44eb9ba7e..6e5cbea47e63 100644 --- a/packages/cc/src/cc/MultiChannelCC.ts +++ b/packages/cc/src/cc/MultiChannelCC.ts @@ -160,21 +160,7 @@ function areEndpointsUnnecessary( return false; } - // If any endpoint has a mandatory supported CC that's not exposed by the root device, the endpoints are necessary - for (const { generic, specific } of deviceClasses.values()) { - const deviceClass = applHost.configManager.lookupSpecificDeviceClass( - generic, - specific, - ); - // Unsure what this device class is. Probably not a good idea to assume it's unnecessary - if (!deviceClass) return false; - if (deviceClass.supportedCCs.some((cc) => !node.supportsCC(cc))) { - // We found one that's not supported by the root device - return false; - } - } - - // Last heuristic: Endpoints are necessary if more than 1 of them has a switch-type device class + // Endpoints are necessary if more than 1 of them has a switch-type device class const switchTypeDeviceClasses = [ 0x10, // Binary Switch 0x11, // Multilevel Switch diff --git a/packages/config/config/deviceClasses.json b/packages/config/config/deviceClasses.json index 85f812a8307b..36268c559271 100644 --- a/packages/config/config/deviceClasses.json +++ b/packages/config/config/deviceClasses.json @@ -11,7 +11,6 @@ "generic": { "0x01": { "label": "Remote Controller", - "controlledCCs": ["Basic"], "maySupportBasicCC": false, "specific": { "0x01": { @@ -19,23 +18,10 @@ "zwavePlusDeviceType": "Remote Control - Multipurpose" }, "0x02": { - "label": "Portable Scene Controller", - "supportedCCs": ["Association", "Scene Controller Configuration", "Manufacturer Specific"], - "controlledCCs": ["Scene Activation"] + "label": "Portable Scene Controller" }, "0x03": { - "label": "Portable Installer Tool", - "supportedCCs": ["Controller Replication", "Multi Command", "Manufacturer Specific", "Version"], - "controlledCCs": [ - "Association", - "Configuration", - "Controller Replication", - "Multi Channel", - "Multi Channel Association", - "Manufacturer Specific", - "Version", - "Wake Up" - ] + "label": "Portable Installer Tool" }, "0x04": { "label": "AV Remote Control", @@ -50,180 +36,61 @@ "0x02": { "label": "Static Controller", "zwavePlusDeviceType": "Gateway", - "controlledCCs": ["Basic"], "specific": { "0x01": { "label": "PC Controller", "zwavePlusDeviceType": "Central Controller" }, "0x02": { - "label": "Scene Controller", - "supportedCCs": ["Association", "Basic", "Manufacturer Specific", "Scene Controller Configuration"], - "controlledCCs": ["Scene Activation"] + "label": "Scene Controller" }, "0x03": { - "label": "Static Installer Tool", - "supportedCCs": ["Controller Replication", "Multi Command", "Manufacturer Specific", "Version"], - "controlledCCs": [ - "Association", - "Configuration", - "Controller Replication", - "Multi Channel", - "Multi Channel Association", - "Manufacturer Specific", - "Version", - "Wake Up" - ] + "label": "Static Installer Tool" }, "0x04": { "label": "Set Top Box", - "zwavePlusDeviceType": "Set Top Box", - "supportedCCs": [ - "Association", // V2+ - "Association Group Information", - // "CRC-16 Encapsulation", (trust the NIF! Assuming support would break communication) - // "Device Reset Locally", (we can't know if the device can be reset) - "Inclusion Controller", - "Powerlevel", - "Manufacturer Specific", - // "Security", (some devices only support S2) - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - "Simple AV Control", - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ], - "controlledCCs": [ - "Anti-Theft Unlock", // V1 - "Association", // V2+ - "Basic", - // "CRC-16 Encapsulation", (trust the NIF! Assuming support would break communication) - "Multi Channel", // V4+ - "Multi Channel Association", // V3+ - // "Security", (some devices only support S2) - // "Security 2", (older devices don't always support S2) - "Wake Up" // V2+ - ] + "zwavePlusDeviceType": "Set Top Box" }, "0x05": { "label": "Sub System Controller", - "zwavePlusDeviceType": "Sub System Controller", - "supportedCCs": [ - "Association", // V2+ - "Association Group Information", - // "CRC-16 Encapsulation", (trust the NIF! Assuming support would break communication) - // "Device Reset Locally", (we can't know if the device can be reset) - "Inclusion Controller", - "Manufacturer Specific", - "Powerlevel", - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ], - "controlledCCs": [ - "Basic", - // "CRC-16 Encapsulation", (trust the NIF! Assuming support would break communication) - "Multi Channel", // V4+ - "Wake Up" // V2+ - ] + "zwavePlusDeviceType": "Sub System Controller" }, "0x06": { "label": "TV", - "zwavePlusDeviceType": "TV", - "supportedCCs": [ - "Association", // V2+ - "Association Group Information", - // "CRC-16 Encapsulation", (trust the NIF! Assuming support would break communication) - // "Device Reset Locally", (we can't know if the device can be reset) - "Inclusion Controller", - "Manufacturer Specific", - "Powerlevel", - // "Security", (some devices only support S2) - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - "Simple AV Control", - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ], - "controlledCCs": [ - "Anti-Theft Unlock", - "Association", // V2+ - "Association Group Information", - "Basic", - // "CRC-16 Encapsulation", (trust the NIF! Assuming support would break communication) - "Multi Channel", // V4+ - "Multi Channel Association", // V3+ - // "Security", (some devices only support S2) - // "Security 2", (older devices don't always support S2) - "Wake Up" // V2+ - ] + "zwavePlusDeviceType": "TV" }, "0x07": { "label": "Gateway", "zwavePlusDeviceType": "Gateway", - "maySupportBasicCC": false, - "supportedCCs": [ - "Manufacturer Specific", - // "Security", (some devices only support S2) - "Version" - ], - "controlledCCs": [ - // "Security", (some devices only support S2) - "Multi Channel" - ] + "maySupportBasicCC": false } } }, "0x03": { "label": "AV Control Point", "zwavePlusDeviceType": "AV Control Point", - "supportedCCs": ["Basic"], "specific": { "0x01": { "label": "Sound Switch", - "zwavePlusDeviceType": "Sound Switch", - "supportedCCs": [ - "Association", // V2+ - "Association Group Information", - "Basic", - "Battery", - "Sound Switch", - // "Device Reset Locally", (we can't know if the device can be reset) - "Manufacturer Specific", - "Powerlevel", - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "zwavePlusDeviceType": "Sound Switch" }, "0x04": { - "label": "Satellite Receiver", - "supportedCCs": ["Simple AV Control", "Manufacturer Specific", "Version"] + "label": "Satellite Receiver" }, "0x11": { - "label": "Satellite Receiver V2", - "supportedCCs": ["Simple AV Control", "Manufacturer Specific", "Version"] + "label": "Satellite Receiver V2" }, "0x12": { - "label": "Doorbell", - "supportedCCs": ["Binary Sensor", "Association", "Manufacturer Specific", "Version"] + "label": "Doorbell" } } }, "0x04": { "label": "Display", - "supportedCCs": ["Basic"], "specific": { "0x01": { "label": "Simple Display", - "zwavePlusDeviceType": "Display - Simple", - "supportedCCs": ["Screen Attributes", "Screen Meta Data", "Manufacturer Specific", "Version"] + "zwavePlusDeviceType": "Display - Simple" } } }, @@ -266,52 +133,21 @@ "label": "Heating Thermostat" }, "0x02": { - "label": "General Thermostat", - "supportedCCs": ["Manufacturer Specific", "Thermostat Mode", "Thermostat Setpoint"] + "label": "General Thermostat" }, "0x03": { - "label": "Setback Schedule Thermostat", - "supportedCCs": [ - "Climate Control Schedule", - "Manufacturer Specific", - "Multi Command", - "Version" - // TODO: If battery-powered: Basic, Wake Up - ], - "controlledCCs": ["Climate Control Schedule", "Multi Command", "Clock"] + "label": "Setback Schedule Thermostat" }, "0x04": { - "label": "Setpoint Thermostat", - "supportedCCs": [ - "Manufacturer Specific", - "Multi Command", - "Thermostat Setpoint", - "Version" - // TODO: If battery-powered: Basic, Wake Up V2 - ] + "label": "Setpoint Thermostat" }, "0x05": { "label": "Setback Thermostat", - "zwavePlusDeviceType": "Thermostat - Setback", - "supportedCCs": [ - "Manufacturer Specific", - "Thermostat Mode", - "Thermostat Setpoint", - "Thermostat Setback", - "Version" - // TODO: If battery-powered: Basic, Wake Up V2, Multi Command - ] + "zwavePlusDeviceType": "Thermostat - Setback" }, "0x06": { "label": "General Thermostat V2", - "zwavePlusDeviceType": "Thermostat - HVAC", - "supportedCCs": [ - "Basic", - "Manufacturer Specific", - "Thermostat Mode", - "Thermostat Setpoint", - "Version" - ] + "zwavePlusDeviceType": "Thermostat - HVAC" } } }, @@ -319,14 +155,12 @@ "label": "Window Covering", "specific": { "0x01": { - "label": "Simple Window Covering Control", - "supportedCCs": ["Basic Window Covering"] + "label": "Simple Window Covering Control" } } }, "0x0f": { "label": "Repeater Slave", - "supportedCCs": ["Basic"], "specific": { "0x01": { "label": "Repeater Slave", @@ -336,262 +170,102 @@ "0x03": { "label": "IR Repeater", "zwavePlusDeviceType": "IR Repeater", - "maySupportBasicCC": false, - "supportedCCs": [ - "Association", // V2+ - "Association Group Information", - // "Device Reset Locally", (we can't know if the device can be reset) - "IR Repeater", - "Manufacturer Specific", - "Powerlevel", - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "maySupportBasicCC": false } } }, "0x10": { "label": "Binary Switch", - "supportedCCs": ["Basic", "Binary Switch"], "specific": { "0x01": { "label": "Binary Power Switch", - "zwavePlusDeviceType": "On/Off Power Switch", - "supportedCCs": ["All Switch"] + "zwavePlusDeviceType": "On/Off Power Switch" }, "0x02": { "label": "Tunable Color Switch", - "zwavePlusDeviceType": "Color Switch", - "supportedCCs": [ - "Association", // V2+ - "Association Group Information", - "Basic", - "Binary Switch", - "Color Switch", - // "Device Reset Locally", (we can't know if the device can be reset) - "Manufacturer Specific", - "Powerlevel", - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "zwavePlusDeviceType": "Color Switch" }, "0x03": { - "label": "Binary Scene Switch", - "supportedCCs": [ - "All Switch", - "Manufacturer Specific", - "Scene Activation", - "Scene Actuator Configuration" - ] + "label": "Binary Scene Switch" }, "0x04": { "label": "Power Strip Switch", - "zwavePlusDeviceType": "Power Strip", - "supportedCCs": [ - "Association", // V2+ - "Association Group Information", - "Basic", - "Binary Switch", - // "Device Reset Locally", (we can't know if the device can be reset) - "Manufacturer Specific", - "Multi Channel", // V4+ - "Multi Channel Association", // V3+ - "Powerlevel", - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "zwavePlusDeviceType": "Power Strip" }, "0x05": { "label": "Siren", - "zwavePlusDeviceType": "Siren", - "supportedCCs": [ - "Association", // V2+ - "Association Group Information", - "Basic", - "Battery", - "Binary Switch", - // "Device Reset Locally", (we can't know if the device can be reset) - "Manufacturer Specific", - "Powerlevel", - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "zwavePlusDeviceType": "Siren" }, "0x06": { "label": "Valve", - "zwavePlusDeviceType": "Valve (open/close)", - "supportedCCs": [ - "Association", // V2+ - "Association Group Information", - "Basic", - "Battery", - "Binary Switch", - // "Device Reset Locally", (we can't know if the device can be reset) - "Manufacturer Specific", - "Powerlevel", - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "zwavePlusDeviceType": "Valve (open/close)" }, "0x07": { "label": "Irrigation Control", - "zwavePlusDeviceType": "Irrigation Control", - "supportedCCs": [ - "Association", // V2+ - "Association Group Information", - "Basic", - "Binary Switch", - // "Device Reset Locally", (we can't know if the device can be reset) - "Manufacturer Specific", - "Powerlevel", - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "zwavePlusDeviceType": "Irrigation Control" } } }, "0x11": { "label": "Multilevel Switch", - "supportedCCs": ["Basic", "Multilevel Switch"], "specific": { "0x01": { "label": "Multilevel Power Switch", - "zwavePlusDeviceType": "Light Dimmer Switch", - "supportedCCs": ["All Switch"] + "zwavePlusDeviceType": "Light Dimmer Switch" }, "0x02": { "label": "Tunable Color Switch", - "zwavePlusDeviceType": "Color Switch", - "supportedCCs": [ - "Association", // V2+ - "Association Group Information", - "Basic", - "Color Switch", - // "Device Reset Locally", (we can't know if the device can be reset) - "Manufacturer Specific", - "Multilevel Switch", - "Powerlevel", - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "zwavePlusDeviceType": "Color Switch" }, "0x03": { - "label": "Multiposition Motor", - "supportedCCs": ["Manufacturer Specific", "Version"] + "label": "Multiposition Motor" }, "0x04": { - "label": "Multilevel Scene Switch", - "supportedCCs": [ - "All Switch", - "Scene Activation", - "Scene Actuator Configuration", - "Manufacturer Specific" - ] + "label": "Multilevel Scene Switch" }, "0x05": { "label": "Motor Control Class A", - "zwavePlusDeviceType": "Window Covering - No Position/Endpoint", - "supportedCCs": [ - "Binary Switch", - "Multilevel Switch", // V3 - "Manufacturer Specific", - "Version" - ] + "zwavePlusDeviceType": "Window Covering - No Position/Endpoint" }, "0x06": { "label": "Motor Control Class B", - "zwavePlusDeviceType": "Window Covering - Endpoint Aware", - "supportedCCs": [ - "Binary Switch", - "Multilevel Switch", // V3 - "Manufacturer Specific", - "Version" - ] + "zwavePlusDeviceType": "Window Covering - Endpoint Aware" }, "0x07": { "label": "Motor Control Class C", - "zwavePlusDeviceType": "Window Covering - Position/Endpoint Aware", - "supportedCCs": [ - "Binary Switch", - "Multilevel Switch", // V3 - "Manufacturer Specific", - "Version" - ] + "zwavePlusDeviceType": "Window Covering - Position/Endpoint Aware" }, "0x08": { "label": "Fan Switch", - "zwavePlusDeviceType": "Fan Switch", - "supportedCCs": [ - "Association", // V2+ - "Association Group Information", - "Basic", - // "Device Reset Locally", (we can't know if the device can be reset) - "Manufacturer Specific", - "Multilevel Switch", - "Powerlevel", - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "zwavePlusDeviceType": "Fan Switch" } } }, "0x12": { "label": "Remote Switch", - "controlledCCs": ["Basic"], "specific": { "0x01": { - "label": "Binary Remote Switch", - "controlledCCs": ["Binary Switch"] + "label": "Binary Remote Switch" }, "0x02": { - "label": "Multilevel Remote Switch", - "controlledCCs": ["Multilevel Switch"] + "label": "Multilevel Remote Switch" }, "0x03": { - "label": "Binary Toggle Remote Switch", - "controlledCCs": ["Binary Toggle Switch"] + "label": "Binary Toggle Remote Switch" }, "0x04": { - "label": "Multilevel Toggle Remote Switch", - "controlledCCs": ["Multilevel Toggle Switch"] + "label": "Multilevel Toggle Remote Switch" } } }, "0x13": { "label": "Toggle Switch", - "supportedCCs": ["Basic"], "specific": { "0x01": { - "label": "Binary Toggle Switch", - "supportedCCs": ["Binary Switch", "Binary Toggle Switch"] + "label": "Binary Toggle Switch" }, "0x02": { - "label": "Multilevel Toggle Switch", - "supportedCCs": ["Multilevel Switch", "Multilevel Toggle Switch"] + "label": "Multilevel Toggle Switch" } } }, @@ -608,11 +282,9 @@ }, "0x16": { "label": "Ventilation", - "supportedCCs": ["Basic"], "specific": { "0x01": { - "label": "Residential Heat Recovery Ventilation", - "supportedCCs": ["HRV Control", "HRV Status", "Manufacturer Specific", "Version"] + "label": "Residential Heat Recovery Ventilation" } } }, @@ -636,7 +308,6 @@ }, "0x20": { "label": "Binary Sensor", - "supportedCCs": ["Basic", "Binary Sensor"], "specific": { "0x01": { "label": "Routing Binary Sensor" @@ -645,7 +316,6 @@ }, "0x21": { "label": "Multilevel Sensor", - "supportedCCs": ["Basic", "Multilevel Sensor"], "specific": { "0x01": { "label": "Routing Multilevel Sensor", @@ -655,8 +325,7 @@ } }, "0x30": { - "label": "Pulse Meter", - "supportedCCs": ["Basic", "Pulse Meter"] + "label": "Pulse Meter" }, "0x31": { "label": "Meter", @@ -664,37 +333,14 @@ "specific": { "0x01": { "label": "Simple Meter", - "zwavePlusDeviceType": "Sub Energy Meter", - "supportedCCs": ["Meter", "Manufacturer Specific", "Version"] + "zwavePlusDeviceType": "Sub Energy Meter" }, "0x02": { - "label": "Advanced Energy Control", - "supportedCCs": [ - "Meter Table Monitor", - "Meter Table Configuration", - "Manufacturer Specific", - "Version" - ] + "label": "Advanced Energy Control" }, "0x03": { "label": "Simple Whole Home Meter", - "zwavePlusDeviceType": "Whole Home Meter - Simple", - "supportedCCs": [ - "Association", // V2+ - "Association Group Information", - "Battery", - // "CRC-16 Encapsulation", (trust the NIF! Assuming support would break communication) - // "Device Reset Locally", (we can't know if the device can be reset) - "Manufacturer Specific", - "Meter", // V2+ - "Powerlevel", - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Wake Up", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "zwavePlusDeviceType": "Whole Home Meter - Simple" } } }, @@ -702,228 +348,94 @@ "label": "Entry Control", "specific": { "0x01": { - "label": "Door Lock", - "supportedCCs": ["Basic", "Lock"] + "label": "Door Lock" }, "0x02": { - "label": "Advanced Door Lock", - "supportedCCs": ["Basic", "Door Lock", "Manufacturer Specific", "Version"] + "label": "Advanced Door Lock" }, "0x03": { "label": "Secure Keypad Door Lock", "zwavePlusDeviceType": "Door Lock - Keypad", - "requiresSecurity": true, - "supportedCCs": [ - "Basic", - "Door Lock", - "User Code", - "Manufacturer Specific", - // "Security", (some devices only support S2) - "Version" - ] + "requiresSecurity": true }, "0x05": { "label": "Secure Door", "zwavePlusDeviceType": "Motorized Barrier - GDO", - "requiresSecurity": true, - "supportedCCs": [ - "Application Status", - "Association", // V2+ - "Association Group Information", - "Barrier Operator", - "Battery", - // "Device Reset Locally", (we can't know if the device can be reset) - "Manufacturer Specific", - "Notification", // V4+ - "Powerlevel", - // "Security", (some devices only support S2) - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "requiresSecurity": true }, "0x06": { "label": "Secure Gate", "zwavePlusDeviceType": "Motorized Barrier - Gate", - "requiresSecurity": true, - "supportedCCs": [ - "Application Status", - "Association", // V2+ - "Association Group Information", - "Barrier Operator", - "Battery", - // "Device Reset Locally", (we can't know if the device can be reset) - "Manufacturer Specific", - "Notification", // V4+ - "Powerlevel", - // "Security", (some devices only support S2) - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "requiresSecurity": true }, "0x07": { "label": "Secure Barrier Add-on", "zwavePlusDeviceType": "Motorized Barrier - Add-on", - "requiresSecurity": true, - "supportedCCs": [ - "Application Status", - "Association", // V2+ - "Association Group Information", - "Barrier Operator", - "Battery", - // "Device Reset Locally", (we can't know if the device can be reset) - "Manufacturer Specific", - "Notification", // V4+ - "Powerlevel", - // "Security", (some devices only support S2) - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "requiresSecurity": true }, "0x08": { "label": "Secure Barrier Open only", "zwavePlusDeviceType": "Motorized Barrier - Open only", - "requiresSecurity": true, - "supportedCCs": [ - "Application Status", - "Association", // V2+ - "Association Group Information", - "Barrier Operator", - "Battery", - // "Device Reset Locally", (we can't know if the device can be reset) - "Manufacturer Specific", - "Notification", // V4+ - "Powerlevel", - // "Security", (some devices only support S2) - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "requiresSecurity": true }, "0x09": { "label": "Secure Barrier Close only", "zwavePlusDeviceType": "Motorized Barrier - Close only", - "requiresSecurity": true, - "supportedCCs": [ - "Application Status", - "Association", // V2+ - "Association Group Information", - "Barrier Operator", - "Battery", - // "Device Reset Locally", (we can't know if the device can be reset) - "Manufacturer Specific", - "Notification", // V4+ - "Powerlevel", - // "Security", (some devices only support S2) - // "Security 2", (older devices don't always support S2) - // "Supervision", (trust the NIF! Assuming support would break communication) - // "Transport Service", // V2+ (trust the NIF! Assuming support would break communication) - "Version", // V2+ - "Z-Wave Plus Info" // V2+ - ] + "requiresSecurity": true }, "0x0a": { "label": "Lockbox", "zwavePlusDeviceType": "Lockbox", - "requiresSecurity": true, - "supportedCCs": [ - // MUST NOT support Basic - "Notification", - "Association", - "Door Lock", - "Manufacturer Specific", - // "Security", (some devices only support S2) - "Version" - ] + "requiresSecurity": true }, "0x0b": { "label": "Secure Keypad", "zwavePlusDeviceType": "Entry Control Keypad", "requiresSecurity": true, - "maySupportBasicCC": false, - "supportedCCs": [ - // "Device Reset Locally", (we can't know if the device can be reset) - "Entry Control", - "Manufacturer Specific", - // "Security", (some devices only support S2) - "Version" - ] + "maySupportBasicCC": false } } }, "0x50": { "label": "Semi-Interoperable", - "supportedCCs": ["Basic", "Manufacturer Specific", "Version", "Proprietary"], "specific": { "0x01": { - "label": "Energy Production", - "supportedCCs": ["Energy Production"] + "label": "Energy Production" } } }, "0xa1": { "label": "Alarm Sensor", - "supportedCCs": ["Basic"], "specific": { "0x01": { - "label": "Basic Routing Alarm Sensor", - "supportedCCs": ["Alarm Sensor", "Association", "Manufacturer Specific", "Version"], - "controlledCCs": ["Alarm Sensor"] + "label": "Basic Routing Alarm Sensor" }, "0x02": { - "label": "Routing Alarm Sensor", - "supportedCCs": ["Alarm Sensor", "Association", "Battery", "Manufacturer Specific", "Version"], - "controlledCCs": ["Alarm Sensor"] + "label": "Routing Alarm Sensor" }, "0x03": { - "label": "Basic Zensor Net Alarm Sensor", - "supportedCCs": ["Alarm Sensor", "Manufacturer Specific", "Version"], - "controlledCCs": ["Alarm Sensor"] + "label": "Basic Zensor Net Alarm Sensor" }, "0x04": { - "label": "Zensor Net Alarm Sensor", - "supportedCCs": ["Alarm Sensor", "Battery", "Manufacturer Specific", "Version"], - "controlledCCs": ["Alarm Sensor"] + "label": "Zensor Net Alarm Sensor" }, "0x05": { - "label": "Advanced Zensor Net Alarm Sensor", - "supportedCCs": ["Alarm Sensor", "Association", "Battery", "Manufacturer Specific", "Version"], - "controlledCCs": ["Alarm Sensor"] + "label": "Advanced Zensor Net Alarm Sensor" }, "0x06": { - "label": "Basic Routing Smoke Sensor", - "supportedCCs": ["Alarm Sensor", "Association", "Manufacturer Specific", "Version"], - "controlledCCs": ["Alarm Sensor"] + "label": "Basic Routing Smoke Sensor" }, "0x07": { - "label": "Routing Smoke Sensor", - "supportedCCs": ["Alarm Sensor", "Association", "Battery", "Manufacturer Specific", "Version"], - "controlledCCs": ["Alarm Sensor"] + "label": "Routing Smoke Sensor" }, "0x08": { - "label": "Basic Zensor Net Smoke Sensor", - "supportedCCs": ["Alarm Sensor", "Manufacturer Specific", "Version"], - "controlledCCs": ["Alarm Sensor"] + "label": "Basic Zensor Net Smoke Sensor" }, "0x09": { - "label": "Zensor Net Smoke Sensor", - "supportedCCs": ["Alarm Sensor", "Battery", "Manufacturer Specific", "Version"], - "controlledCCs": ["Alarm Sensor"] + "label": "Zensor Net Smoke Sensor" }, "0x0a": { - "label": "Advanced Zensor Net Smoke Sensor", - "supportedCCs": ["Alarm Sensor", "Association", "Battery", "Manufacturer Specific", "Version"], - "controlledCCs": ["Alarm Sensor"] + "label": "Advanced Zensor Net Smoke Sensor" } } }, diff --git a/packages/config/config/devices/0x000c/hs-wd100.json b/packages/config/config/devices/0x000c/hs-wd100.json index d9da46b3bd23..87712e577d6d 100644 --- a/packages/config/config/devices/0x000c/hs-wd100.json +++ b/packages/config/config/devices/0x000c/hs-wd100.json @@ -44,16 +44,6 @@ "label": "Local Dimming Step Duration" } ], - "compat": { - "commandClasses": { - "remove": { - "Supervision": { - // The device does not support supervision although it is mandatory for the device type - "endpoints": "*" - } - } - } - }, "metadata": { "inclusion": "1. Turn the connected lights ON/OFF by tapping the switch. Tapping and releasing the upper part of the rocker turns the appliance ON. Tapping and releasing the lower part of the rocker turns the appliance OFF.\n2. Add(Include) the module to/from your Z-Wave network with your primary controller. Please refer to the instructions manual of your gateway or remote controller for details and procedures on how these actions can be done. \n3. Normally, the sequence is as follows: when the inclusion process is prompted by your primary controller, single click and release the rocker switch to ON or OFF position. The controller should show that the action was successful. If the controller shows it was a fail, repeat the procedure", "exclusion": "1. Turn the connected appliance ON/OFF by tapping the switch. Tapping and releasing the upper part of the rocker turns the appliance ON. Tapping and releasing the lower part of the rocker turns the appliance OFF.\n2. Delete(Exclude) the module to/from your Z-Wave network with your primary controller. Please refer to the instructions manual of your gateway or remote controller for details and procedures on how these actions can be done. \n3. Normally, the sequence is as follows: when the exclusion process is prompted by your primary controller, single click and release the rocker switch. The controller should show that the action was successful. If the controller shows it was a fail, repeat the procedure", diff --git a/packages/config/config/devices/0x0039/39358_39465_zw4002.json b/packages/config/config/devices/0x0039/39358_39465_zw4002.json index d79457f42b4c..5f200f7416ff 100644 --- a/packages/config/config/devices/0x0039/39358_39465_zw4002.json +++ b/packages/config/config/devices/0x0039/39358_39465_zw4002.json @@ -50,15 +50,7 @@ } ], "compat": { - "mapBasicSet": "event", - "commandClasses": { - "remove": { - "Supervision": { - // The device does not support supervision although it is mandatory for the device type - "endpoints": "*" - } - } - } + "mapBasicSet": "event" }, "metadata": { "inclusion": "1. Follow the instructions for your Z-Wave certified controller to include a device to the Z-Wave network.\n2. Once the controller is ready to include your device, press and release the top or bottom of the smart fan control switch (rocker) to include it in the network.\n3. Once your controller has confirmed the device has been included, refresh the Z-Wave network to optimize performance", diff --git a/packages/config/config/devices/0x0063/10974_zw4002.json b/packages/config/config/devices/0x0063/10974_zw4002.json index ca25cf9df8c0..b3adcc8809f7 100644 --- a/packages/config/config/devices/0x0063/10974_zw4002.json +++ b/packages/config/config/devices/0x0063/10974_zw4002.json @@ -13,15 +13,5 @@ "firmwareVersion": { "min": "0.0", "max": "255.255" - }, - "compat": { - "commandClasses": { - "remove": { - "Supervision": { - // The device does not support supervision although it is mandatory for the device type - "endpoints": "*" - } - } - } } } diff --git a/packages/config/config/devices/0x0063/12730_zw4002.json b/packages/config/config/devices/0x0063/12730_zw4002.json index 5b9e5e94d05a..7a18cbb72c33 100644 --- a/packages/config/config/devices/0x0063/12730_zw4002.json +++ b/packages/config/config/devices/0x0063/12730_zw4002.json @@ -40,14 +40,6 @@ } ], "compat": { - "mapBasicSet": "event", - "commandClasses": { - "remove": { - "Supervision": { - // The device does not support supervision although it is mandatory for the device type - "endpoints": "*" - } - } - } + "mapBasicSet": "event" } } diff --git a/packages/config/config/devices/0x0063/14287_zw4002.json b/packages/config/config/devices/0x0063/14287_zw4002.json index 5ac734fa3971..947fb2b7ae18 100644 --- a/packages/config/config/devices/0x0063/14287_zw4002.json +++ b/packages/config/config/devices/0x0063/14287_zw4002.json @@ -42,15 +42,7 @@ } ], "compat": { - "mapBasicSet": "event", - "commandClasses": { - "remove": { - "Supervision": { - // The device does not support supervision although it is mandatory for the device type - "endpoints": "*" - } - } - } + "mapBasicSet": "event" }, "metadata": { "inclusion": "1. Follow the instructions for your Z-Wave certified controller to include a device to the Z-Wave network.\n2. Once the controller is ready to include your device, press and release the top or bottom of the smart fan control switch (rocker) to include it in the network.\n3. Once your controller has confirmed the device has been included, refresh the Z-Wave network to optimize performance", diff --git a/packages/config/config/devices/0x0063/14314_zw4002.json b/packages/config/config/devices/0x0063/14314_zw4002.json index 8e2c33e1cd40..dd4e802c5975 100644 --- a/packages/config/config/devices/0x0063/14314_zw4002.json +++ b/packages/config/config/devices/0x0063/14314_zw4002.json @@ -37,15 +37,7 @@ } ], "compat": { - "mapBasicSet": "event", - "commandClasses": { - "remove": { - "Supervision": { - // The device does not support supervision although it is mandatory for the device type - "endpoints": "*" - } - } - } + "mapBasicSet": "event" }, "metadata": { "inclusion": "Linking your device\n1. Follow the instructions for your Z-wave certified controller to include a device to\nthe Z-wave network.\n2. Once the controller is ready to include your device, press and release the top or\nbottom of the wireless smart switch(rocker) to include it in the network.\nNote: Your controller may need to be within 10 feet of the device to be included.\n3. Once your controller has confirmed that the device has been included, refresh the\nZ-wave network to optimize performance.\nPlease reference the controller’s manual for instructions", diff --git a/packages/config/config/devices/0x0063/45743_zw4002.json b/packages/config/config/devices/0x0063/45743_zw4002.json index 83ae7e6d43d9..729646ad4c8f 100644 --- a/packages/config/config/devices/0x0063/45743_zw4002.json +++ b/packages/config/config/devices/0x0063/45743_zw4002.json @@ -37,15 +37,7 @@ } ], "compat": { - "mapBasicSet": "event", - "commandClasses": { - "remove": { - "Supervision": { - // The device does not support supervision although it is mandatory for the device type - "endpoints": "*" - } - } - } + "mapBasicSet": "event" }, "metadata": { "inclusion": "1. Follow the instructions for your Z-Wave certified controller to include a device to the Z-Wave network.\n2. Once the controller is ready to include your device, press and release the top or bottom of the smart fan control switch (rocker) to include it in the network.\n3. Once your controller has confirmed the device has been included, refresh the Z-Wave network to optimize performance", diff --git a/packages/config/config/devices/0x0063/55258_zw4002.json b/packages/config/config/devices/0x0063/55258_zw4002.json index 2c5c6b588ad8..8adbeb308396 100644 --- a/packages/config/config/devices/0x0063/55258_zw4002.json +++ b/packages/config/config/devices/0x0063/55258_zw4002.json @@ -37,15 +37,7 @@ } ], "compat": { - "mapBasicSet": "event", - "commandClasses": { - "remove": { - "Supervision": { - // The device does not support supervision although it is mandatory for the device type - "endpoints": "*" - } - } - } + "mapBasicSet": "event" }, "metadata": { "inclusion": "1. Follow the instructions for your Z-Wave certified controller to add a device to the Z-Wave network.\n2. Once the controller is ready to add your device, press and release the top or bottom rocker", diff --git a/packages/config/config/devices/0x0063/55259_zw4002.json b/packages/config/config/devices/0x0063/55259_zw4002.json index 897e1fee3f16..370bebd01fe0 100644 --- a/packages/config/config/devices/0x0063/55259_zw4002.json +++ b/packages/config/config/devices/0x0063/55259_zw4002.json @@ -37,15 +37,7 @@ } ], "compat": { - "mapBasicSet": "event", - "commandClasses": { - "remove": { - "Supervision": { - // The device does not support supervision although it is mandatory for the device type - "endpoints": "*" - } - } - } + "mapBasicSet": "event" }, "metadata": { "inclusion": "1. Follow the instructions for your Z-Wave certified controller to add a device to the Z-Wave network.\n2. Once the controller is ready to add your device, press and release the top or bottom rocker", diff --git a/packages/config/config/devices/0x0184/wd-100.json b/packages/config/config/devices/0x0184/wd-100.json index 89d7c353429b..ff23688d0665 100644 --- a/packages/config/config/devices/0x0184/wd-100.json +++ b/packages/config/config/devices/0x0184/wd-100.json @@ -40,16 +40,6 @@ "label": "Local Dimming Step Duration" } ], - "compat": { - "commandClasses": { - "remove": { - "Supervision": { - // The device does not support supervision although it is mandatory for the device type - "endpoints": "*" - } - } - } - }, "metadata": { "inclusion": "1. Turn the connected lights ON/OFF by tapping the switch. Tapping and releasing the upper part of the rocker turns the appliance ON. Tapping and releasing the lower part of the rocker turns the appliance OFF.\n2. Add(Include) the module to/from your Z-Wave network with your primary controller. Please refer to the instructions manual of your gateway or remote controller for details and procedures on how these actions can be done. \n3. Normally, the sequence is as follows: when the inclusion process is prompted by your primary controller, single click and release the rocker switch to ON or OFF position. The controller should show that the action was successful. If the controller shows it was a fail, repeat the procedure", "exclusion": "1. Turn the connected appliance ON/OFF by tapping the switch. Tapping and releasing the upper part of the rocker turns the appliance ON. Tapping and releasing the lower part of the rocker turns the appliance OFF.\n2. Delete(Exclude) the module to/from your Z-Wave network with your primary controller. Please refer to the instructions manual of your gateway or remote controller for details and procedures on how these actions can be done. \n3. Normally, the sequence is as follows: when the exclusion process is prompted by your primary controller, single click and release the rocker switch. The controller should show that the action was successful. If the controller shows it was a fail, repeat the procedure", diff --git a/packages/config/config/devices/0x0267/1000x080-xxx-700.json b/packages/config/config/devices/0x0267/1000x080-xxx-700.json index 341ecf27f242..08ad8ff7734a 100644 --- a/packages/config/config/devices/0x0267/1000x080-xxx-700.json +++ b/packages/config/config/devices/0x0267/1000x080-xxx-700.json @@ -190,15 +190,5 @@ } ] } - ], - "compat": { - "commandClasses": { - "remove": { - // The device identifies as Z-Wave+ v2, but does not support the mandatory Supervision CC - "Supervision": { - "endpoints": "*" - } - } - } - } + ] } diff --git a/packages/config/config/devices/0x0315/wd-100.json b/packages/config/config/devices/0x0315/wd-100.json index 37519598cfbb..396e1fa4b25b 100644 --- a/packages/config/config/devices/0x0315/wd-100.json +++ b/packages/config/config/devices/0x0315/wd-100.json @@ -70,15 +70,5 @@ "maxValue": 255, "defaultValue": 3 } - ], - "compat": { - "commandClasses": { - "remove": { - "Supervision": { - // The device does not support supervision although it is mandatory for the device type - "endpoints": "*" - } - } - } - } + ] } diff --git a/packages/config/src/DeviceClasses.ts b/packages/config/src/DeviceClasses.ts index 004324a93970..c1f655782bb9 100644 --- a/packages/config/src/DeviceClasses.ts +++ b/packages/config/src/DeviceClasses.ts @@ -1,7 +1,5 @@ -import { CommandClasses } from "@zwave-js/core/safe"; import { type JSONObject, num2hex } from "@zwave-js/shared/safe"; -import { distinct } from "alcalzone-shared/arrays"; -import { isArray, isObject } from "alcalzone-shared/typeguards"; +import { isObject } from "alcalzone-shared/typeguards"; import { hexKeyRegexNDigits, throwInvalidConfig } from "./utils_safe"; export type BasicDeviceClassMap = ReadonlyMap; @@ -86,72 +84,6 @@ export class GenericDeviceClass { } } - if (definition.supportedCCs != undefined) { - if ( - !isArray(definition.supportedCCs) - || !definition.supportedCCs.every( - (cc: any) => typeof cc === "string", - ) - ) { - throwInvalidConfig( - "device classes", - `supportedCCs in device class ${this.label} (${ - num2hex( - this.key, - ) - }) is not a string array!`, - ); - } - const supportedCCs: CommandClasses[] = []; - for (const ccName of definition.supportedCCs) { - if (!(ccName in CommandClasses)) { - throwInvalidConfig( - "device classes", - `Found unknown CC "${ccName}" in supportedCCs of device class ${this.label} (${ - num2hex(this.key) - })!`, - ); - } - supportedCCs.push((CommandClasses as any)[ccName]); - } - this.supportedCCs = supportedCCs; - } else { - this.supportedCCs = []; - } - - if (definition.controlledCCs != undefined) { - if ( - !isArray(definition.controlledCCs) - || !definition.controlledCCs.every( - (cc: any) => typeof cc === "string", - ) - ) { - throwInvalidConfig( - "device classes", - `controlledCCs in device class ${this.label} (${ - num2hex( - this.key, - ) - }) is not a string array!`, - ); - } - const controlledCCs: CommandClasses[] = []; - for (const ccName of definition.controlledCCs) { - if (!(ccName in CommandClasses)) { - throwInvalidConfig( - "device classes", - `Found unknown CC "${ccName}" in controlledCCs of device class ${this.label} (${ - num2hex(this.key) - })!`, - ); - } - controlledCCs.push((CommandClasses as any)[ccName]); - } - this.controlledCCs = controlledCCs; - } else { - this.controlledCCs = []; - } - if (definition.maySupportBasicCC != undefined) { if (definition.maySupportBasicCC !== false) { throwInvalidConfig( @@ -203,8 +135,6 @@ export class GenericDeviceClass { /** @internal */ public readonly zwavePlusDeviceType?: string; public readonly requiresSecurity?: boolean; - public readonly supportedCCs: readonly CommandClasses[]; - public readonly controlledCCs: readonly CommandClasses[]; public readonly maySupportBasicCC: boolean; public readonly specific: ReadonlyMap; } @@ -259,76 +189,6 @@ export class SpecificDeviceClass { this.requiresSecurity = generic.requiresSecurity; } - if (definition.supportedCCs != undefined) { - if ( - !isArray(definition.supportedCCs) - || !definition.supportedCCs.every( - (cc: any) => typeof cc === "string", - ) - ) { - throwInvalidConfig( - "device classes", - `supportedCCs in device class ${generic.label} -> ${this.label} (${ - num2hex(this.key) - }) is not a string array!`, - ); - } - const supportedCCs: CommandClasses[] = []; - for (const ccName of definition.supportedCCs) { - if (!(ccName in CommandClasses)) { - throwInvalidConfig( - "device classes", - `Found unknown CC "${ccName}" in supportedCCs of device class ${generic.label} -> ${this.label} (${ - num2hex(this.key) - })!`, - ); - } - supportedCCs.push((CommandClasses as any)[ccName]); - } - this.supportedCCs = supportedCCs; - } else { - this.supportedCCs = []; - } - this.supportedCCs = distinct([ - ...generic.supportedCCs, - ...this.supportedCCs, - ]); - - if (definition.controlledCCs != undefined) { - if ( - !isArray(definition.controlledCCs) - || !definition.controlledCCs.every( - (cc: any) => typeof cc === "string", - ) - ) { - throwInvalidConfig( - "device classes", - `controlledCCs in device class ${generic.label} -> ${this.label} (${ - num2hex(this.key) - }) is not a string array!`, - ); - } - const controlledCCs: CommandClasses[] = []; - for (const ccName of definition.controlledCCs) { - if (!(ccName in CommandClasses)) { - throwInvalidConfig( - "device classes", - `Found unknown CC "${ccName}" in controlledCCs of device class ${generic.label} -> ${this.label} (${ - num2hex(this.key) - })!`, - ); - } - controlledCCs.push((CommandClasses as any)[ccName]); - } - this.controlledCCs = controlledCCs; - } else { - this.controlledCCs = []; - } - this.controlledCCs = distinct([ - ...generic.controlledCCs, - ...this.controlledCCs, - ]); - if (definition.maySupportBasicCC != undefined) { if (definition.maySupportBasicCC !== false) { throwInvalidConfig( @@ -349,7 +209,5 @@ export class SpecificDeviceClass { public readonly label: string; public readonly zwavePlusDeviceType?: string; public readonly requiresSecurity?: boolean; - public readonly supportedCCs: readonly CommandClasses[]; - public readonly controlledCCs: readonly CommandClasses[]; public readonly maySupportBasicCC: boolean; } diff --git a/packages/zwave-js/src/lib/controller/Controller.ts b/packages/zwave-js/src/lib/controller/Controller.ts index 573d1d9bf08f..762a9a47f898 100644 --- a/packages/zwave-js/src/lib/controller/Controller.ts +++ b/packages/zwave-js/src/lib/controller/Controller.ts @@ -2576,13 +2576,13 @@ supported CCs: ${ newNode.updateNodeInfo(requestedNodeInfo); // TODO: Check if this stuff works for a normal replace too - const deviceClass = new DeviceClass( + // eslint-disable-next-line @typescript-eslint/dot-notation + newNode["deviceClass"] = new DeviceClass( this.driver.configManager, requestedNodeInfo.basicDeviceClass, requestedNodeInfo.genericDeviceClass, requestedNodeInfo.specificDeviceClass, ); - newNode["applyDeviceClass"](deviceClass); } // Perform S0/S2 bootstrapping diff --git a/packages/zwave-js/src/lib/node/DeviceClass.ts b/packages/zwave-js/src/lib/node/DeviceClass.ts index 3a6d5c5d06ca..3dae25de39e6 100644 --- a/packages/zwave-js/src/lib/node/DeviceClass.ts +++ b/packages/zwave-js/src/lib/node/DeviceClass.ts @@ -4,7 +4,6 @@ import type { GenericDeviceClass, SpecificDeviceClass, } from "@zwave-js/config"; -import { CommandClasses } from "@zwave-js/core/safe"; import type { JSONObject } from "@zwave-js/shared"; export class DeviceClass { @@ -20,37 +19,17 @@ export class DeviceClass { generic, specific, ); - - // The specific class' CCs include the generic class' CCs - this._mandatorySupportedCCs = this.specific.supportedCCs; - this._mandatoryControlledCCs = this.specific.controlledCCs; } public readonly basic: BasicDeviceClass; public readonly generic: GenericDeviceClass; public readonly specific: SpecificDeviceClass; - private _mandatorySupportedCCs: readonly CommandClasses[]; - public get mandatorySupportedCCs(): readonly CommandClasses[] { - return this._mandatorySupportedCCs; - } - - private _mandatoryControlledCCs: readonly CommandClasses[]; - public get mandatoryControlledCCs(): readonly CommandClasses[] { - return this._mandatoryControlledCCs; - } - public toJSON(): JSONObject { return { basic: this.basic.label, generic: this.generic.label, specific: this.specific.label, - mandatorySupportedCCs: this._mandatorySupportedCCs.map( - (cc) => CommandClasses[cc], - ), - mandatoryControlCCs: this._mandatoryControlledCCs.map( - (cc) => CommandClasses[cc], - ), }; } } diff --git a/packages/zwave-js/src/lib/node/Endpoint.test.ts b/packages/zwave-js/src/lib/node/Endpoint.test.ts index 118e5db43e83..f4b254d04301 100644 --- a/packages/zwave-js/src/lib/node/Endpoint.test.ts +++ b/packages/zwave-js/src/lib/node/Endpoint.test.ts @@ -6,13 +6,11 @@ import { ZWaveErrorCodes, assertZWaveError, } from "@zwave-js/core"; -import type { ThrowingMap } from "@zwave-js/shared"; import { MockController } from "@zwave-js/testing"; import ava, { type TestFn } from "ava"; import { createDefaultMockControllerBehaviors } from "../../Utils"; import type { Driver } from "../driver/Driver"; import { createAndStartTestingDriver } from "../driver/DriverMock"; -import { DeviceClass } from "./DeviceClass"; import { Endpoint } from "./Endpoint"; import { ZWaveNode } from "./Node"; @@ -206,69 +204,3 @@ test.serial( t.is(instance, undefined); }, ); - -test.serial( - "A non-root endpoint with the `Power Strip Switch` device class does not support the Multi Channel CC", - async (t) => { - const { driver } = t.context; - const powerStripSwitch = new DeviceClass( - driver.configManager, - 0x01, - 0x10, - 0x04, - ); - - const node = new ZWaveNode(1, driver, powerStripSwitch); - t.true(node.supportsCC(CommandClasses["Multi Channel"])); - const ep = new Endpoint(1, driver, 1, powerStripSwitch); - t.false(ep.supportsCC(CommandClasses["Multi Channel"])); - }, -); - -test.serial( - "Non-root endpoints should not have the Manufacturer Specific CC (among others) added as mandatory", - async (t) => { - const { driver } = t.context; - const soundSwitch = new DeviceClass( - driver.configManager, - 0x01, - 0x03, - 0x01, - ); - - const node = new ZWaveNode(1, driver, soundSwitch); - (driver.controller.nodes as ThrowingMap).set( - 1, - node, - ); - - t.true(node.supportsCC(CommandClasses["Manufacturer Specific"])); - const ep = new Endpoint(1, driver, 1, soundSwitch); - t.false(ep.supportsCC(CommandClasses["Manufacturer Specific"])); - }, -); - -test.serial( - "Always-listening nodes should not have the Battery CC added as mandatory", - async (t) => { - const { driver } = t.context; - const soundSwitch = new DeviceClass( - driver.configManager, - 0x01, - 0x03, - 0x01, - ); - - const node = new ZWaveNode(1, driver); - (driver.controller.nodes as ThrowingMap).set( - 1, - node, - ); - node["isListening"] = true; - node["applyDeviceClass"](soundSwitch); - - t.false(node.supportsCC(CommandClasses.Battery)); - const ep = new Endpoint(1, driver, 1, soundSwitch); - t.false(ep.supportsCC(CommandClasses.Battery)); - }, -); diff --git a/packages/zwave-js/src/lib/node/Endpoint.ts b/packages/zwave-js/src/lib/node/Endpoint.ts index 6aa3c4d0e5c0..e4a5d148c73b 100644 --- a/packages/zwave-js/src/lib/node/Endpoint.ts +++ b/packages/zwave-js/src/lib/node/Endpoint.ts @@ -59,7 +59,7 @@ export class Endpoint implements IZWaveEndpoint { }, ); - this.applyDeviceClass(deviceClass); + this.deviceClass = deviceClass; // Add optional CCs if (supportedCCs != undefined) { @@ -129,25 +129,6 @@ export class Endpoint implements IZWaveEndpoint { return this._implementedCommandClasses.entries(); } - /** - * Sets the device class of this endpoint and configures the mandatory CCs. - * **Note:** This does nothing if the device class was already configured - */ - protected applyDeviceClass(deviceClass?: DeviceClass): void { - if (this.deviceClass) return; - - this.deviceClass = deviceClass; - // Add mandatory CCs - if (deviceClass) { - for (const cc of deviceClass.mandatorySupportedCCs) { - this.addMandatoryCC(cc, { isSupported: true }); - } - for (const cc of deviceClass.mandatoryControlledCCs) { - this.addMandatoryCC(cc, { isControlled: true }); - } - } - } - /** * Adds a CC to the list of command classes implemented by the endpoint or updates the information. * You shouldn't need to call this yourself. @@ -173,39 +154,6 @@ export class Endpoint implements IZWaveEndpoint { } } - /** - * Adds a mandatory CC to the list of command classes implemented by the endpoint or updates the information. - * Performs some sanity checks before adding so the behavior is in compliance with the specifications - */ - protected addMandatoryCC( - cc: CommandClasses, - info: Partial, - ): void { - if ( - this.getNodeUnsafe()?.isListening - && (cc === CommandClasses.Battery - || cc === CommandClasses["Wake Up"]) - ) { - // Avoid adding Battery and Wake Up CC to always listening nodes or their endpoints - return; - } else if ( - this.index > 0 - && [ - CommandClasses["CRC-16 Encapsulation"], - CommandClasses["Device Reset Locally"], - CommandClasses["Manufacturer Specific"], - CommandClasses.Powerlevel, - CommandClasses.Version, - CommandClasses["Transport Service"], - ].includes(cc) - ) { - // Avoid adding CCs as mandatory to endpoints that should only be implemented by the root device - return; - } - - this.addCC(cc, info); - } - /** Removes a CC from the list of command classes implemented by the endpoint */ public removeCC(cc: CommandClasses): void { this._implementedCommandClasses.delete(cc); diff --git a/packages/zwave-js/src/lib/node/Node.ts b/packages/zwave-js/src/lib/node/Node.ts index c08de55c699e..64b485ed2911 100644 --- a/packages/zwave-js/src/lib/node/Node.ts +++ b/packages/zwave-js/src/lib/node/Node.ts @@ -1898,18 +1898,17 @@ export class ZWaveNode extends Endpoint this.supportsSecurity = resp.supportsSecurity; this.supportsBeaming = resp.supportsBeaming; - const deviceClass = new DeviceClass( + this.deviceClass = new DeviceClass( this.driver.configManager, resp.basicDeviceClass, resp.genericDeviceClass, resp.specificDeviceClass, ); - this.applyDeviceClass(deviceClass); const logMessage = `received response for protocol info: -basic device class: ${this.deviceClass!.basic.label} -generic device class: ${this.deviceClass!.generic.label} -specific device class: ${this.deviceClass!.specific.label} +basic device class: ${this.deviceClass.basic.label} +generic device class: ${this.deviceClass.generic.label} +specific device class: ${this.deviceClass.specific.label} node type: ${getEnumMemberName(NodeType, this.nodeType)} is always listening: ${this.isListening} is frequent listening: ${this.isFrequentListening} diff --git a/packages/zwave-js/src/lib/test/node/Node.constructor.test.ts b/packages/zwave-js/src/lib/test/node/Node.constructor.test.ts index d56dd2960b65..995ca3d18a8b 100644 --- a/packages/zwave-js/src/lib/test/node/Node.constructor.test.ts +++ b/packages/zwave-js/src/lib/test/node/Node.constructor.test.ts @@ -115,16 +115,3 @@ test.serial("initializes the node's value DB", (t) => { t.true(node.valueDB instanceof ValueDB); node.destroy(); }); - -test.serial("marks the mandatory CCs as supported/controlled", (t) => { - const { driver } = t.context; - - // Portable Scene Controller - const deviceClass = new DeviceClass(driver.configManager, 0x01, 0x01, 0x02); - const node = new ZWaveNode(1, driver, deviceClass); - t.true(node.supportsCC(CommandClasses.Association)); - t.true(node.supportsCC(CommandClasses["Scene Controller Configuration"])); - t.true(node.supportsCC(CommandClasses["Manufacturer Specific"])); - t.true(node.controlsCC(CommandClasses["Scene Activation"])); - node.destroy(); -});