Skip to content

Commit

Permalink
Add test scripts for testing Presets attributes and commands for Ther…
Browse files Browse the repository at this point in the history
…mostat cluster (project-chip#34614)

* Add test scripts for testing Presets attributes and commands for Thermostat cluster

* Fixes

* Fix Test_TC_TSTAT_4_2.yaml to parse correctly.

* Run zap regen with latest zap version

* Restyled by prettier-yaml

* Editorial fixes

* Restyle

* Add support to all clusters app to support Thermostat presets attributes and commands

* Addressed review comments

---------

Co-authored-by: Boris Zbarsky <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
3 people authored Jul 31, 2024
1 parent 8601109 commit 91d1a28
Show file tree
Hide file tree
Showing 11 changed files with 2,599 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8813,14 +8813,23 @@ endpoint 1 {
ram attribute minSetpointDeadBand default = 0x19;
ram attribute controlSequenceOfOperation default = 0x04;
ram attribute systemMode default = 0x01;
callback attribute presetTypes;
ram attribute numberOfPresets default = 0;
ram attribute activePresetHandle;
callback attribute presets;
ram attribute presetsSchedulesEditable;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
callback attribute attributeList;
ram attribute featureMap default = 0x0023;
ram attribute featureMap default = 0x0123;
ram attribute clusterRevision default = 6;

handle command SetpointRaiseLower;
handle command SetActivePresetRequest;
handle command StartPresetsSchedulesEditRequest;
handle command CancelPresetsSchedulesEditRequest;
handle command CommitPresetsSchedulesRequest;
}

server cluster FanControl {
Expand Down
116 changes: 114 additions & 2 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -16393,6 +16393,38 @@
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "SetActivePresetRequest",
"code": 6,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "StartPresetsSchedulesEditRequest",
"code": 7,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "CancelPresetsSchedulesEditRequest",
"code": 8,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "CommitPresetsSchedulesRequest",
"code": 9,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
}
],
"attributes": [
Expand Down Expand Up @@ -16636,6 +16668,86 @@
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "PresetTypes",
"code": 72,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "NumberOfPresets",
"code": 74,
"mfgCode": null,
"side": "server",
"type": "int8u",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ActivePresetHandle",
"code": 78,
"mfgCode": null,
"side": "server",
"type": "octet_string",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "Presets",
"code": 80,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "PresetsSchedulesEditable",
"code": 82,
"mfgCode": null,
"side": "server",
"type": "boolean",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "GeneratedCommandList",
"code": 65528,
Expand Down Expand Up @@ -16710,7 +16822,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0023",
"defaultValue": "0x0123",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
Expand Down Expand Up @@ -26554,4 +26666,4 @@
"parentEndpointIdentifier": null
}
]
}
}
2 changes: 2 additions & 0 deletions examples/all-clusters-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ source_set("chip-all-clusters-common") {
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp",
"${chip_root}/examples/thermostat/linux/thermostat-delegate-impl.cpp",
"AllClustersCommandDelegate.cpp",
"AllClustersCommandDelegate.h",
"AppOptions.cpp",
Expand All @@ -98,6 +99,7 @@ source_set("chip-all-clusters-common") {
include_dirs = [
"${chip_root}/examples/all-clusters-app/all-clusters-common/include",
"${chip_root}/examples/energy-management-app/energy-management-common/include",
"${chip_root}/examples/thermostat/linux/include",
]

if (chip_enable_pw_rpc) {
Expand Down
11 changes: 11 additions & 0 deletions examples/all-clusters-app/linux/main-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "rvc-modes.h"
#include "rvc-operational-state-delegate-impl.h"
#include "tcc-mode.h"
#include "thermostat-delegate-impl.h"
#include "water-heater-mode.h"
#include <Options.h>
#include <app-common/zap-generated/attributes/Accessors.h>
Expand All @@ -46,6 +47,7 @@
#include <app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h>
#include <app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.h>
#include <app/clusters/mode-base-server/mode-base-server.h>
#include <app/clusters/thermostat-server/thermostat-server.h>
#include <app/clusters/time-synchronization-server/time-synchronization-server.h>
#include <app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.h>
#include <app/server/Server.h>
Expand Down Expand Up @@ -323,3 +325,12 @@ void emberAfDiagnosticLogsClusterInitCallback(chip::EndpointId endpoint)

DiagnosticLogsServer::Instance().SetDiagnosticLogsProviderDelegate(endpoint, &logProvider);
}

using namespace chip::app::Clusters::Thermostat;
void emberAfThermostatClusterInitCallback(EndpointId endpoint)
{
// Register the delegate for the Thermostat
auto & delegate = ThermostatDelegate::GetInstance();

SetDefaultDelegate(endpoint, &delegate);
}
1 change: 1 addition & 0 deletions examples/thermostat/thermostat-common/thermostat.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2561,6 +2561,7 @@ endpoint 1 {
ram attribute absMaxHeatSetpointLimit default = 3000;
ram attribute absMinCoolSetpointLimit default = 1600;
ram attribute absMaxCoolSetpointLimit default = 3200;
ram attribute localTemperatureCalibration default = 0x00;
persist attribute occupiedCoolingSetpoint default = 0x0A28;
persist attribute occupiedHeatingSetpoint default = 0x07D0;
ram attribute minHeatSetpointLimit default = 700;
Expand Down
16 changes: 16 additions & 0 deletions examples/thermostat/thermostat-common/thermostat.zap
Original file line number Diff line number Diff line change
Expand Up @@ -4774,6 +4774,22 @@
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "LocalTemperatureCalibration",
"code": 16,
"mfgCode": null,
"side": "server",
"type": "int8s",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x00",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "OccupiedCoolingSetpoint",
"code": 17,
Expand Down
57 changes: 57 additions & 0 deletions src/app/tests/suites/certification/PICS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6422,6 +6422,21 @@ PICS:
- label: "Does the device implement the ACCapacityFormat attribute?"
id: TSTAT.S.A0047

- label: "Does the device implement the PresetTypes attribute?"
id: TSTAT.S.A0048

- label: "Does the device implement the NumberOfPresets attribute?"
id: TSTAT.S.A004a

- label: "Does the device implement the ActivePresetHandle attribute?"
id: TSTAT.S.A004e

- label: "Does the device implement the Presets attribute?"
id: TSTAT.S.A0050

- label: "Does the device implement the PresetsSchedulesEditable attribute?"
id: TSTAT.S.A0052

#
# server / commandsReceived
#
Expand All @@ -6445,6 +6460,26 @@ PICS:
"Does the device implement receiving the GetRelayStatusLog command?"
id: TSTAT.S.C04.Rsp

- label:
"Does the device implement receiving the SetActivePresetRequest
command?"
id: TSTAT.S.C06.Rsp

- label:
"Does the device implement receiving the
StartPresetsSchedulesEditRequest command?"
id: TSTAT.S.C07.Rsp

- label:
"Does the device implement receiving the
CancelPresetsSchedulesEditRequest command?"
id: TSTAT.S.C08.Rsp

- label:
"Does the device implement receiving the CommitPresetsSchedulesRequest
command?"
id: TSTAT.S.C09.Rsp

#
# server / commandsGenerated
#
Expand Down Expand Up @@ -6482,6 +6517,9 @@ PICS:
- label: "Supports a local temperature not exposed"
id: TSTAT.S.F06

- label: "Supports setpoint presets"
id: TSTAT.S.F08

#
# server / manually
#
Expand Down Expand Up @@ -6523,6 +6561,25 @@ PICS:
- label: "Does the device implement sending the GetRelayStatusLog command?"
id: TSTAT.C.C04.Tx

- label:
"Does the device implement sending the SetActivePresetRequest command?"
id: TSTAT.C.C06.Tx

- label:
"Does the device implement sending the
StartPresetsSchedulesEditRequest command?"
id: TSTAT.C.C07.Tx

- label:
"Does the device implement sending the
CancelPresetsSchedulesEditRequest command?"
id: TSTAT.C.C08.Tx

- label:
"Does the device implement sending the CommitPresetsSchedulesRequest
command?"
id: TSTAT.C.C09.Tx

#
# client / manually
#
Expand Down
32 changes: 32 additions & 0 deletions src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ tests:
type: bitmap32
hasMasksSet: [0x40]

- label:
"Step 3i: Given TSTAT.S.F08(PRES ensure featuremap has the correct bit
set"
PICS: TSTAT.S.F08
command: "readAttribute"
attribute: "FeatureMap"
response:
constraints:
type: bitmap32
hasMasksSet: [0x100]

- label: "Step 4a: TH reads from the DUT the AttributeList attribute."
PICS: PICS_EVENT_LIST_ENABLED
command: "readAttribute"
Expand Down Expand Up @@ -555,6 +566,17 @@ tests:
type: list
contains: [30]

- label:
"Step 4j: TH reads the Feature dependent(TSTAT.S.F08(PRES) attribute
in AttributeList"
PICS: TSTAT.S.F08
command: "readAttribute"
attribute: "AttributeList"
response:
constraints:
type: list
contains: [72, 74, 78, 80, 82]

- label: "Step 5: TH reads EventList attribute from the DUT."
PICS: PICS_EVENT_LIST_ENABLED
command: "readAttribute"
Expand Down Expand Up @@ -593,6 +615,16 @@ tests:
constraints:
type: list
contains: [4]
- label:
"Step 6d: TH reads Feature dependent(TSTAT.S.F08(PRES)) commands in
AcceptedCommandList"
PICS: TSTAT.S.F08
command: "readAttribute"
attribute: "AcceptedCommandList"
response:
constraints:
type: list
contains: [6, 7, 8, 9]

- label:
"Step 7a: TH reads from the DUT the GeneratedCommandList attribute."
Expand Down
Loading

0 comments on commit 91d1a28

Please sign in to comment.