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

fix: only rely on NIF to determine CC support #6788

Merged
merged 4 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 2 additions & 145 deletions maintenance/schemas/deviceClasses.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/schema#",
"$schema": "https://json-schema.org/draft-07/schema",
"type": "object",
"properties": {
"basic": {
Expand All @@ -22,12 +22,6 @@
"requiresSecurity": {
"const": true
},
"supportedCCs": {
"$ref": "#/definitions/CCs"
},
"controlledCCs": {
"$ref": "#/definitions/CCs"
},
"maySupportBasicCC": {
"const": false
},
Expand All @@ -43,12 +37,6 @@
"requiresSecurity": {
"const": true
},
"supportedCCs": {
"$ref": "#/definitions/CCs"
},
"controlledCCs": {
"$ref": "#/definitions/CCs"
},
"maySupportBasicCC": {
"const": false
}
Expand All @@ -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
}
16 changes: 1 addition & 15 deletions packages/cc/src/cc/MultiChannelCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading