[chip-tool] Add AnyCommands aliases (#26755)
diff --git a/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/decoder.py b/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/decoder.py
index 052e254..15522f8 100644
--- a/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/decoder.py
+++ b/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/decoder.py
@@ -95,11 +95,14 @@
# Raise an error since the other fields probably needs to be translated too.
raise KeyError(f'Error: field "{key}" not supported')
- if value is None and (key == _CLUSTER or key == _RESPONSE or key == _ATTRIBUTE or key == _EVENT):
+ if value is None and (key == _CLUSTER or key == _RESPONSE or key == _ATTRIBUTE or key == _EVENT) and _ERROR not in payload:
# If the definition for this cluster/command/attribute/event is missing, there is not
# much we can do to convert the response to the proper format. It usually indicates that
# the cluster definition is missing something. So we just raise an exception to tell the
# user something is wrong and the cluster definition needs to be updated.
+ # The only exception being when the definition can not be found but the returned payload
+ # contains an error. It could be because the payload is for an unknown cluster/command/attribute/event
+ # in which case we obviously don't have a definition for it.
cluster_code = hex(payload[_CLUSTER_ID])
if key == _CLUSTER:
raise KeyError(
diff --git a/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/encoder.py b/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/encoder.py
index 0dbca4a..f060a50 100644
--- a/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/encoder.py
+++ b/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/encoder.py
@@ -16,7 +16,88 @@
import json
import re
+_ANY_COMMANDS_LIST = [
+ 'ReadById',
+ 'WriteById',
+ 'SubscribeById',
+ 'ReadEventById',
+ 'SubscribeEventById',
+ 'ReadAll',
+ 'SubscribeAll',
+]
+
+_ANY_COMMANDS_LIST_ARGUMENTS_WITH_WILDCARDS = [
+ 'ClusterId',
+ 'AttributeId',
+ 'EventId',
+]
+
+
_ALIASES = {
+ 'AnyCommands': {
+ 'alias': 'any',
+ 'commands': {
+ 'CommandById': {
+ 'alias': 'command-by-id',
+ 'arguments': {
+ 'ClusterId': 'cluster-id',
+ 'CommandId': 'command-id',
+ },
+ },
+ 'ReadById': {
+ 'alias': 'read-by-id',
+ 'arguments': {
+ 'ClusterId': 'cluster-ids',
+ 'AttributeId': 'attribute-ids',
+ },
+ },
+ 'WriteById': {
+ 'alias': 'write-by-id',
+ 'arguments': {
+ 'ClusterId': 'cluster-ids',
+ 'AttributeId': 'attribute-ids',
+ 'Value': 'attribute-values'
+ },
+ },
+ 'SubscribeById': {
+ 'alias': 'subscribe-by-id',
+ 'arguments': {
+ 'ClusterId': 'cluster-ids',
+ 'AttributeId': 'attribute-ids',
+ },
+ },
+ 'ReadEventById': {
+ 'alias': 'read-event-by-id',
+ 'arguments': {
+ 'ClusterId': 'cluster-id',
+ 'EventId': 'event-id',
+ },
+ },
+ 'SubscribeEventById': {
+ 'alias': 'subscribe-event-by-id',
+ 'arguments': {
+ 'ClusterId': 'cluster-id',
+ 'EventId': 'event-id',
+ },
+ },
+ 'ReadAll': {
+ 'alias': 'read-all',
+ 'arguments': {
+ 'ClusterId': 'cluster-ids',
+ 'AttributeId': 'attribute-ids',
+ 'EventId': 'event-ids',
+ },
+ },
+ 'SubscribeAll': {
+ 'alias': 'subscribe-all',
+ 'arguments': {
+ 'ClusterId': 'cluster-ids',
+ 'AttributeId': 'attribute-ids',
+ 'EventId': 'event-ids',
+ },
+ },
+ }
+ },
'CommissionerCommands': {
'alias': 'pairing',
'commands': {
@@ -199,7 +280,7 @@
endpoint_argument_name = 'endpoint-id-ignored-for-group-commands'
endpoint_argument_value = request.endpoint
- if (request.is_attribute and not request.command == "writeAttribute") or request.is_event:
+ if (request.is_attribute and not request.command == "writeAttribute") or request.is_event or (request.command in _ANY_COMMANDS_LIST and not request.command == "WriteById"):
endpoint_argument_name = 'endpoint-ids'
if rv:
@@ -213,7 +294,8 @@
for entry in request.arguments['values']:
name = self.__get_argument_name(request, entry)
- value = self.__encode_value(entry['value'])
+ value = self.__encode_value(
+ request.command, entry.get('name'), entry['value'])
if rv:
rv += ', '
rv += f'"{name}":{value}'
@@ -242,11 +324,24 @@
rv += f'"{name}":"{value}"'
return rv
- def __encode_value(self, value):
+ def __encode_value(self, command_name, argument_name, value):
+ value = self.__encode_wildcards(command_name, argument_name, value)
value = self.__encode_octet_strings(value)
value = self.__lower_camel_case_member_fields(value)
return self.__convert_to_json_string(value)
+ def __encode_wildcards(self, command_name, argument_name, value):
+ if value != '*':
+ return value
+
+ # maybe a wildcard
+ if command_name in _ANY_COMMANDS_LIST and argument_name in _ANY_COMMANDS_LIST_ARGUMENTS_WITH_WILDCARDS:
+ # translate * to wildcard constant
+ return 0xFFFFFFFF
+
+ # return actual '*' as value ... not a wildcard-compatible argument
+ return value
+
def __encode_octet_strings(self, value):
if isinstance(value, list):
value = [self.__encode_octet_strings(entry) for entry in value]
diff --git a/scripts/py_matter_yamltests/matter_yamltests/parser.py b/scripts/py_matter_yamltests/matter_yamltests/parser.py
index 6b0cd11..32f5473 100644
--- a/scripts/py_matter_yamltests/matter_yamltests/parser.py
+++ b/scripts/py_matter_yamltests/matter_yamltests/parser.py
@@ -24,6 +24,18 @@
from .pics_checker import PICSChecker
from .yaml_loader import YamlLoader
+ANY_COMMANDS_CLUSTER_NAME = 'AnyCommands'
+ANY_COMMANDS_LIST = [
+ 'CommandById',
+ 'ReadById',
+ 'WriteById',
+ 'SubscribeById',
+ 'ReadEventById',
+ 'SubscribeEventById',
+ 'ReadAll',
+ 'SubscribeAll',
+]
+
class UnknownPathQualifierError(TestStepError):
"""Raise when an attribute/command/event name is not found in the definitions."""
@@ -235,7 +247,7 @@
def _update_mappings(self, test: dict, definitions: SpecDefinitions):
cluster_name = self.cluster
- if definitions is None or not definitions.has_cluster_by_name(cluster_name):
+ if definitions is None or not definitions.has_cluster_by_name(cluster_name) or cluster_name == ANY_COMMANDS_CLUSTER_NAME or self.command in ANY_COMMANDS_LIST:
self.argument_mapping = None
self.response_mapping = None
self.response_mapping_name = None
@@ -756,7 +768,7 @@
break
received_value = received_response.get('value')
- if not self.is_attribute and not self.is_event:
+ if not self.is_attribute and not self.is_event and not (self.command in ANY_COMMANDS_LIST):
expected_name = value.get('name')
if expected_name not in received_value:
result.error(check_type, error_name_does_not_exist.format(
diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py
index c35c539..143fd7e 100644
--- a/scripts/tests/chiptest/__init__.py
+++ b/scripts/tests/chiptest/__init__.py
@@ -128,17 +128,16 @@
def _GetInDevelopmentTests() -> Set[str]:
- """Tests that fail in YAML for some reason.
-
- Currently this is empty and returns an empty set, but this is kept around in case
- there are tests that are a work in progress.
- """
+ """Tests that fail in YAML for some reason."""
return {
"Test_AddNewFabricFromExistingFabric.yaml", # chip-repl does not support GetCommissionerRootCertificate and IssueNocChain command
"TestEqualities.yaml", # chip-repl does not support pseudo-cluster commands that return a value
"TestExampleCluster.yaml", # chip-repl does not load custom pseudo clusters
"TestClientMonitoringCluster.yaml", # Client Monitoring Tests need a rework after the XML update
- "Test_TC_TIMESYNC_1_1.yaml" # Time sync SDK is not yet ready
+ "Test_TC_TIMESYNC_1_1.yaml", # Time sync SDK is not yet ready
+ "TestAttributesById.yaml", # chip-repl does not support AnyCommands (06/06/2023)
+ "TestCommandsById.yaml", # chip-repl does not support AnyCommands (06/06/2023)
+ "TestEventsById.yaml", # chip-repl does not support AnyCommands (06/06/2023)
}
diff --git a/src/app/tests/suites/TestAttributesById.yaml b/src/app/tests/suites/TestAttributesById.yaml
new file mode 100644
index 0000000..7869be7
--- /dev/null
+++ b/src/app/tests/suites/TestAttributesById.yaml
@@ -0,0 +1,280 @@
+# Copyright (c) 2023 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: Attributes Tests
+
+config:
+ nodeId: 0x12344321
+ endpoint: 1
+ cluster: "Unit Testing"
+
+ UnsupportedCluster: 0xFFF1FC06
+ UnsupportedAttribute: 0xFFF11FFF
+ UnsupportedEndPoint: 254
+
+ AttributeRequestMessage.Cluster: 0xFFF1FC05
+ AttributeRequestMessage.Attribute: 0x0000
+ AttributeRequestMessage.EndPoint: 1
+
+tests:
+ - label: "Wait for the commissioned device to be retrieved"
+ cluster: "DelayCommands"
+ command: "WaitForCommissionee"
+ arguments:
+ values:
+ - name: "nodeId"
+ value: nodeId
+
+ - label:
+ "Read Request Message with a path that indicates a specific endpoint
+ that is unsupported"
+ cluster: "AnyCommands"
+ command: "ReadById"
+ endpoint: UnsupportedEndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: AttributeRequestMessage.Cluster
+ - name: "AttributeId"
+ value: AttributeRequestMessage.Attribute
+ response:
+ error: UNSUPPORTED_ENDPOINT
+
+ - label:
+ "Read Request Message with a path that indicates a specific cluster
+ that is unsupported"
+ cluster: "AnyCommands"
+ command: "ReadById"
+ endpoint: AttributeRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: UnsupportedCluster
+ - name: "AttributeId"
+ value: AttributeRequestMessage.Attribute
+ response:
+ error: UNSUPPORTED_CLUSTER
+
+ - label:
+ "Read Request Message with a path that indicates a specific command
+ that is unsupported"
+ cluster: "AnyCommands"
+ command: "ReadById"
+ endpoint: AttributeRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: AttributeRequestMessage.Cluster
+ - name: "AttributeId"
+ value: UnsupportedAttribute
+ response:
+ error: UNSUPPORTED_ATTRIBUTE
+
+ - label:
+ "Read Request Message with a valid path that indicates a specific
+ endpoint/cluster/attribute"
+ cluster: "AnyCommands"
+ command: "ReadById"
+ endpoint: AttributeRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: AttributeRequestMessage.Cluster
+ - name: "AttributeId"
+ value: AttributeRequestMessage.Attribute
+ response:
+ value: false
+
+ - label:
+ "Write Request Message with a path that indicates a specific endpoint
+ that is unsupported"
+ cluster: "AnyCommands"
+ command: "WriteById"
+ endpoint: UnsupportedEndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: AttributeRequestMessage.Cluster
+ - name: "AttributeId"
+ value: AttributeRequestMessage.Attribute
+ - name: "Value"
+ value: true
+ response:
+ error: UNSUPPORTED_ENDPOINT
+
+ - label:
+ "Write Request Message with a path that indicates a specific cluster
+ that is unsupported"
+ cluster: "AnyCommands"
+ command: "WriteById"
+ endpoint: AttributeRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: UnsupportedCluster
+ - name: "AttributeId"
+ value: AttributeRequestMessage.Attribute
+ - name: "Value"
+ value: true
+ response:
+ error: UNSUPPORTED_CLUSTER
+
+ - label:
+ "Write Request Message with a path that indicates a specific command
+ that is unsupported"
+ cluster: "AnyCommands"
+ command: "WriteById"
+ endpoint: AttributeRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: AttributeRequestMessage.Cluster
+ - name: "AttributeId"
+ value: UnsupportedAttribute
+ - name: "Value"
+ value: true
+ response:
+ error: UNSUPPORTED_ATTRIBUTE
+
+ - label:
+ "Write Request Message with a valid path that indicates a specific
+ endpoint/cluster/attribute"
+ cluster: "AnyCommands"
+ command: "WriteById"
+ endpoint: AttributeRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: AttributeRequestMessage.Cluster
+ - name: "AttributeId"
+ value: AttributeRequestMessage.Attribute
+ - name: "Value"
+ value: true
+
+ - label:
+ "Write Request Message with a valid path that indicates a specific
+ endpoint/cluster/attribute and set it back to defaults."
+ cluster: "AnyCommands"
+ command: "WriteById"
+ endpoint: AttributeRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: AttributeRequestMessage.Cluster
+ - name: "AttributeId"
+ value: AttributeRequestMessage.Attribute
+ - name: "Value"
+ value: false
+
+ - label:
+ "Subscribe Request Message with a path that indicates a specific
+ endpoint that is unsupported"
+ cluster: "AnyCommands"
+ command: "SubscribeById"
+ endpoint: UnsupportedEndPoint
+ minInterval: 2
+ maxInterval: 5
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: AttributeRequestMessage.Cluster
+ - name: "AttributeId"
+ value: AttributeRequestMessage.Attribute
+ response:
+ error: INVALID_ACTION
+
+ - label:
+ "Subscribe Request Message with a path that indicates a specific
+ cluster that is unsupported"
+ cluster: "AnyCommands"
+ command: "SubscribeById"
+ endpoint: AttributeRequestMessage.EndPoint
+ minInterval: 2
+ maxInterval: 5
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: UnsupportedCluster
+ - name: "AttributeId"
+ value: AttributeRequestMessage.Attribute
+ response:
+ error: INVALID_ACTION
+
+ - label:
+ "Subscribe Request Message with a path that indicates a specific
+ command that is unsupported"
+ cluster: "AnyCommands"
+ command: "SubscribeById"
+ endpoint: AttributeRequestMessage.EndPoint
+ minInterval: 2
+ maxInterval: 5
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: AttributeRequestMessage.Cluster
+ - name: "AttributeId"
+ value: UnsupportedAttribute
+ response:
+ error: INVALID_ACTION
+
+ - label:
+ "Subscribe Request Message with a valid path that indicates a specific
+ endpoint/cluster/attribute"
+ cluster: "AnyCommands"
+ command: "SubscribeById"
+ endpoint: AttributeRequestMessage.EndPoint
+ minInterval: 2
+ maxInterval: 5
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: AttributeRequestMessage.Cluster
+ - name: "AttributeId"
+ value: AttributeRequestMessage.Attribute
+
+ - label:
+ "Write Request Message with a valid path that indicates a specific
+ endpoint/cluster/attribute"
+ cluster: "AnyCommands"
+ command: "WriteById"
+ endpoint: AttributeRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: AttributeRequestMessage.Cluster
+ - name: "AttributeId"
+ value: AttributeRequestMessage.Attribute
+ - name: "Value"
+ value: true
+
+ - label: "Check for attribute report"
+ command: "waitForReport"
+ attribute: "boolean"
+ response:
+ value: true
+
+ - label:
+ "Write Request Message with a valid path that indicates a specific
+ endpoint/cluster/attribute and set it back to defaults."
+ cluster: "AnyCommands"
+ command: "WriteById"
+ endpoint: AttributeRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: AttributeRequestMessage.Cluster
+ - name: "AttributeId"
+ value: AttributeRequestMessage.Attribute
+ - name: "Value"
+ value: false
diff --git a/src/app/tests/suites/TestCommandsById.yaml b/src/app/tests/suites/TestCommandsById.yaml
new file mode 100644
index 0000000..a3aab26
--- /dev/null
+++ b/src/app/tests/suites/TestCommandsById.yaml
@@ -0,0 +1,104 @@
+# Copyright (c) 2023 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: Commands Tests
+
+config:
+ nodeId: 0x12344321
+ endpoint: 1
+ cluster: "Unit Testing"
+
+ UnsupportedCluster: 0xFFF11FFF
+ UnsupportedCommand: 0xFFF11FFF
+ UnsupportedEndPoint: 254
+
+ InvokeRequestMessage.Cluster: 0x00000006
+ InvokeRequestMessage.Command: 0x00000000
+ InvokeRequestMessage.EndPoint: 1
+ InvokeRequestMessage.Payload: {}
+
+tests:
+ - label: "Wait for the commissioned device to be retrieved"
+ cluster: "DelayCommands"
+ command: "WaitForCommissionee"
+ arguments:
+ values:
+ - name: "nodeId"
+ value: nodeId
+
+ - label:
+ "Invoke Request Message with a path that indicates a specific endpoint
+ that is unsupported"
+ cluster: "AnyCommands"
+ command: "CommandById"
+ endpoint: UnsupportedEndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: InvokeRequestMessage.Cluster
+ - name: "CommandId"
+ value: InvokeRequestMessage.Command
+ - name: "Payload"
+ value: InvokeRequestMessage.Payload
+ response:
+ error: UNSUPPORTED_ENDPOINT
+
+ - label:
+ "Invoke Request Message with a path that indicates a specific cluster
+ that is unsupported"
+ cluster: "AnyCommands"
+ command: "CommandById"
+ endpoint: InvokeRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: UnsupportedCluster
+ - name: "CommandId"
+ value: InvokeRequestMessage.Command
+ - name: "Payload"
+ value: InvokeRequestMessage.Payload
+ response:
+ error: UNSUPPORTED_CLUSTER
+
+ - label:
+ "Invoke Request Message with a path that indicates a specific command
+ that is unsupported"
+ cluster: "AnyCommands"
+ command: "CommandById"
+ endpoint: InvokeRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: InvokeRequestMessage.Cluster
+ - name: "CommandId"
+ value: UnsupportedCommand
+ - name: "Payload"
+ value: InvokeRequestMessage.Payload
+ response:
+ error: UNSUPPORTED_COMMAND
+
+ - label:
+ "Invoke Request Message with a valid path that indicates a specific
+ endpoint/cluster/command"
+ cluster: "AnyCommands"
+ command: "CommandById"
+ endpoint: InvokeRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: InvokeRequestMessage.Cluster
+ - name: "CommandId"
+ value: InvokeRequestMessage.Command
+ - name: "Payload"
+ value: InvokeRequestMessage.Payload
diff --git a/src/app/tests/suites/TestEventsById.yaml b/src/app/tests/suites/TestEventsById.yaml
new file mode 100644
index 0000000..29224f9
--- /dev/null
+++ b/src/app/tests/suites/TestEventsById.yaml
@@ -0,0 +1,264 @@
+# Copyright (c) 2023 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: Events Tests
+
+config:
+ nodeId: 0x12344321
+ endpoint: 1
+ cluster: "Unit Testing"
+
+ UnsupportedCluster: 0xFFF11FFF
+ UnsupportedEvent: 0xFFF11FFF
+ UnsupportedEndPoint: 254
+
+ ReadRequestMessage.Cluster: 0xFFF1FC05
+ ReadRequestMessage.Event: 0x0001
+ ReadRequestMessage.EndPoint: 1
+
+tests:
+ - label: "Wait for the commissioned device to be retrieved"
+ cluster: "DelayCommands"
+ command: "WaitForCommissionee"
+ arguments:
+ values:
+ - name: "nodeId"
+ value: nodeId
+
+ - label:
+ "Read Request Message with a path that indicates a specific endpoint
+ that is unsupported"
+ cluster: "AnyCommands"
+ command: "ReadEventById"
+ endpoint: UnsupportedEndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: ReadRequestMessage.Cluster
+ - name: "EventId"
+ value: ReadRequestMessage.Event
+ response: []
+
+ - label:
+ "Read Request Message with a path that indicates a specific cluster
+ that is unsupported"
+ cluster: "AnyCommands"
+ command: "ReadEventById"
+ endpoint: ReadRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: UnsupportedCluster
+ - name: "EventId"
+ value: ReadRequestMessage.Event
+ response: []
+
+ - label:
+ "Read Request Message with a path that indicates a specific endpoint
+ that is unsupported"
+ cluster: "AnyCommands"
+ command: "ReadEventById"
+ endpoint: ReadRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: ReadRequestMessage.Cluster
+ - name: "EventId"
+ value: UnsupportedEvent
+ response: []
+
+ - label:
+ "Read Request Message with a path that indicates an event with no
+ results"
+ cluster: "AnyCommands"
+ command: "ReadEventById"
+ endpoint: ReadRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: ReadRequestMessage.Cluster
+ - name: "EventId"
+ value: ReadRequestMessage.Event
+ response: []
+
+ - label: "Create an event on the accessory"
+ command: "TestEmitTestEventRequest"
+ endpoint: ReadRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "arg1"
+ value: 1
+ - name: "arg2"
+ value: 2
+ - name: "arg3"
+ value: true
+ response:
+ values:
+ - name: "value"
+ saveAs: eventNumber
+
+ - label: "Read the event back"
+ cluster: "AnyCommands"
+ command: "ReadEventById"
+ endpoint: ReadRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: ReadRequestMessage.Cluster
+ - name: "EventId"
+ value: ReadRequestMessage.Event
+ response:
+ value: { arg1: 1, arg2: 2, arg3: true }
+
+ - label: "Read the event with eventNumber set to the event value"
+ cluster: "AnyCommands"
+ command: "ReadEventById"
+ endpoint: ReadRequestMessage.EndPoint
+ eventNumber: eventNumber
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: ReadRequestMessage.Cluster
+ - name: "EventId"
+ value: ReadRequestMessage.Event
+ response:
+ value: { arg1: 1, arg2: 2, arg3: true }
+
+ - label: "Read the event with eventNumber set to the event value + 1"
+ cluster: "AnyCommands"
+ command: "ReadEventById"
+ endpoint: ReadRequestMessage.EndPoint
+ eventNumber: eventNumber + 1
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: ReadRequestMessage.Cluster
+ - name: "EventId"
+ value: ReadRequestMessage.Event
+ response: []
+
+ - label: "Generate a second event on the accessory"
+ command: "TestEmitTestEventRequest"
+ endpoint: ReadRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "arg1"
+ value: 3
+ - name: "arg2"
+ value: 1
+ - name: "arg3"
+ value: false
+ response:
+ values:
+ - name: "value"
+ value: eventNumber + 1
+
+ - label: "Read the event back"
+ cluster: "AnyCommands"
+ command: "ReadEventById"
+ endpoint: ReadRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: ReadRequestMessage.Cluster
+ - name: "EventId"
+ value: ReadRequestMessage.Event
+ response:
+ - values:
+ - value: { arg1: 1, arg2: 2, arg3: true }
+ - values:
+ - value: { arg1: 3, arg2: 1, arg3: false }
+
+ - label: "Subscribe to the event"
+ cluster: "AnyCommands"
+ command: "SubscribeEventById"
+ endpoint: ReadRequestMessage.EndPoint
+ minInterval: 3
+ maxInterval: 5
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: ReadRequestMessage.Cluster
+ - name: "EventId"
+ value: ReadRequestMessage.Event
+ response:
+ - values:
+ - value: { arg1: 1, arg2: 2, arg3: true }
+ - values:
+ - value: { arg1: 3, arg2: 1, arg3: false }
+
+ - label: "Generate a third event on the accessory"
+ command: "TestEmitTestEventRequest"
+ endpoint: ReadRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "arg1"
+ value: 4
+ - name: "arg2"
+ value: 3
+ - name: "arg3"
+ value: true
+ response:
+ values:
+ - name: "value"
+ value: eventNumber + 2
+
+ - label: "Check for event report"
+ command: "waitForReport"
+ event: "TestEvent"
+ endpoint: ReadRequestMessage.EndPoint
+ response:
+ values:
+ - name: "TestEvent"
+ value: { arg1: 4, arg2: 3, arg3: true }
+
+ - label:
+ "Read Request Message with a path that indicates a specific
+ endpoint/cluster and a wildcard event"
+ cluster: "AnyCommands"
+ command: "ReadEventById"
+ endpoint: ReadRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: ReadRequestMessage.Cluster
+ - name: "EventId"
+ value: "*"
+ response:
+ - values:
+ - value: { arg1: 1, arg2: 2, arg3: true }
+ - values:
+ - value: { arg1: 3, arg2: 1, arg3: false }
+ - values:
+ - value: { arg1: 4, arg2: 3, arg3: true }
+
+ - label:
+ "Read Request Message with a path that indicates a specific
+ endpoint/event and a wildcard cluster"
+ cluster: "AnyCommands"
+ command: "ReadEventById"
+ endpoint: ReadRequestMessage.EndPoint
+ arguments:
+ values:
+ - name: "ClusterId"
+ value: "*"
+ - name: "EventId"
+ value: ReadRequestMessage.EndPoint
+ response:
+ - values:
+ - value: { arg1: 1, arg2: 2, arg3: true }
+ - values:
+ - value: { arg1: 3, arg2: 1, arg3: false }
+ - values:
+ - value: { arg1: 4, arg2: 3, arg3: true }