project-chip / zap

ZAP stands for ZCL Advanced Platform. It is used to configure clusters, attributes and other entities for Matter and ZigbeePro applications.
Apache License 2.0
139 stars 83 forks source link

Not able to set SmokeAlarmCO as Primary device type if PowerSource device type exists #1119

Closed erwinpan1 closed 1 month ago

erwinpan1 commented 1 year ago

Reproducing steps

  1. Prepare the environment by download Matter SDK

    
    erwinpan@erwinpan-p1g4lin01:~/matter/erwinpan1/master_0901_smokecoalarm$ git log -1
    commit 0eafac9896dd05065f2ce464177f96202abbff6b (HEAD -> master, origin/master, origin/HEAD)
    Author: Boris Zbarsky <bzbarsky@apple.com>
    Date:   Wed Aug 30 01:08:11 2023 -0400
    
    Actually enable RVC tests in CI. (#28954)
    
    https://github.com/project-chip/connectedhomeip/pull/28665 didn't enable the
    YAML bits.

erwinpan@erwinpan-p1g4lin01:~/matter/erwinpan1/master_0901_smokecoalarm$ source scripts/activate.sh

erwinpan@erwinpan-p1g4lin01:~/matter/erwinpan1/master_0901_smokecoalarm$ zap --version Version: 2023.8.4 Feature level: 97 Hash: d9df1e59864c47a77e838d7b096e854c4a64ea5b Date: 2023-08-04T17:38:35.000Z Mode: source erwinpan@erwinpan-p1g4lin01:~/matter/erwinpan1/master_0901_smokecoalarm$ whereis zap zap: /usr/bin/zap /home/erwinpan/matter/erwinpan1/master_0901_smokecoalarm/.environment/cipd/packages/zap/zap

erwinpan@erwinpan-p1g4lin01:~/matter/erwinpan1/master_0901_smokecoalarm$ rm -rf ~/.zap/ erwinpan@erwinpan-p1g4lin01:~/matter/erwinpan1/master_0901_smokecoalarm$


1. Load [examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap](https://github.com/project-chip/connectedhomeip/blob/master/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap) and create new endpoint (EP3) with SmokeAlarmCO + PowerSource device type
![image](https://github.com/project-chip/zap/assets/7869096/89458384-c188-44b9-84d8-9086e7bd56e1)

1. Confirm the primary device type in EP3 is SmokeCOAlarm sensor, then click "File" => "Save As" => e.g., **SmokeCOAlarm_new.zap**
![image](https://github.com/project-chip/zap/assets/7869096/37251556-6041-49f9-9e41-aeec9575cb51)

1. Close zap GUI and 

1. Run ./scripts/tools/zap/run_zaptool.sh again to load the new **SomkeCOAlarm_new.zap**, the Primary device type becomes the PowerSource
![image](https://github.com/project-chip/zap/assets/7869096/8c763308-e723-46e5-a8af-3078c569c590)

1. Checking the zap file, the PowerSource becomes the device type
{
  "id": 5,
  "name": "Anonymous Endpoint Type",
  "deviceTypeRef": {
    "id": 3,
    "code": 17,
    "profileId": 259,
    "label": "MA-powersource",
    "name": "MA-powersource"
  },
  "deviceTypes": [
    {
      "id": 3,
      "code": 17,
      "profileId": 259,
      "label": "MA-powersource",
      "name": "MA-powersource"
    },
    {
      "id": 44,
      "code": 118,
      "profileId": 259,
      "label": "MA-smokecoalarm",
      "name": "MA-smokecoalarm"
    }
  ],
  "deviceTypeRefs": [
    3,
    44
  ],
brdandu commented 1 year ago

Changing to high priority. Got raised again in https://csamembers.slack.com/archives/C01B01GH64E/p1698334787749279

brdandu commented 1 month ago

Also see https://csamembers.slack.com/archives/C01B01GH64E/p1725634450046429 for reference. https://github.com/project-chip/connectedhomeip/issues/35437