project-chip / connectedhomeip

Matter (formerly Project CHIP) creates more connections between more objects, simplifying development for manufacturers and increasing compatibility for consumers, guided by the Connectivity Standards Alliance.
https://buildwithmatter.com
Apache License 2.0
7.47k stars 2k forks source link

Python controller support to read Basic Information Cluster #5604

Closed cjandhyala closed 3 years ago

cjandhyala commented 3 years ago

Python controller support to read Application Basic Cluster info, Per 6.1.1.7 Test Procedure of Device Management and Section of 8.2. of the chip protocol spec.

Screen Shot 2021-03-24 at 5 30 23 PM

Damian-Nordic commented 3 years ago

@franck-apple are you sure it's needed for TE2? There are two clusters of similar names: Basic Cluster and Application Basic Cluster and thought that the former would be needed for TE2 based on the "CSG Test Event Execution Plan" document. Can this be clarified?

woody-apple commented 3 years ago

@Damian-Nordic TE2 is focusing on this item in the spec: "11.2. Basic Information Cluster"

woody-apple commented 3 years ago

@Damian-Nordic - just for clarity, @cjandhyala's reference is to an older part of the spec, this is indeed required for TE2, and the spec is the 11.2. Basic Information Cluster.

Damian-Nordic commented 3 years ago

@woody-apple Ok, thanks for clarification!

cjandhyala commented 3 years ago

@Damian-Nordic , Here is the reference for the test case https://github.com/project-chip/chip-test-plans/blob/master/src/devicemanagement.adoc#6117-test-procedure , we should be able read all these attributes per test plan

Damian-Nordic commented 3 years ago

@cjandhyala Added two PRs which together should allow you to read all Basic Cluster attributes.

Examples of reading mandatory attributes:

chip-device-ctrl > zclread Basic VendorName 1 1 1
...
CHIP:ZCL:   value: TEST_VENDOR

chip-device-ctrl > zclread Basic VendorID 1 1 1
...
CHIP:ZCL:   value: 0x235a

chip-device-ctrl > zclread Basic ProductName 1 1 1
...
CHIP:ZCL:   value: TEST_PRODUCT

chip-device-ctrl > zclread Basic ProductID 1 1 1
...
CHIP:ZCL:   value: 0x4e4b

chip-device-ctrl > zclread Basic UserLabel 1 1 1
...
CHIP:ZCL:   value: 

chip-device-ctrl > zclread Basic Location 1 1 1
...
CHIP:ZCL:   value:

chip-device-ctrl > zclread Basic HardwareVersion 1 1 1
...
CHIP:ZCL:   value: 0x0001

chip-device-ctrl > zclread Basic HardwareVersionString 1 1 1
...
CHIP:ZCL:   value: TEST_VERSION

chip-device-ctrl > zclread Basic SoftwareVersion 1 1 1
...
CHIP:ZCL:   value: 0x00000001

chip-device-ctrl > zclread Basic SoftwareVersionString 1 1 1
...
CHIP:ZCL:   value: prerelease

The remaining attributes are optional and if a given attribute is not supported by the DUT, the command will return the following error:

chip-device-ctrl > zclread Basic ManufacturingDate 1 1 1
CHIP:ZCL: ReadAttributesResponse:
CHIP:ZCL:   ClusterId: 0x0028
CHIP:ZCL:   attributeId: 0x000b
CHIP:ZCL:   status: EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE (0x86)
Failed to establish secure session to device: 134
CHIP:ZCL: Data model processing success!
An exception occurred during reading ZCL attribute:
franck-apple commented 3 years ago

Some of the optional attributes are missing. Python controller is currently able to parse all the mandatory attributes, but is not able to validate optional attributes if an accessory vendor implements it.

Damian-Nordic commented 3 years ago

@franck-apple can someone provide any logs? They worked last time I tried.

cjandhyala commented 3 years ago

@Damian-Nordic per our slack conversation the other day, right now python controller can parse the mandatory attributes, which is working fine. We need python controller to be able to read the remaining optional attributes as well in case any vendor implements those.

Damian-Nordic commented 3 years ago

As discussed on slack, Python CHIP Controller can already read all Basic cluster attributes. If there's a need to enable the optional attributes on a specific example, another issue should be created.