-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix level control's currentLevel update when receiving an Off command (…
…#20788) According to the Application Clusters specification, when Level Control cluster is used in association with the On/Off cluster, the action on receipt for an Off command should be to change the current level to: * the minimum level allowed for the device, if OnLevel is defined. * the stored level, if OnLevel is not defined. In the current implementation, when receiving an Off command, the currentLevel attribute is always restored to the stored value. Signed-off-by: Marius Tache <[email protected]> Restyled by clang-format
- Loading branch information
1 parent
8e04007
commit 5224161
Showing
5 changed files
with
1,612 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
249 changes: 249 additions & 0 deletions
249
src/app/tests/suites/TestLevelControlWithOnOffDependency.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,249 @@ | ||
# Copyright (c) 2021 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: Dependency with the On/Off cluster Verification (DUT as Server) | ||
|
||
config: | ||
nodeId: 0x12344321 | ||
cluster: "Level Control" | ||
endpoint: 1 | ||
|
||
tests: | ||
- label: "Wait for the commissioned device to be retrieved" | ||
cluster: "DelayCommands" | ||
command: "WaitForCommissionee" | ||
arguments: | ||
values: | ||
- name: "nodeId" | ||
value: nodeId | ||
|
||
- label: "Sends a MoveToLevel command to set current level to min value" | ||
command: "MoveToLevel" | ||
arguments: | ||
values: | ||
- name: "level" | ||
value: 1 | ||
- name: "transitionTime" | ||
value: 0 | ||
- name: "optionMask" | ||
value: 1 | ||
- name: "optionOverride" | ||
value: 1 | ||
|
||
- label: "Wait 100 ms" | ||
cluster: "DelayCommands" | ||
command: "WaitForMs" | ||
arguments: | ||
values: | ||
- name: "ms" | ||
value: 100 | ||
|
||
- label: "Reads CurrentLevel attribute from DUT" | ||
command: "readAttribute" | ||
attribute: "current level" | ||
response: | ||
value: 1 | ||
|
||
- label: "Write OnOffTransitionTime attribute" | ||
command: "writeAttribute" | ||
attribute: "on off transition time" | ||
arguments: | ||
value: 0 | ||
|
||
- label: "Wait 100 ms" | ||
cluster: "DelayCommands" | ||
command: "WaitForMs" | ||
arguments: | ||
values: | ||
- name: "ms" | ||
value: 100 | ||
|
||
- label: "Read OnOffTransitionTime attribute" | ||
command: "readAttribute" | ||
attribute: "on off transition time" | ||
response: | ||
value: 0 | ||
|
||
- label: "Write OnLevel attribute" | ||
command: "writeAttribute" | ||
attribute: "on level" | ||
arguments: | ||
value: 254 | ||
|
||
- label: "Wait 100 ms" | ||
cluster: "DelayCommands" | ||
command: "WaitForMs" | ||
arguments: | ||
values: | ||
- name: "ms" | ||
value: 100 | ||
|
||
- label: "Read OnLevel attribute" | ||
command: "readAttribute" | ||
attribute: "on level" | ||
response: | ||
value: 254 | ||
|
||
- label: "Read MinValue attribute" | ||
command: "readAttribute" | ||
attribute: "min level" | ||
response: | ||
value: 1 | ||
|
||
- label: "Send On Command" | ||
cluster: "On/Off" | ||
command: "On" | ||
|
||
- label: "Check on/off attribute value is true after on command" | ||
cluster: "On/Off" | ||
command: "readAttribute" | ||
attribute: "OnOff" | ||
response: | ||
value: 1 | ||
|
||
- label: "Wait OnOffTransitionTime" | ||
cluster: "DelayCommands" | ||
command: "WaitForMs" | ||
arguments: | ||
values: | ||
- name: "ms" | ||
value: 100 | ||
|
||
- label: "If OnLevel is defined, check CurrentLevel is OnLevel value" | ||
command: "readAttribute" | ||
attribute: "current level" | ||
response: | ||
value: 254 | ||
|
||
- label: "Send Off Command" | ||
cluster: "On/Off" | ||
command: "Off" | ||
|
||
- label: "Check on/off attribute value is false after off command" | ||
cluster: "On/Off" | ||
command: "readAttribute" | ||
attribute: "OnOff" | ||
response: | ||
value: 0 | ||
|
||
- label: "Wait OnOffTransitionTime" | ||
cluster: "DelayCommands" | ||
command: "WaitForMs" | ||
arguments: | ||
values: | ||
- name: "ms" | ||
value: 0 | ||
|
||
- label: "If OnLevel is defined, check CurrentLevel is min value" | ||
command: "readAttribute" | ||
attribute: "current level" | ||
response: | ||
value: 1 | ||
|
||
- label: "Sends a MoveToLevel command to set current level to a mid value" | ||
command: "MoveToLevel" | ||
arguments: | ||
values: | ||
- name: "level" | ||
value: 127 | ||
- name: "transitionTime" | ||
value: 0 | ||
- name: "optionMask" | ||
value: 1 | ||
- name: "optionOverride" | ||
value: 1 | ||
|
||
- label: "Wait 100 ms" | ||
cluster: "DelayCommands" | ||
command: "WaitForMs" | ||
arguments: | ||
values: | ||
- name: "ms" | ||
value: 100 | ||
|
||
- label: "Reads CurrentLevel attribute from DUT" | ||
command: "readAttribute" | ||
attribute: "current level" | ||
response: | ||
value: 127 | ||
|
||
- label: "Set OnLevel attribute to null" | ||
command: "writeAttribute" | ||
attribute: "on level" | ||
arguments: | ||
value: null | ||
|
||
- label: "Wait 100 ms" | ||
cluster: "DelayCommands" | ||
command: "WaitForMs" | ||
arguments: | ||
values: | ||
- name: "ms" | ||
value: 100 | ||
|
||
- label: "Read OnLevel attribute" | ||
command: "readAttribute" | ||
attribute: "on level" | ||
response: | ||
value: null | ||
|
||
- label: "Send On Command" | ||
cluster: "On/Off" | ||
command: "On" | ||
|
||
- label: "Check on/off attribute value is true after on command" | ||
cluster: "On/Off" | ||
command: "readAttribute" | ||
attribute: "OnOff" | ||
response: | ||
value: 1 | ||
|
||
- label: "Wait OnOffTransitionTime" | ||
cluster: "DelayCommands" | ||
command: "WaitForMs" | ||
arguments: | ||
values: | ||
- name: "ms" | ||
value: 100 | ||
|
||
- label: "If OnLevel is not defined, check CurrentLevel is restored" | ||
command: "readAttribute" | ||
attribute: "current level" | ||
response: | ||
value: 127 | ||
|
||
- label: "Send Off Command" | ||
cluster: "On/Off" | ||
command: "Off" | ||
|
||
- label: "Check on/off attribute value is false after off command" | ||
cluster: "On/Off" | ||
command: "readAttribute" | ||
attribute: "OnOff" | ||
response: | ||
value: 0 | ||
|
||
- label: "Wait OnOffTransitionTime" | ||
cluster: "DelayCommands" | ||
command: "WaitForMs" | ||
arguments: | ||
values: | ||
- name: "ms" | ||
value: 0 | ||
|
||
- label: "If OnLevel is not defined, check CurrentLevel is restored" | ||
command: "readAttribute" | ||
attribute: "current level" | ||
response: | ||
value: 127 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.