Skip to content

Commit 4ab4495

Browse files
committed
Refactor Zigbee event mapping CDDL to reuse zigbee-property definition
1 parent 90684bd commit 4ab4495

4 files changed

Lines changed: 19 additions & 44 deletions

File tree

cddl/zigbee-event-map.cddl

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,15 @@ zigbee-event-map = zigbee-attribute-reporting / zigbee-write-event / zigbee-conn
66

77
zigbee-attribute-reporting = {
88
type: "attribute_reporting",
9-
endpointID: uint,
10-
clusterID: uint,
11-
attributeID: uint,
12-
attributeType: uint,
13-
? profileID: uint,
14-
? manufacturerCode: uint,
9+
~zigbee-property,
1510
? minReportingInterval: uint,
1611
? maxReportingInterval: uint,
1712
? reportableChange: number,
1813
}
1914

2015
zigbee-write-event = {
2116
type: "write_event",
22-
endpointID: uint,
23-
clusterID: uint,
24-
attributeID: uint,
25-
attributeType: uint,
26-
? profileID: uint,
27-
? manufacturerCode: uint,
17+
~zigbee-property,
2818
}
2919

3020
zigbee-connection-event = {

draft-ietf-asdf-sdf-protocol-mapping.md

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,9 @@ follows:
539539

540540
An `sdfEvent` is mapped to a Zigbee cluster event such as attribute reporting
541541
or a device-initiated write to an attribute on the gateway. The Zigbee event
542-
protocol mapping structure is defined as follows:
542+
protocol mapping structure is defined as follows. The `"attribute_reporting"`
543+
and `"write_event"` variants reuse the `zigbee-property` definition from
544+
{{zigmap1}} to identify the underlying Zigbee attribute:
543545

544546
~~~ cddl
545547
{::include-fold cddl/zigbee-event-map.cddl}
@@ -555,21 +557,10 @@ Where:
555557
attribute on the gateway.
556558
- `"connection_events"`: the event is triggered when a Zigbee end device
557559
joins or leaves the Zigbee network.
558-
- `endpointID` is the Zigbee endpoint ID that corresponds to the SDF event.
559-
It is required when `type` is `"attribute_reporting"` or `"write_event"`.
560-
- `clusterID` is the Zigbee cluster ID that corresponds to the SDF event.
561-
It is required when `type` is `"attribute_reporting"` or `"write_event"`.
562-
- `attributeID` is the Zigbee attribute ID that corresponds to the SDF event.
563-
It is required when `type` is `"attribute_reporting"` or `"write_event"`.
564-
- `attributeType` is the Zigbee data type of the attribute. It is required
565-
when `type` is `"attribute_reporting"` or `"write_event"`.
566-
- `profileID` is the Zigbee application profile ID (optional). It only
567-
applies when `type` is `"attribute_reporting"` or `"write_event"`. If not
568-
provided, it defaults to the Home Automation profile (0x0104), which is the
569-
default profile in Zigbee 3.0.
570-
- `manufacturerCode` is the Zigbee manufacturer code of the attribute
571-
(optional). It only applies when `type` is `"attribute_reporting"` or
572-
`"write_event"`.
560+
- `endpointID`, `clusterID`, `attributeID`, `attributeType`, `profileID`, and
561+
`manufacturerCode` have the same meaning as described for `sdfProperty` in
562+
{{zigmap1}}. These fields are present when `type` is `"attribute_reporting"`
563+
or `"write_event"`, and MUST be absent when `type` is `"connection_events"`.
573564
- `minReportingInterval` is the minimum reporting interval in seconds
574565
(optional). It is the minimum time between issued attribute reports and
575566
only applies when `type` is `"attribute_reporting"`.
@@ -578,10 +569,12 @@ Where:
578569
only applies when `type` is `"attribute_reporting"`.
579570
- `reportableChange` is the minimum change to the attribute value that triggers
580571
a report (optional). It only applies when `type` is `"attribute_reporting"`
581-
and to attributes with an 'analog' data type, and MUST have the same data type
582-
as the reported attribute.
583-
584-
When `type` is `"connection_events"`, no other attributes are required.
572+
and to attributes whose `attributeType` is one of the "analog" data types
573+
defined by the Zigbee Cluster Library, part of {{Zigbee30}} (e.g., unsigned
574+
and signed integers, floating point numbers), as opposed to "discrete" data types
575+
(e.g., booleans, enumerations, bitmaps), for which reporting a minimum
576+
change is not meaningful. The encoded value MUST use the same Zigbee data type
577+
as the reported attribute's `attributeType`.
585578

586579
For example, a Zigbee event mapping for a temperature change report:
587580

generated/combined.cddl

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,15 @@ zigbee-event-map = zigbee-attribute-reporting / zigbee-write-event / zigbee-conn
6464

6565
zigbee-attribute-reporting = {
6666
type: "attribute_reporting",
67-
endpointID: uint,
68-
clusterID: uint,
69-
attributeID: uint,
70-
attributeType: uint,
71-
? profileID: uint,
72-
? manufacturerCode: uint,
67+
~zigbee-property,
7368
? minReportingInterval: uint,
7469
? maxReportingInterval: uint,
7570
? reportableChange: number,
7671
}
7772

7873
zigbee-write-event = {
7974
type: "write_event",
80-
endpointID: uint,
81-
clusterID: uint,
82-
attributeID: uint,
83-
attributeType: uint,
84-
? profileID: uint,
85-
? manufacturerCode: uint,
75+
~zigbee-property,
8676
}
8777

8878
zigbee-connection-event = {

openapi/ProtocolMap-Zigbee.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ components:
5959
- endpointID
6060
- clusterID
6161
- attributeID
62+
- attributeType
6263
properties:
6364
type:
6465
type: string
@@ -105,6 +106,7 @@ components:
105106
- endpointID
106107
- clusterID
107108
- attributeID
109+
- attributeType
108110
properties:
109111
type:
110112
type: string

0 commit comments

Comments
 (0)