idnits 2.17.1
draft-ietf-core-senml-16.txt:
Checking boilerplate required by RFC 5378 and the IETF Trust (see
https://trustee.ietf.org/license-info):
----------------------------------------------------------------------------
No issues found here.
Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt:
----------------------------------------------------------------------------
No issues found here.
Checking nits according to https://www.ietf.org/id-info/checklist :
----------------------------------------------------------------------------
== There are 4 instances of lines with non-RFC2606-compliant FQDNs in the
document.
Miscellaneous warnings:
----------------------------------------------------------------------------
== The copyright year in the IETF Trust and authors Copyright Line does not
match the current year
-- The document date (May 18, 2018) is 2163 days in the past. Is this
intentional?
Checking references for intended status: Proposed Standard
----------------------------------------------------------------------------
(See RFCs 3967 and 4897 for information about using normative references
to lower-maturity documents in RFCs)
-- Possible downref: Non-RFC (?) normative reference: ref. 'BIPM'
-- Possible downref: Non-RFC (?) normative reference: ref. 'IEEE.754.1985'
-- Possible downref: Non-RFC (?) normative reference: ref. 'NIST811'
** Obsolete normative reference: RFC 7049 (Obsoleted by RFC 8949)
-- Possible downref: Non-RFC (?) normative reference: ref. 'RNC'
-- Possible downref: Non-RFC (?) normative reference: ref. 'XPointerElement'
-- Possible downref: Non-RFC (?) normative reference: ref.
'XPointerFramework'
== Outdated reference: A later version (-08) exists of
draft-ietf-cbor-cddl-02
== Outdated reference: A later version (-11) exists of
draft-ietf-core-dev-urn-01
== Outdated reference: A later version (-14) exists of
draft-ietf-core-interfaces-11
-- Obsolete informational reference (is this intentional?): RFC 2818
(Obsoleted by RFC 9110)
-- Obsolete informational reference (is this intentional?): RFC 5751
(Obsoleted by RFC 8551)
-- Obsolete informational reference (is this intentional?): RFC 7230
(Obsoleted by RFC 9110, RFC 9112)
Summary: 1 error (**), 0 flaws (~~), 5 warnings (==), 10 comments (--).
Run idnits with the --verbose option for more detailed information about
the items above.
--------------------------------------------------------------------------------
2 Network Working Group C. Jennings
3 Internet-Draft Cisco
4 Intended status: Standards Track Z. Shelby
5 Expires: November 19, 2018 ARM
6 J. Arkko
7 A. Keranen
8 Ericsson
9 C. Bormann
10 Universitaet Bremen TZI
11 May 18, 2018
13 Sensor Measurement Lists (SenML)
14 draft-ietf-core-senml-16
16 Abstract
18 This specification defines a format for representing simple sensor
19 measurements and device parameters in the Sensor Measurement Lists
20 (SenML). Representations are defined in JavaScript Object Notation
21 (JSON), Concise Binary Object Representation (CBOR), Extensible
22 Markup Language (XML), and Efficient XML Interchange (EXI), which
23 share the common SenML data model. A simple sensor, such as a
24 temperature sensor, could use one of these media types in protocols
25 such as HTTP or CoAP to transport the measurements of the sensor or
26 to be configured.
28 Status of This Memo
30 This Internet-Draft is submitted in full conformance with the
31 provisions of BCP 78 and BCP 79.
33 Internet-Drafts are working documents of the Internet Engineering
34 Task Force (IETF). Note that other groups may also distribute
35 working documents as Internet-Drafts. The list of current Internet-
36 Drafts is at https://datatracker.ietf.org/drafts/current/.
38 Internet-Drafts are draft documents valid for a maximum of six months
39 and may be updated, replaced, or obsoleted by other documents at any
40 time. It is inappropriate to use Internet-Drafts as reference
41 material or to cite them other than as "work in progress."
43 This Internet-Draft will expire on November 19, 2018.
45 Copyright Notice
47 Copyright (c) 2018 IETF Trust and the persons identified as the
48 document authors. All rights reserved.
50 This document is subject to BCP 78 and the IETF Trust's Legal
51 Provisions Relating to IETF Documents
52 (https://trustee.ietf.org/license-info) in effect on the date of
53 publication of this document. Please review these documents
54 carefully, as they describe your rights and restrictions with respect
55 to this document. Code Components extracted from this document must
56 include Simplified BSD License text as described in Section 4.e of
57 the Trust Legal Provisions and are provided without warranty as
58 described in the Simplified BSD License.
60 Table of Contents
62 1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 3
63 2. Requirements and Design Goals . . . . . . . . . . . . . . . . 4
64 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5
65 4. SenML Structure and Semantics . . . . . . . . . . . . . . . . 6
66 4.1. Base Fields . . . . . . . . . . . . . . . . . . . . . . . 6
67 4.2. Regular Fields . . . . . . . . . . . . . . . . . . . . . 7
68 4.3. SenML Labels . . . . . . . . . . . . . . . . . . . . . . 8
69 4.4. Extensibility . . . . . . . . . . . . . . . . . . . . . . 8
70 4.5. Records and Their Fields . . . . . . . . . . . . . . . . 9
71 4.5.1. Names . . . . . . . . . . . . . . . . . . . . . . . . 9
72 4.5.2. Units . . . . . . . . . . . . . . . . . . . . . . . . 9
73 4.5.3. Time . . . . . . . . . . . . . . . . . . . . . . . . 10
74 4.5.4. Values . . . . . . . . . . . . . . . . . . . . . . . 11
75 4.6. Resolved Records . . . . . . . . . . . . . . . . . . . . 11
76 4.7. Associating Meta-data . . . . . . . . . . . . . . . . . . 12
77 4.8. Sensor Streaming Measurement Lists (SensML) . . . . . . . 12
78 4.9. Configuration and Actuation usage . . . . . . . . . . . . 12
79 5. JSON Representation (application/senml+json) . . . . . . . . 13
80 5.1. Examples . . . . . . . . . . . . . . . . . . . . . . . . 14
81 5.1.1. Single Datapoint . . . . . . . . . . . . . . . . . . 14
82 5.1.2. Multiple Datapoints . . . . . . . . . . . . . . . . . 14
83 5.1.3. Multiple Measurements . . . . . . . . . . . . . . . . 15
84 5.1.4. Resolved Data . . . . . . . . . . . . . . . . . . . . 16
85 5.1.5. Multiple Data Types . . . . . . . . . . . . . . . . . 17
86 5.1.6. Collection of Resources . . . . . . . . . . . . . . . 17
87 5.1.7. Setting an Actuator . . . . . . . . . . . . . . . . . 17
88 6. CBOR Representation (application/senml+cbor) . . . . . . . . 18
89 7. XML Representation (application/senml+xml) . . . . . . . . . 20
90 8. EXI Representation (application/senml-exi) . . . . . . . . . 22
91 9. Fragment Identification Methods . . . . . . . . . . . . . . . 25
92 9.1. Fragment Identification Examples . . . . . . . . . . . . 25
93 9.2. Fragment Identification for the XML and EXI Formats . . . 26
94 10. Usage Considerations . . . . . . . . . . . . . . . . . . . . 26
95 11. CDDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
96 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 29
97 12.1. Units Registry . . . . . . . . . . . . . . . . . . . . . 29
98 12.2. SenML Label Registry . . . . . . . . . . . . . . . . . . 33
99 12.3. Media Type Registrations . . . . . . . . . . . . . . . . 34
100 12.3.1. senml+json Media Type Registration . . . . . . . . . 35
101 12.3.2. sensml+json Media Type Registration . . . . . . . . 36
102 12.3.3. senml+cbor Media Type Registration . . . . . . . . . 37
103 12.3.4. sensml+cbor Media Type Registration . . . . . . . . 38
104 12.3.5. senml+xml Media Type Registration . . . . . . . . . 39
105 12.3.6. sensml+xml Media Type Registration . . . . . . . . . 41
106 12.3.7. senml-exi Media Type Registration . . . . . . . . . 42
107 12.3.8. sensml-exi Media Type Registration . . . . . . . . . 43
108 12.4. XML Namespace Registration . . . . . . . . . . . . . . . 44
109 12.5. CoAP Content-Format Registration . . . . . . . . . . . . 44
110 13. Security Considerations . . . . . . . . . . . . . . . . . . . 45
111 14. Privacy Considerations . . . . . . . . . . . . . . . . . . . 46
112 15. Acknowledgement . . . . . . . . . . . . . . . . . . . . . . . 46
113 16. References . . . . . . . . . . . . . . . . . . . . . . . . . 46
114 16.1. Normative References . . . . . . . . . . . . . . . . . . 46
115 16.2. Informative References . . . . . . . . . . . . . . . . . 49
116 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 51
118 1. Overview
120 Connecting sensors to the Internet is not new, and there have been
121 many protocols designed to facilitate it. This specification defines
122 a format and media types for carrying simple sensor information in a
123 protocol such as HTTP [RFC7230] or CoAP [RFC7252]. The SenML format
124 is designed so that processors with very limited capabilities could
125 easily encode a sensor measurement into the media type, while at the
126 same time a server parsing the data could relatively efficiently
127 collect a large number of sensor measurements. SenML can be used for
128 a variety of data flow models, most notably data feeds pushed from a
129 sensor to a collector, and the web resource model where the sensor is
130 requested as a resource representation (e.g., "GET /sensor/
131 temperature").
133 There are many types of more complex measurements and measurements
134 that this media type would not be suitable for. SenML strikes a
135 balance between having some information about the sensor carried with
136 the sensor data so that the data is self describing but it also tries
137 to make that a fairly minimal set of auxiliary information for
138 efficiency reason. Other information about the sensor can be
139 discovered by other methods such as using the CoRE Link Format
140 [RFC6690].
142 SenML is defined by a data model for measurements and simple meta-
143 data about measurements and devices. The data is structured as a
144 single array that contains a series of SenML Records which can each
145 contain fields such as an unique identifier for the sensor, the time
146 the measurement was made, the unit the measurement is in, and the
147 current value of the sensor. Serializations for this data model are
148 defined for JSON [RFC8259], CBOR [RFC7049], XML
149 [W3C.REC-xml-20081126], and Efficient XML Interchange (EXI)
150 [W3C.REC-exi-20140211].
152 For example, the following shows a measurement from a temperature
153 gauge encoded in the JSON syntax.
155 [
156 {"n":"urn:dev:ow:10e2073a01080063","u":"Cel","v":23.1}
157 ]
159 In the example above, the array has a single SenML Record with a
160 measurement for a sensor named "urn:dev:ow:10e2073a01080063" with a
161 current value of 23.1 degrees Celsius.
163 2. Requirements and Design Goals
165 The design goal is to be able to send simple sensor measurements in
166 small packets from large numbers of constrained devices. Keeping the
167 total size of payload small makes it easy to use SenML also in
168 constrained networks, e.g., in a 6LoWPAN [RFC4944]. It is always
169 difficult to define what small code is, but there is a desire to be
170 able to implement this in roughly 1 KB of flash on a 8 bit
171 microprocessor. Experience with power meters and other large scale
172 deployments has indicated that the solution needs to support allowing
173 multiple measurements to be batched into a single HTTP or CoAP
174 request. This "batch" upload capability allows the server side to
175 efficiently support a large number of devices. It also conveniently
176 supports batch transfers from proxies and storage devices, even in
177 situations where the sensor itself sends just a single data item at a
178 time. The multiple measurements could be from multiple related
179 sensors or from the same sensor but at different times.
181 The basic design is an array with a series of measurements. The
182 following example shows two measurements made at different times.
183 The value of a measurement is given by the "v" field, the time of a
184 measurement is in the "t" field, the "n" field has a unique sensor
185 name, and the unit of the measurement is carried in the "u" field.
187 [
188 {"n":"urn:dev:ow:10e2073a01080063","u":"Cel","t":1.276020076e+09,
189 "v":23.5},
190 {"n":"urn:dev:ow:10e2073a01080063","u":"Cel","t":1.276020091e+09,
191 "v":23.6}
192 ]
194 To keep the messages small, it does not make sense to repeat the "n"
195 field in each SenML Record so there is a concept of a Base Name which
196 is simply a string that is prepended to the Name field of all
197 elements in that record and any records that follow it. So a more
198 compact form of the example above is the following.
200 [
201 {"bn":"urn:dev:ow:10e2073a01080063","u":"Cel","t":1.276020076e+09,
202 "v":23.5},
203 {"u":"Cel","t":1.276020091e+09,
204 "v":23.6}
205 ]
207 In the above example the Base Name is in the "bn" field and the "n"
208 fields in each Record are the empty string so they are omitted.
210 Some devices have accurate time while others do not so SenML supports
211 absolute and relative times. Time is represented in floating point
212 as seconds. Values greater than or equal to 2**28 represent an
213 absolute time relative to the Unix epoch. Values less than 2**28
214 represent time relative to the current time.
216 A simple sensor with no absolute wall clock time might take a
217 measurement every second, batch up 60 of them, and then send the
218 batch to a server. It would include the relative time each
219 measurement was made compared to the time the batch was sent in each
220 SenML Record. The server might have accurate NTP time and use the
221 time it received the data, and the relative offset, to replace the
222 times in the SenML with absolute times before saving the SenML
223 information in a document database.
225 3. Terminology
227 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
228 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
229 "OPTIONAL" in this document are to be interpreted as described in BCP
230 14 [RFC2119] [RFC8174] when, and only when, they appear in all
231 capitals, as shown here.
233 This document also uses the following terms:
235 SenML Record: One measurement or configuration instance in time
236 presented using the SenML data model.
238 SenML Pack: One or more SenML Records in an array structure.
240 SenML Label: A short name used in SenML Records to denote different
241 SenML fields (e.g., "v" for "value").
243 SenML Field: A component of a record that associates a value to a
244 SenML Label for this record.
246 SensML: Sensor Streaming Measurement List (see Section 4.8).
248 SensML Stream: One or more SenML Records to be processed as a
249 stream.
251 This document uses the terms "attribute" and "tag" where they occur
252 with the underlying technologies (XML, CBOR [RFC7049], and Link
253 Format [RFC6690]), not for SenML concepts per se. Note that
254 "attribute" has been widely used previously as a synonym for SenML
255 "field", though.
257 All comparisons of text strings are performed byte-by-byte (and
258 therefore necessarily case-sensitive).
260 Where arithmetic is used, this specification uses the notation
261 familiar from the programming language C, except that the operator
262 "**" stands for exponentiation.
264 4. SenML Structure and Semantics
266 Each SenML Pack carries a single array that represents a set of
267 measurements and/or parameters. This array contains a series of
268 SenML Records with several fields described below. There are two
269 kinds of fields: base and regular. Both the base fields and the
270 regular fields can be included in any SenML Record. The base fields
271 apply to the entries in the Record and also to all Records after it
272 up to, but not including, the next Record that has that same base
273 field. All base fields are optional. Regular fields can be included
274 in any SenML Record and apply only to that Record.
276 4.1. Base Fields
278 Base Name: This is a string that is prepended to the names found in
279 the entries.
281 Base Time: A base time that is added to the time found in an entry.
283 Base Unit: A base unit that is assumed for all entries, unless
284 otherwise indicated. If a record does not contain a Unit value,
285 then the Base Unit is used. Otherwise the value found in the Unit
286 (if any) is used.
288 Base Value: A base value is added to the value found in an entry,
289 similar to Base Time.
291 Base Sum: A base sum is added to the sum found in an entry, similar
292 to Base Time.
294 Version: Version number of media type format. This field is an
295 optional positive integer and defaults to 5 if not present. [RFC
296 Editor: change the default value to 10 when this specification is
297 published as an RFC and remove this note]
299 4.2. Regular Fields
301 Name: Name of the sensor or parameter. When appended to the Base
302 Name field, this must result in a globally unique identifier for
303 the resource. The name is optional, if the Base Name is present.
304 If the name is missing, Base Name must uniquely identify the
305 resource. This can be used to represent a large array of
306 measurements from the same sensor without having to repeat its
307 identifier on every measurement.
309 Unit: Unit for a measurement value. Optional.
311 Value: Value of the entry. Optional if a Sum value is present,
312 otherwise required. Values are represented using basic data
313 types. This specification defines floating point numbers ("v"
314 field for "Value"), booleans ("vb" for "Boolean Value"), strings
315 ("vs" for "String Value") and binary data ("vd" for "Data Value").
316 Exactly one value field MUST appear unless there is Sum field in
317 which case it is allowed to have no Value field.
319 Sum: Integrated sum of the values over time. Optional. This field
320 is in the unit specified in the Unit value multiplied by seconds.
321 For historical reason it is named sum instead of integral.
323 Time: Time when value was recorded. Optional.
325 Update Time: Period of time in seconds that represents the maximum
326 time before this sensor will provide an updated reading for a
327 measurement. Optional. This can be used to detect the failure of
328 sensors or communications path from the sensor.
330 4.3. SenML Labels
332 Table 1 provides an overview of all SenML fields defined by this
333 document with their respective labels and data types.
335 +---------------+-------+------------+------------+------------+
336 | Name | Label | CBOR Label | JSON Type | XML Type |
337 +---------------+-------+------------+------------+------------+
338 | Base Name | bn | -2 | String | string |
339 | Base Time | bt | -3 | Number | double |
340 | Base Unit | bu | -4 | String | string |
341 | Base Value | bv | -5 | Number | double |
342 | Base Sum | bs | -6 | Number | double |
343 | Version | bver | -1 | Number | int |
344 | Name | n | 0 | String | string |
345 | Unit | u | 1 | String | string |
346 | Value | v | 2 | Number | double |
347 | String Value | vs | 3 | String | string |
348 | Boolean Value | vb | 4 | Boolean | boolean |
349 | Data Value | vd | 8 | String (*) | string (*) |
350 | Value Sum | s | 5 | Number | double |
351 | Time | t | 6 | Number | double |
352 | Update Time | ut | 7 | Number | double |
353 +---------------+-------+------------+------------+------------+
355 Table 1: SenML Labels
357 (*) Data Value is base64 encoded string with URL safe alphabet as
358 defined in Section 5 of [RFC4648], with padding omitted.
360 For details of the JSON representation see Section 5, for the CBOR
361 Section 6, and for the XML Section 7.
363 4.4. Extensibility
365 The SenML format can be extended with further custom fields. Both
366 new base and regular fields are allowed. See Section 12.2 for
367 details. Implementations MUST ignore fields they don't recognize
368 unless that field has a label name that ends with the '_' character
369 in which case an error MUST be generated.
371 All SenML Records in a Pack MUST have the same version number. This
372 is typically done by adding a Base Version field to only the first
373 Record in the Pack, or by using the default value.
375 Systems reading one of the objects MUST check for the Version field.
376 If this value is a version number larger than the version which the
377 system understands, the system MUST NOT use this object. This allows
378 the version number to indicate that the object contains structure or
379 semantics that is different from what is defined in the present
380 document beyond just making use of the extension points provided
381 here. New version numbers can only be defined in an RFC that updates
382 this specification or it successors.
384 4.5. Records and Their Fields
386 4.5.1. Names
388 The Name value is concatenated to the Base Name value to yield the
389 name of the sensor. The resulting concatenated name needs to
390 uniquely identify and differentiate the sensor from all others. The
391 concatenated name MUST consist only of characters out of the set "A"
392 to "Z", "a" to "z", "0" to "9", "-", ":", ".", "/", and "_";
393 furthermore, it MUST start with a character out of the set "A" to
394 "Z", "a" to "z", or "0" to "9". This restricted character set was
395 chosen so that concatenated names can be used directly within various
396 URI schemes (including segments of an HTTP path with no special
397 encoding; note that a name that contains "/" characters maps into
398 multiple URI path segments) and can be used directly in many
399 databases and analytic systems. [RFC5952] contains advice on
400 encoding an IPv6 address in a name. See Section 14 for privacy
401 considerations that apply to the use of long-term stable unique
402 identifiers.
404 Although it is RECOMMENDED that concatenated names are represented as
405 URIs [RFC3986] or URNs [RFC8141], the restricted character set
406 specified above puts strict limits on the URI schemes and URN
407 namespaces that can be used. As a result, implementers need to take
408 care in choosing the naming scheme for concatenated names, because
409 such names both need to be unique and need to conform to the
410 restricted character set. One approach is to include a bit string
411 that has guaranteed uniqueness (such as a 1-wire address [AN1796]).
412 Some of the examples within this document use the device URN
413 namespace as specified in [I-D.ietf-core-dev-urn]. UUIDs [RFC4122]
414 are another way to generate a unique name. However, the restricted
415 character set does not allow the use of many URI schemes, such as the
416 'tag' scheme [RFC4151] and the 'ni' scheme [RFC6920], in names as
417 such. The use of URIs with characters incompatible with this set,
418 and possible mapping rules between the two, are outside of the scope
419 of the present document.
421 4.5.2. Units
423 If the Record has no Unit, the Base Unit is used as the Unit. Having
424 no Unit and no Base Unit is allowed; any information that may be
425 required about units applicable to the value then needs to be
426 provided by the application context.
428 4.5.3. Time
430 If either the Base Time or Time value is missing, the missing field
431 is considered to have a value of zero. The Base Time and Time values
432 are added together to get the time of measurement.
434 Values less than 268,435,456 (2**28) represent time relative to the
435 current time. That is, a time of zero indicates that the sensor does
436 not know the absolute time and the measurement was made roughly
437 "now". A negative value indicates seconds in the past from roughly
438 "now". Positive values up to 2**28 indicate seconds in the future
439 from "now". Positive values can be used, e.g., for actuation use
440 when the desired change should happen in the future but the sender or
441 the receiver does not have accurate time available.
443 Values greater than or equal to 2**28 represent an absolute time
444 relative to the Unix epoch (1970-01-01T00:00Z in UTC time) and the
445 time is counted same way as the Portable Operating System Interface
446 (POSIX) "seconds since the epoch" [TIME_T]. Therefore the smallest
447 absolute time value that can be expressed (2**28) is 1978-07-04
448 21:24:16 UTC.
450 Because time values up to 2**28 are used for presenting time relative
451 to "now" and Time and Base Time are added together, care must be
452 taken to ensure that the sum does not inadvertently reach 2**28
453 (i.e., absolute time) when relative time was intended to be used.
455 Obviously, "now"-referenced SenML records are only useful within a
456 specific communication context (e.g., based on information on when
457 the SenML pack, or a specific record in a SensML stream, was sent) or
458 together with some other context information that can be used for
459 deriving a meaning of "now"; the expectation for any archival use is
460 that they will be processed into UTC-referenced records before that
461 context would cease to be available. This specification deliberately
462 leaves the accuracy of "now" very vague as it is determined by the
463 overall systems that use SenML. In a system where a sensor without
464 wall-clock time sends a SenML record with a "now"-referenced time
465 over a high speed RS 485 link to an embedded system with accurate
466 time that resolves "now" based on the time of reception, the
467 resulting time uncertainty could be within 1 ms. At the other
468 extreme, a deployment that sends SenML wind speed readings over a LEO
469 satellite link from a mountain valley might have resulting reception
470 time values that are easily a dozen minutes off the actual time of
471 the sensor reading, with the time uncertainty depending on satellite
472 locations and conditions.
474 4.5.4. Values
476 If only one of the Base Sum or Sum value is present, the missing
477 field is considered to have a value of zero. The Base Sum and Sum
478 values are added together to get the sum of measurement. If neither
479 the Base Sum or Sum are present, then the measurement does not have a
480 sum value.
482 If the Base Value or Value is not present, the missing field(s) are
483 considered to have a value of zero. The Base Value and Value are
484 added together to get the value of the measurement.
486 Representing the statistical characteristics of measurements, such as
487 accuracy, can be very complex. Future specification may add new
488 fields to provide better information about the statistical properties
489 of the measurement.
491 In summary, the structure of a SenML record is laid out to support a
492 single measurement per record. If multiple data values are measured
493 at the same time (e.g., air pressure and altitude), they are best
494 kept as separate records linked through their Time value; this is
495 even true where one of the data values is more "meta" than others
496 (e.g., describes a condition that influences other measurements at
497 the same time).
499 4.6. Resolved Records
501 Sometimes it is useful to be able to refer to a defined normalized
502 format for SenML records. This normalized format tends to get used
503 for big data applications and intermediate forms when converting to
504 other formats. Also, if SenML Records are used outside of a SenML
505 Pack, they need to be resolved first to ensure applicable base values
506 are applied.
508 A SenML Record is referred to as "resolved" if it does not contain
509 any base values, i.e., labels starting with the character 'b', except
510 for Version fields (see below), and has no relative times. To
511 resolve the Records, the applicable base values of the SenML Pack (if
512 any) are applied to the Record. That is, for the base values in the
513 Record or before the Record in the Pack, name and base name are
514 concatenated, base time is added to the time of the Record, if the
515 Record did not contain Unit the Base Unit is applied to the record,
516 etc. In addition the records need to be in chronological order in
517 the Pack. An example of this is shown in Section 5.1.4.
519 The Version field MUST NOT be present in resolved records if the
520 SenML version defined in this document is used and MUST be present
521 otherwise in all the resolved SenML Records.
523 Future specification that defines new base fields need to specify how
524 the field is resolved.
526 4.7. Associating Meta-data
528 SenML is designed to carry the minimum dynamic information about
529 measurements, and for efficiency reasons does not carry significant
530 static meta-data about the device, object or sensors. Instead, it is
531 assumed that this meta-data is carried out of band. For web
532 resources using SenML Packs, this meta-data can be made available
533 using the CoRE Link Format [RFC6690]. The most obvious use of this
534 link format is to describe that a resource is available in a SenML
535 format in the first place. The relevant media type indicator is
536 included in the Content-Type (ct=) link attribute (which is defined
537 for the Link Format in Section 7.2.1 of [RFC7252]).
539 4.8. Sensor Streaming Measurement Lists (SensML)
541 In some usage scenarios of SenML, the implementations store or
542 transmit SenML in a stream-like fashion, where data is collected over
543 time and continuously added to the object. This mode of operation is
544 optional, but systems or protocols using SenML in this fashion MUST
545 specify that they are doing this. SenML defines separate media types
546 to indicate Sensor Streaming Measurement Lists (SensML) for this
547 usage (see Section 12.3.2). In this situation, the SensML stream can
548 be sent and received in a partial fashion, i.e., a measurement entry
549 can be read as soon as the SenML Record is received and does not have
550 to wait for the full SensML Stream to be complete.
552 If times relative to "now" (see Section 4.5.3) are used in SenML
553 Records of a SensML stream, their interpretation of "now" is based on
554 the time when the specific Record is sent in the stream.
556 4.9. Configuration and Actuation usage
558 SenML can also be used for configuring parameters and controlling
559 actuators. When a SenML Pack is sent (e.g., using a HTTP/CoAP POST
560 or PUT method) and the semantics of the target are such that SenML is
561 interpreted as configuration/actuation, SenML Records are interpreted
562 as a request to change the values of given (sub)resources (given as
563 names) to given values at the given time(s). The semantics of the
564 target resource supporting this usage can be described, e.g., using
565 [I-D.ietf-core-interfaces]. Examples of actuation usage are shown in
566 Section 5.1.7.
568 5. JSON Representation (application/senml+json)
570 For the SenML fields shown in Table 2, the SenML labels are used as
571 the JSON object member names within JSON objects representing the
572 JSON SenML Records.
574 +---------------+-------+---------+
575 | Name | label | Type |
576 +---------------+-------+---------+
577 | Base Name | bn | String |
578 | Base Time | bt | Number |
579 | Base Unit | bu | String |
580 | Base Value | bv | Number |
581 | Base Sum | bs | Number |
582 | Version | bver | Number |
583 | Name | n | String |
584 | Unit | u | String |
585 | Value | v | Number |
586 | String Value | vs | String |
587 | Boolean Value | vb | Boolean |
588 | Data Value | vd | String |
589 | Value Sum | s | Number |
590 | Time | t | Number |
591 | Update Time | ut | Number |
592 +---------------+-------+---------+
594 Table 2: JSON SenML Labels
596 The root JSON value consists of an array with one JSON object for
597 each SenML Record. All the fields in the above table MAY occur in
598 the records with member values of the type specified in the table.
600 Only the UTF-8 [RFC3629] form of JSON is allowed. Characters in the
601 String Value are encoded using the escape sequences defined in
602 [RFC8259]. Octets in the Data Value are base64 encoded with URL safe
603 alphabet as defined in Section 5 of [RFC4648], with padding omitted.
605 Systems receiving measurements MUST be able to process the range of
606 floating point numbers that are representable as an IEEE double
607 precision floating point numbers [IEEE.754.1985]. This allows time
608 values to have better than microsecond precision over the next 100
609 years. The number of significant digits in any measurement is not
610 relevant, so a reading of 1.1 has exactly the same semantic meaning
611 as 1.10. If the value has an exponent, the "e" MUST be in lower
612 case. In the interest of avoiding unnecessary verbosity and speeding
613 up processing, the mantissa SHOULD be less than 19 characters long
614 and the exponent SHOULD be less than 5 characters long.
616 5.1. Examples
618 5.1.1. Single Datapoint
620 The following shows a temperature reading taken approximately "now"
621 by a 1-wire sensor device that was assigned the unique 1-wire address
622 of 10e2073a01080063:
624 [
625 {"n":"urn:dev:ow:10e2073a01080063","u":"Cel","v":23.1}
626 ]
628 5.1.2. Multiple Datapoints
630 The following example shows voltage and current now, i.e., at an
631 unspecified time.
633 [
634 {"bn":"urn:dev:ow:10e2073a01080063:","n":"voltage","u":"V","v":120.1},
635 {"n":"current","u":"A","v":1.2}
636 ]
638 The next example is similar to the above one, but shows current at
639 Tue Jun 8 18:01:16.001 UTC 2010 and at each second for the previous 5
640 seconds.
642 [
643 {"bn":"urn:dev:ow:10e2073a0108006:","bt":1.276020076001e+09,
644 "bu":"A","bver":5,
645 "n":"voltage","u":"V","v":120.1},
646 {"n":"current","t":-5,"v":1.2},
647 {"n":"current","t":-4,"v":1.3},
648 {"n":"current","t":-3,"v":1.4},
649 {"n":"current","t":-2,"v":1.5},
650 {"n":"current","t":-1,"v":1.6},
651 {"n":"current","v":1.7}
652 ]
654 As an example of Sensor Streaming Measurement Lists (SensML), the
655 following stream of measurements may be sent via a long lived HTTP
656 POST from the producer of the stream to its consumer, and each
657 measurement object may be reported at the time it was measured:
659 [
660 {"bn":"urn:dev:ow:10e2073a01080063","bt":1.320067464e+09,
661 "bu":"%RH","v":21.2},
662 {"t":10,"v":21.3},
663 {"t":20,"v":21.4},
664 {"t":30,"v":21.4},
665 {"t":40,"v":21.5},
666 {"t":50,"v":21.5},
667 {"t":60,"v":21.5},
668 {"t":70,"v":21.6},
669 {"t":80,"v":21.7},
670 ...
672 5.1.3. Multiple Measurements
674 The following example shows humidity measurements from a mobile
675 device with a 1-wire address 10e2073a01080063, starting at Mon Oct 31
676 13:24:24 UTC 2011. The device also provides position data, which is
677 provided in the same measurement or parameter array as separate
678 entries. Note time is used to for correlating data that belongs
679 together, e.g., a measurement and a parameter associated with it.
680 Finally, the device also reports extra data about its battery status
681 at a separate time.
683 [
684 {"bn":"urn:dev:ow:10e2073a01080063","bt":1.320067464e+09,
685 "bu":"%RH","v":20},
686 {"u":"lon","v":24.30621},
687 {"u":"lat","v":60.07965},
688 {"t":60,"v":20.3},
689 {"u":"lon","t":60,"v":24.30622},
690 {"u":"lat","t":60,"v":60.07965},
691 {"t":120,"v":20.7},
692 {"u":"lon","t":120,"v":24.30623},
693 {"u":"lat","t":120,"v":60.07966},
694 {"u":"%EL","t":150,"v":98},
695 {"t":180,"v":21.2},
696 {"u":"lon","t":180,"v":24.30628},
697 {"u":"lat","t":180,"v":60.07967}
698 ]
700 The size of this example represented in various forms, as well as
701 that form compressed with gzip is given in the following table.
703 +----------+------+-----------------+
704 | Encoding | Size | Compressed Size |
705 +----------+------+-----------------+
706 | JSON | 573 | 206 |
707 | XML | 649 | 235 |
708 | CBOR | 254 | 196 |
709 | EXI | 161 | 184 |
710 +----------+------+-----------------+
712 Table 3: Size Comparisons
714 5.1.4. Resolved Data
716 The following shows the example from the previous section show in
717 resolved format.
719 [
720 {"n":"urn:dev:ow:10e2073a01080063","u":"%RH","t":1.320067464e+09,
721 "v":20},
722 {"n":"urn:dev:ow:10e2073a01080063","u":"lon","t":1.320067464e+09,
723 "v":24.30621},
724 {"n":"urn:dev:ow:10e2073a01080063","u":"lat","t":1.320067464e+09,
725 "v":60.07965},
726 {"n":"urn:dev:ow:10e2073a01080063","u":"%RH","t":1.320067524e+09,
727 "v":20.3},
728 {"n":"urn:dev:ow:10e2073a01080063","u":"lon","t":1.320067524e+09,
729 "v":24.30622},
730 {"n":"urn:dev:ow:10e2073a01080063","u":"lat","t":1.320067524e+09,
731 "v":60.07965},
732 {"n":"urn:dev:ow:10e2073a01080063","u":"%RH","t":1.320067584e+09,
733 "v":20.7},
734 {"n":"urn:dev:ow:10e2073a01080063","u":"lon","t":1.320067584e+09,
735 "v":24.30623},
736 {"n":"urn:dev:ow:10e2073a01080063","u":"lat","t":1.320067584e+09,
737 "v":60.07966},
738 {"n":"urn:dev:ow:10e2073a01080063","u":"%EL","t":1.320067614e+09,
739 "v":98},
740 {"n":"urn:dev:ow:10e2073a01080063","u":"%RH","t":1.320067644e+09,
741 "v":21.2},
742 {"n":"urn:dev:ow:10e2073a01080063","u":"lon","t":1.320067644e+09,
743 "v":24.30628},
744 {"n":"urn:dev:ow:10e2073a01080063","u":"lat","t":1.320067644e+09,
745 "v":60.07967}
746 ]
748 5.1.5. Multiple Data Types
750 The following example shows a sensor that returns different data
751 types.
753 [
754 {"bn":"urn:dev:ow:10e2073a01080063:","n":"temp","u":"Cel","v":23.1},
755 {"n":"label","vs":"Machine Room"},
756 {"n":"open","vb":false},
757 {"n":"nfv-reader","vd":"aGkgCg"}
758 ]
760 5.1.6. Collection of Resources
762 The following example shows the results from a query to one device
763 that aggregates multiple measurements from other devices. The
764 example assumes that a client has fetched information from a device
765 at 2001:db8::2 by performing a GET operation on http://[2001:db8::2]
766 at Mon Oct 31 16:27:09 UTC 2011, and has gotten two separate values
767 as a result, a temperature and humidity measurement as well as the
768 results from another device at http://[2001:db8::1] that also had a
769 temperature and humidity. Note that the last record would use the
770 Base Name from the 3rd record but the Base Time from the first
771 record.
773 [
774 {"bn":"2001:db8::2/","bt":1.320078429e+09,
775 "n":"temperature","u":"Cel","v":25.2},
776 {"n":"humidity","u":"%RH","v":30},
777 {"bn":"2001:db8::1/","n":"temperature","u":"Cel","v":12.3},
778 {"n":"humidity","u":"%RH","v":67}
779 ]
781 5.1.7. Setting an Actuator
783 The following example show the SenML that could be used to set the
784 current set point of a typical residential thermostat which has a
785 temperature set point, a switch to turn on and off the heat, and a
786 switch to turn on the fan override.
788 [
789 {"bn":"urn:dev:ow:10e2073a01080063:"},
790 {"n":"temp","u":"Cel","v":23.1},
791 {"n":"heat","u":"/","v":1},
792 {"n":"fan","u":"/","v":0}
793 ]
794 In the following example two different lights are turned on. It is
795 assumed that the lights are on a network that can guarantee delivery
796 of the messages to the two lights within 15 ms (e.g. a network using
797 802.1BA [IEEE802.1ba-2011] and 802.1AS [IEEE802.1as-2011] for time
798 synchronization). The controller has set the time of the lights
799 coming on to 20 ms in the future from the current time. This allows
800 both lights to receive the message, wait till that time, then apply
801 the switch command so that both lights come on at the same time.
803 [
804 {"bt":1.320078429e+09,"bu":"/","n":"2001:db8::3","v":1},
805 {"n":"2001:db8::4","v":1}
806 ]
808 The following shows two lights being turned off using a non
809 deterministic network that has a high odds of delivering a message in
810 less than 100 ms and uses NTP for time synchronization. The current
811 time is 1320078429. The user has just turned off a light switch
812 which is turning off two lights. Both lights are dimmed to 50%
813 brightness immediately to give the user instant feedback that
814 something is changing. However given the network, the lights will
815 probably dim at somewhat different times. Then 100 ms in the future,
816 both lights will go off at the same time. The instant but not
817 synchronized dimming gives the user the sensation of quick responses
818 and the timed off 100 ms in the future gives the perception of both
819 lights going off at the same time.
821 [
822 {"bt":1.320078429e+09,"bu":"/","n":"2001:db8::3","v":0.5},
823 {"n":"2001:db8::4","v":0.5},
824 {"n":"2001:db8::3","t":0.1,"v":0},
825 {"n":"2001:db8::4","t":0.1,"v":0}
826 ]
828 6. CBOR Representation (application/senml+cbor)
830 The CBOR [RFC7049] representation is equivalent to the JSON
831 representation, with the following changes:
833 o For JSON Numbers, the CBOR representation can use integers,
834 floating point numbers, or decimal fractions (CBOR Tag 4); however
835 a representation SHOULD be chosen such that when the CBOR value is
836 converted back to an IEEE double precision floating point value,
837 it has exactly the same value as the original Number. For the
838 version number, only an unsigned integer is allowed.
840 o Characters in the String Value are encoded using a definite length
841 text string (type 3). Octets in the Data Value are encoded using
842 a definite length byte string (type 2).
844 o For compactness, the CBOR representation uses integers for the
845 labels, as defined in Table 4. This table is conclusive, i.e.,
846 there is no intention to define any additional integer map keys;
847 any extensions will use string map keys. This allows translators
848 converting between CBOR and JSON representations to convert also
849 all future labels without needing to update implementations. The
850 base values are given negative CBOR labels and others non-negative
851 labels.
853 +---------------+-------+------------+
854 | Name | Label | CBOR Label |
855 +---------------+-------+------------+
856 | Version | bver | -1 |
857 | Base Name | bn | -2 |
858 | Base Time | bt | -3 |
859 | Base Unit | bu | -4 |
860 | Base Value | bv | -5 |
861 | Base Sum | bs | -6 |
862 | Name | n | 0 |
863 | Unit | u | 1 |
864 | Value | v | 2 |
865 | String Value | vs | 3 |
866 | Boolean Value | vb | 4 |
867 | Value Sum | s | 5 |
868 | Time | t | 6 |
869 | Update Time | ut | 7 |
870 | Data Value | vd | 8 |
871 +---------------+-------+------------+
873 Table 4: CBOR representation: integers for map keys
875 o For streaming SensML in CBOR representation, the array containing
876 the records SHOULD be a CBOR indefinite length array while for
877 non-streaming SenML, a definite length array MUST be used.
879 The following example shows a dump of the CBOR example for the same
880 sensor measurement as in Section 5.1.2.
882 0000 87 a7 21 78 1b 75 72 6e 3a 64 65 76 3a 6f 77 3a |..!x.urn:dev:ow:|
883 0010 31 30 65 32 30 37 33 61 30 31 30 38 30 30 36 3a |10e2073a0108006:|
884 0020 22 fb 41 d3 03 a1 5b 00 10 62 23 61 41 20 05 00 |".A...[..b#aA ..|
885 0030 67 76 6f 6c 74 61 67 65 01 61 56 02 fb 40 5e 06 |gvoltage.aV..@^.|
886 0040 66 66 66 66 66 a3 00 67 63 75 72 72 65 6e 74 06 |fffff..gcurrent.|
887 0050 24 02 fb 3f f3 33 33 33 33 33 33 a3 00 67 63 75 |$..?.333333..gcu|
888 0060 72 72 65 6e 74 06 23 02 fb 3f f4 cc cc cc cc cc |rrent.#..?......|
889 0070 cd a3 00 67 63 75 72 72 65 6e 74 06 22 02 fb 3f |...gcurrent."..?|
890 0080 f6 66 66 66 66 66 66 a3 00 67 63 75 72 72 65 6e |.ffffff..gcurren|
891 0090 74 06 21 02 f9 3e 00 a3 00 67 63 75 72 72 65 6e |t.!..>...gcurren|
892 00a0 74 06 20 02 fb 3f f9 99 99 99 99 99 9a a3 00 67 |t. ..?.........g|
893 00b0 63 75 72 72 65 6e 74 06 00 02 fb 3f fb 33 33 33 |current....?.333|
894 00c0 33 33 33 |333|
895 00c3
897 In CBOR diagnostic notation (Section 6 of [RFC7049]), this is:
899 [{-2: "urn:dev:ow:10e2073a0108006:",
900 -3: 1276020076.001, -4: "A", -1: 5, 0: "voltage", 1: "V", 2: 120.1},
901 {0: "current", 6: -5, 2: 1.2}, {0: "current", 6: -4, 2: 1.3},
902 {0: "current", 6: -3, 2: 1.4}, {0: "current", 6: -2, 2: 1.5},
903 {0: "current", 6: -1, 2: 1.6}, {0: "current", 6: 0, 2: 1.7}]
905 7. XML Representation (application/senml+xml)
907 A SenML Pack or Stream can also be represented in XML format as
908 defined in this section.
910 Only the UTF-8 form of XML is allowed. Characters in the String
911 Value are encoded using the escape sequences defined in [RFC8259].
912 Octets in the Data Value are base64 encoded with URL safe alphabet as
913 defined in Section 5 of [RFC4648].
915 The following example shows an XML example for the same sensor
916 measurement as in Section 5.1.2.
918
919
921
922
923
924
925
926
927
928 The SenML Stream is represented as a sensml element that contains a
929 series of senml elements for each SenML Record. The SenML fields are
930 represented as XML attributes. For each field defined in this
931 document, the following table shows the SenML labels, which are used
932 for the XML attribute name, as well as the according restrictions on
933 the XML attribute values ("type") as used in the XML senml elements.
935 +---------------+-------+---------+
936 | Name | Label | Type |
937 +---------------+-------+---------+
938 | Base Name | bn | string |
939 | Base Time | bt | double |
940 | Base Unit | bu | string |
941 | Base Value | bv | double |
942 | Base Sum | bs | double |
943 | Base Version | bver | int |
944 | Name | n | string |
945 | Unit | u | string |
946 | Value | v | double |
947 | String Value | vs | string |
948 | Data Value | vd | string |
949 | Boolean Value | vb | boolean |
950 | Value Sum | s | double |
951 | Time | t | double |
952 | Update Time | ut | double |
953 +---------------+-------+---------+
955 Table 5: XML SenML Labels
957 The RelaxNG [RNC] schema for the XML is:
959 default namespace = "urn:ietf:params:xml:ns:senml"
960 namespace rng = "http://relaxng.org/ns/structure/1.0"
962 senml = element senml {
963 attribute bn { xsd:string }?,
964 attribute bt { xsd:double }?,
965 attribute bv { xsd:double }?,
966 attribute bs { xsd:double }?,
967 attribute bu { xsd:string }?,
968 attribute bver { xsd:int }?,
970 attribute n { xsd:string }?,
971 attribute s { xsd:double }?,
972 attribute t { xsd:double }?,
973 attribute u { xsd:string }?,
974 attribute ut { xsd:double }?,
976 attribute v { xsd:double }?,
977 attribute vb { xsd:boolean }?,
978 attribute vs { xsd:string }?,
979 attribute vd { xsd:string }?
980 }
982 sensml =
983 element sensml {
984 senml+
985 }
987 start = sensml
989 8. EXI Representation (application/senml-exi)
991 For efficient transmission of SenML over e.g. a constrained network,
992 Efficient XML Interchange (EXI) can be used. This encodes the XML
993 Schema [W3C.REC-xmlschema-1-20041028] structure of SenML into binary
994 tags and values rather than ASCII text. An EXI representation of
995 SenML SHOULD be made using the strict schema-mode of EXI. This mode
996 however does not allow tag extensions to the schema, and therefore
997 any extensions will be lost in the encoding. For uses where
998 extensions need to be preserved in EXI, the non-strict schema mode of
999 EXI MAY be used.
1001 The EXI header MUST include an "EXI Options", as defined in
1002 [W3C.REC-exi-20140211], with an schemaId set to the value of "a"
1003 indicating the schema provided in this specification. Future
1004 revisions to the schema can change the value of the schemaId to allow
1005 for backwards compatibility. When the data will be transported over
1006 CoAP or HTTP, an EXI Cookie SHOULD NOT be used as it simply makes
1007 things larger and is redundant to information provided in the
1008 Content-Type header.
1010 The following is the XSD Schema to be used for strict schema guided
1011 EXI processing. It is generated from the RelaxNG.
1013
1014
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1046 The following shows a hexdump of the EXI produced from encoding the
1047 following XML example. Note this example is the same information as
1048 the first example in Section 5.1.2 in JSON format.
1050
1051
1053
1054
1055 Which compresses with EXI to the following displayed in hexdump:
1057 0000 a0 30 0d 84 80 f3 ab 93 71 d3 23 2b b1 d3 7b b9 |.0......q.#+..{.|
1058 0010 d1 89 83 29 91 81 b9 9b 09 81 89 81 c1 81 81 b1 |...)............|
1059 0020 99 d2 84 bb 37 b6 3a 30 b3 b2 90 1a b1 58 84 c0 |....7.:0.....X..|
1060 0030 33 04 b1 ba b9 39 32 b7 3a 10 1a 09 06 40 38 |3....92.:....@8|
1061 003f
1063 The above example used the bit packed form of EXI but it is also
1064 possible to use a byte packed form of EXI which can makes it easier
1065 for a simple sensor to produce valid EXI without really implementing
1066 EXI. Consider the example of a temperature sensor that produces a
1067 value in tenths of degrees Celsius over a range of 0.0 to 55.0. It
1068 would produce an XML SenML file such as:
1070
1071
1072
1074 The compressed form, using the byte alignment option of EXI, for the
1075 above XML is the following:
1077 0000 a0 00 48 80 6c 20 01 06 1d 75 72 6e 3a 64 65 76 |..H.l ...urn:dev|
1078 0010 3a 6f 77 3a 31 30 65 32 30 37 33 61 30 31 30 38 |:ow:10e2073a0108|
1079 0020 30 30 36 33 02 05 43 65 6c 01 00 e7 01 01 00 03 |0063..Cel.......|
1080 0030 01 |.|
1081 0031
1083 A small temperature sensor device that only generates this one EXI
1084 file does not really need a full EXI implementation. It can simply
1085 hard code the output replacing the 1-wire device ID starting at byte
1086 0x14 and going to byte 0x23 with its device ID, and replacing the
1087 value "0xe7 0x01" at location 0x31 and 0x32 with the current
1088 temperature. The EXI Specification [W3C.REC-exi-20140211] contains
1089 the full information on how floating point numbers are represented,
1090 but for the purpose of this sensor, the temperature can be converted
1091 to an integer in tenths of degrees (231 in this example). EXI stores
1092 7 bits of the integer in each byte with the top bit set to one if
1093 there are further bytes. So the first bytes at is set to low 7 bits
1094 of the integer temperature in tenths of degrees plus 0x80. In this
1095 example 231 & 0x7F + 0x80 = 0xE7. The second byte is set to the
1096 integer temperature in tenths of degrees right shifted 7 bits. In
1097 this example 231 >> 7 = 0x01.
1099 9. Fragment Identification Methods
1101 A SenML Pack typically consists of multiple SenML Records and for
1102 some applications it may be useful to be able to refer with a
1103 Fragment Identifier to a single record, or a set of records, in a
1104 Pack. The fragment identifier is only interpreted by a client and
1105 does not impact retrieval of a representation. The SenML Fragment
1106 Identification is modeled after CSV Fragment Identifiers [RFC7111].
1108 To select a single SenML Record, the "rec" scheme followed by a
1109 single number is used. For the purpose of numbering records, the
1110 first record is at position 1. A range of records can be selected by
1111 giving the first and the last record number separated by a '-'
1112 character. Instead of the second number, the '*' character can be
1113 used to indicate the last SenML Record in the Pack. A set of records
1114 can also be selected using a comma separated list of record positions
1115 or ranges.
1117 (We use the term "selecting a record" for identifying it as part of
1118 the fragment, not in the sense of isolating it from the Pack -- the
1119 record still needs to be interpreted as part of the Pack, e.g., using
1120 the base values defined in earlier records)
1122 9.1. Fragment Identification Examples
1124 The 3rd SenML Record from "coap://example.com/temp" resource can be
1125 selected with:
1127 coap://example.com/temp#rec=3
1129 Records from 3rd to 6th can be selected with:
1131 coap://example.com/temp#rec=3-6
1133 Records from 19th to the last can be selected with:
1135 coap://example.com/temp#rec=19-*
1137 The 3rd and 5th record can be selected with:
1139 coap://example.com/temp#rec=3,5
1141 To select the Records from third to fifth, the 10th record, and all
1142 from 19th to the last:
1144 coap://example.com/temp#rec=3-5,10,19-*
1146 9.2. Fragment Identification for the XML and EXI Formats
1148 In addition to the SenML Fragment Identifiers described above, with
1149 the XML and EXI SenML formats also the syntax defined in the XPointer
1150 element() Scheme [XPointerElement] of the XPointer Framework
1151 [XPointerFramework] can be used. (This is required by [RFC7303] for
1152 media types using the "+xml" structured syntax suffix. SenML allows
1153 this for the EXI formats as well for consistency.)
1155 Note that fragment identifiers are available to the client side only;
1156 they are not provided in transfer protocols such as CoAP or HTTP.
1157 Thus, they cannot be used by the server in deciding which media type
1158 to send. Where a server has multiple representations available for a
1159 resource identified by a URI, it might send a JSON or CBOR
1160 representation when the client was directed to use an XML/EXI
1161 fragment identifier with this. Clients can prevent running into this
1162 problem by explicitly requesting an XML or EXI media type (e.g.,
1163 using the CoAP Accept option) when XML/EXI-only fragment identifier
1164 syntax is in use in the URI.
1166 10. Usage Considerations
1168 The measurements support sending both the current value of a sensor
1169 as well as an integrated sum. For many types of measurements, the
1170 sum is more useful than the current value. For historical reasons,
1171 this field is called "sum" instead of "integral" which would more
1172 accurately describe its function. For example, an electrical meter
1173 that measures the energy a given computer uses will typically want to
1174 measure the cumulative amount of energy used. This is less prone to
1175 error than reporting the power each second and trying to have
1176 something on the server side sum together all the power measurements.
1177 If the network between the sensor and the meter goes down over some
1178 period of time, when it comes back up, the cumulative sum helps
1179 reflect what happened while the network was down. A meter like this
1180 would typically report a measurement with the unit set to watts, but
1181 it would put the sum of energy used in the "s" field of the
1182 measurement. It might optionally include the current power in the
1183 "v" field.
1185 While the benefit of using the integrated sum is fairly clear for
1186 measurements like power and energy, it is less obvious for something
1187 like temperature. Reporting the sum of the temperature makes it easy
1188 to compute averages even when the individual temperature values are
1189 not reported frequently enough to compute accurate averages.
1190 Implementers are encouraged to report the cumulative sum as well as
1191 the raw value of a given sensor.
1193 Applications that use the cumulative sum values need to understand
1194 they are very loosely defined by this specification, and depending on
1195 the particular sensor implementation may behave in unexpected ways.
1196 Applications should be able to deal with the following issues:
1198 1. Many sensors will allow the cumulative sums to "wrap" back to
1199 zero after the value gets sufficiently large.
1201 2. Some sensors will reset the cumulative sum back to zero when the
1202 device is reset, loses power, or is replaced with a different
1203 sensor.
1205 3. Applications cannot make assumptions about when the device
1206 started accumulating values into the sum.
1208 Typically applications can make some assumptions about specific
1209 sensors that will allow them to deal with these problems. A common
1210 assumption is that for sensors whose measurement values are always
1211 positive, the sum should never get smaller; so if the sum does get
1212 smaller, the application will know that one of the situations listed
1213 above has happened.
1215 Despite the name sum, the sum field is not useful for applications
1216 that maintain a running count of the number of times that an event
1217 happened or keeping track of a counter such as the total number of
1218 bytes sent on an interface. Data like that can be sent directly in
1219 the value field.
1221 11. CDDL
1223 As a convenient reference, the JSON and CBOR representations can be
1224 described with the common CDDL [I-D.ietf-cbor-cddl] specification in
1225 Figure 1 (informative).
1227 SenML-Pack = [1* record]
1229 record = {
1230 ? bn => tstr, ; Base Name
1231 ? bt => numeric, ; Base Time
1232 ? bu => tstr, ; Base Units
1233 ? bv => numeric, ; Base Value
1234 ? bs => numeric, ; Base Sum
1235 ? bver => uint, ; Base Version
1236 ? n => tstr, ; Name
1237 ? u => tstr, ; Units
1238 ? s => numeric, ; Value Sum
1239 ? t => numeric, ; Time
1240 ? ut => numeric, ; Update Time
1241 ? ( v => numeric // ; Numeric Value
1242 vs => tstr // ; String Value
1243 vb => bool // ; Boolean Value
1244 vd => binary-value ) ; Data Value
1245 * key-value-pair
1246 }
1248 ; now define the generic versions
1249 key-value-pair = ( label => value )
1251 label = non-b-label / b-label
1252 non-b-label = tstr .regexp "[A-Zac-z0-9][-_:.A-Za-z0-9]*" / uint
1253 b-label = tstr .regexp "b[-_:.A-Za-z0-9]+" / nint
1255 value = tstr / binary-value / numeric / bool
1256 numeric = number / decfrac
1258 Figure 1: Common CDDL specification for CBOR and JSON SenML
1260 For JSON, we use text labels and base64url-encoded binary data
1261 (Figure 2).
1263 bver = "bver" n = "n" s = "s"
1264 bn = "bn" u = "u" t = "t"
1265 bt = "bt" v = "v" ut = "ut"
1266 bu = "bu" vs = "vs" vd = "vd"
1267 bv = "bv" vb = "vb"
1268 bs = "bs"
1270 binary-value = tstr ; base64url encoded
1272 Figure 2: JSON-specific CDDL specification for SenML
1274 For CBOR, we use integer labels and native binary data (Figure 3).
1276 bver = -1 n = 0 s = 5
1277 bn = -2 u = 1 t = 6
1278 bt = -3 v = 2 ut = 7
1279 bu = -4 vs = 3 vd = 8
1280 bv = -5 vb = 4
1281 bs = -6
1283 binary-value = bstr
1285 Figure 3: CBOR-specific CDDL specification for SenML
1287 12. IANA Considerations
1289 Note to RFC Editor: Please replace all occurrences of "RFC-AAAA" with
1290 the RFC number of this specification.
1292 IANA will create a new registry for "Sensor Measurement Lists (SenML)
1293 Parameters". The sub-registries defined in Section 12.1 and
1294 Section 12.2 will be created inside this registry.
1296 12.1. Units Registry
1298 IANA will create a registry of SenML unit symbols. The primary
1299 purpose of this registry is to make sure that symbols uniquely map to
1300 give type of measurement. Definitions for many of these units can be
1301 found in location such as [NIST811] and [BIPM]. Units marked with an
1302 asterisk are NOT RECOMMENDED to be produced by new implementations,
1303 but are in active use and SHOULD be implemented by consumers that can
1304 use the related base units.
1306 +----------+------------------------------------+-------+-----------+
1307 | Symbol | Description | Type | Reference |
1308 +----------+------------------------------------+-------+-----------+
1309 | m | meter | float | RFC-AAAA |
1310 | kg | kilogram | float | RFC-AAAA |
1311 | g | gram* | float | RFC-AAAA |
1312 | s | second | float | RFC-AAAA |
1313 | A | ampere | float | RFC-AAAA |
1314 | K | kelvin | float | RFC-AAAA |
1315 | cd | candela | float | RFC-AAAA |
1316 | mol | mole | float | RFC-AAAA |
1317 | Hz | hertz | float | RFC-AAAA |
1318 | rad | radian | float | RFC-AAAA |
1319 | sr | steradian | float | RFC-AAAA |
1320 | N | newton | float | RFC-AAAA |
1321 | Pa | pascal | float | RFC-AAAA |
1322 | J | joule | float | RFC-AAAA |
1323 | W | watt | float | RFC-AAAA |
1324 | C | coulomb | float | RFC-AAAA |
1325 | V | volt | float | RFC-AAAA |
1326 | F | farad | float | RFC-AAAA |
1327 | Ohm | ohm | float | RFC-AAAA |
1328 | S | siemens | float | RFC-AAAA |
1329 | Wb | weber | float | RFC-AAAA |
1330 | T | tesla | float | RFC-AAAA |
1331 | H | henry | float | RFC-AAAA |
1332 | Cel | degrees Celsius | float | RFC-AAAA |
1333 | lm | lumen | float | RFC-AAAA |
1334 | lx | lux | float | RFC-AAAA |
1335 | Bq | becquerel | float | RFC-AAAA |
1336 | Gy | gray | float | RFC-AAAA |
1337 | Sv | sievert | float | RFC-AAAA |
1338 | kat | katal | float | RFC-AAAA |
1339 | m2 | square meter (area) | float | RFC-AAAA |
1340 | m3 | cubic meter (volume) | float | RFC-AAAA |
1341 | l | liter (volume)* | float | RFC-AAAA |
1342 | m/s | meter per second (velocity) | float | RFC-AAAA |
1343 | m/s2 | meter per square second | float | RFC-AAAA |
1344 | | (acceleration) | | |
1345 | m3/s | cubic meter per second (flow rate) | float | RFC-AAAA |
1346 | l/s | liter per second (flow rate)* | float | RFC-AAAA |
1347 | W/m2 | watt per square meter (irradiance) | float | RFC-AAAA |
1348 | cd/m2 | candela per square meter | float | RFC-AAAA |
1349 | | (luminance) | | |
1350 | bit | bit (information content) | float | RFC-AAAA |
1351 | bit/s | bit per second (data rate) | float | RFC-AAAA |
1352 | lat | degrees latitude (note 1) | float | RFC-AAAA |
1353 | lon | degrees longitude (note 1) | float | RFC-AAAA |
1354 | pH | pH value (acidity; logarithmic | float | RFC-AAAA |
1355 | | quantity) | | |
1356 | dB | decibel (logarithmic quantity) | float | RFC-AAAA |
1357 | dBW | decibel relative to 1 W (power | float | RFC-AAAA |
1358 | | level) | | |
1359 | Bspl | bel (sound pressure level; | float | RFC-AAAA |
1360 | | logarithmic quantity)* | | |
1361 | count | 1 (counter value) | float | RFC-AAAA |
1362 | / | 1 (Ratio e.g., value of a switch, | float | RFC-AAAA |
1363 | | note 2) | | |
1364 | % | 1 (Ratio e.g., value of a switch, | float | RFC-AAAA |
1365 | | note 2)* | | |
1366 | %RH | Percentage (Relative Humidity) | float | RFC-AAAA |
1367 | %EL | Percentage (remaining battery | float | RFC-AAAA |
1368 | | energy level) | | |
1369 | EL | seconds (remaining battery energy | float | RFC-AAAA |
1370 | | level) | | |
1371 | 1/s | 1 per second (event rate) | float | RFC-AAAA |
1372 | 1/min | 1 per minute (event rate, "rpm")* | float | RFC-AAAA |
1373 | beat/min | 1 per minute (Heart rate in beats | float | RFC-AAAA |
1374 | | per minute)* | | |
1375 | beats | 1 (Cumulative number of heart | float | RFC-AAAA |
1376 | | beats)* | | |
1377 | S/m | Siemens per meter (conductivity) | float | RFC-AAAA |
1378 +----------+------------------------------------+-------+-----------+
1380 Table 6
1382 o Note 1: Assumed to be in WGS84 unless another reference frame is
1383 known for the sensor.
1385 o Note 2: A value of 0.0 indicates the switch is off while 1.0
1386 indicates on and 0.5 would be half on. The preferred name of this
1387 unit is "/". For historical reasons, the name "%" is also
1388 provided for the same unit - but note that while that name
1389 strongly suggests a percentage (0..100) -- it is however NOT a
1390 percentage, but the absolute ratio!
1392 New entries can be added to the registration by Expert Review as
1393 defined in [RFC8126]. Experts should exercise their own good
1394 judgment but need to consider the following guidelines:
1396 1. There needs to be a real and compelling use for any new unit to
1397 be added.
1399 2. Each unit should define the semantic information and be chosen
1400 carefully. Implementers need to remember that the same word may
1401 be used in different real-life contexts. For example, degrees
1402 when measuring latitude have no semantic relation to degrees
1403 when measuring temperature; thus two different units are needed.
1405 3. These measurements are produced by computers for consumption by
1406 computers. The principle is that conversion has to be easily be
1407 done when both reading and writing the media type. The value of
1408 a single canonical representation outweighs the convenience of
1409 easy human representations or loss of precision in a conversion.
1411 4. Use of SI prefixes such as "k" before the unit is not
1412 recommended. Instead one can represent the value using
1413 scientific notation such a 1.2e3. The "kg" unit is exception to
1414 this rule since it is an SI base unit; the "g" unit is provided
1415 for legacy compatibility.
1417 5. For a given type of measurement, there will only be one unit
1418 type defined. So for length, meters are defined and other
1419 lengths such as mile, foot, light year are not allowed. For
1420 most cases, the SI unit is preferred.
1422 (Note that some amount of judgment will be required here, as
1423 even SI itself is not entirely consistent in this respect. For
1424 instance, for temperature [ISO-80000-5] defines a quantity, item
1425 5-1 (thermodynamic temperature), and a corresponding unit 5-1.a
1426 (Kelvin), and then goes ahead to define another quantity right
1427 besides that, item 5-2 ("Celsius temperature"), and the
1428 corresponding unit 5-2.a (degree Celsius). The latter quantity
1429 is defined such that it gives the thermodynamic temperature as a
1430 delta from T0 = 275.15 K. ISO 80000-5 is defining both units
1431 side by side, and not really expressing a preference. This
1432 level of recognition of the alternative unit degree Celsius is
1433 the reason why Celsius temperatures exceptionally seem
1434 acceptable in the SenML units list alongside Kelvin.)
1436 6. Symbol names that could be easily confused with existing common
1437 units or units combined with prefixes should be avoided. For
1438 example, selecting a unit name of "mph" to indicate something
1439 that had nothing to do with velocity would be a bad choice, as
1440 "mph" is commonly used to mean miles per hour.
1442 7. The following should not be used because the are common SI
1443 prefixes: Y, Z, E, P, T, G, M, k, h, da, d, c, n, u, p, f, a, z,
1444 y, Ki, Mi, Gi, Ti, Pi, Ei, Zi, Yi.
1446 8. The following units should not be used as they are commonly used
1447 to represent other measurements Ky, Gal, dyn, etg, P, St, Mx, G,
1448 Oe, Gb, sb, Lmb, mph, Ci, R, RAD, REM, gal, bbl, qt, degF, Cal,
1449 BTU, HP, pH, B/s, psi, Torr, atm, at, bar, kWh.
1451 9. The unit names are case sensitive and the correct case needs to
1452 be used, but symbols that differ only in case should not be
1453 allocated.
1455 10. A number after a unit typically indicates the previous unit
1456 raised to that power, and the / indicates that the units that
1457 follow are the reciprocal. A unit should have only one / in the
1458 name.
1460 11. A good list of common units can be found in the Unified Code for
1461 Units of Measure [UCUM].
1463 12.2. SenML Label Registry
1465 IANA will create a new registry for SenML labels. The initial
1466 content of the registry is:
1468 +--------------+-------+----+-----------+----------+----+-----------+
1469 | Name | Label | CL | JSON Type | XML Type | EI | Reference |
1470 +--------------+-------+----+-----------+----------+----+-----------+
1471 | Base Name | bn | -2 | String | string | a | RFC-AAAA |
1472 | Base Time | bt | -3 | Number | double | a | RFC-AAAA |
1473 | Base Unit | bu | -4 | String | string | a | RFC-AAAA |
1474 | Base Value | bv | -5 | Number | double | a | RFC-AAAA |
1475 | Base Sum | bs | -6 | Number | double | a | RFC-AAAA |
1476 | Base Version | bver | -1 | Number | int | a | RFC-AAAA |
1477 | Name | n | 0 | String | string | a | RFC-AAAA |
1478 | Unit | u | 1 | String | string | a | RFC-AAAA |
1479 | Value | v | 2 | Number | double | a | RFC-AAAA |
1480 | String Value | vs | 3 | String | string | a | RFC-AAAA |
1481 | Boolean | vb | 4 | Boolean | boolean | a | RFC-AAAA |
1482 | Value | | | | | | |
1483 | Data Value | vd | 8 | String | string | a | RFC-AAAA |
1484 | Value Sum | s | 5 | Number | double | a | RFC-AAAA |
1485 | Time | t | 6 | Number | double | a | RFC-AAAA |
1486 | Update Time | ut | 7 | Number | double | a | RFC-AAAA |
1487 +--------------+-------+----+-----------+----------+----+-----------+
1489 Table 7: IANA Registry for SenML Labels, CL = CBOR Label, EI = EXI ID
1491 This is the same table as Table 1, with notes removed, and with
1492 columns added for the information that is all the same for this
1493 initial set of registrations, but will need to be supplied with a
1494 different value for new registrations.
1496 All new entries must define the Label Name, Label, and XML Type but
1497 the CBOR labels SHOULD be left empty as CBOR will use the string
1498 encoding for any new labels. The EI column contains the EXI schemaId
1499 value of the first Schema which includes this label or is empty if
1500 this label was not intended for use with EXI. The Note field SHOULD
1501 contain information about where to find out more information about
1502 this label.
1504 The JSON, CBOR, and EXI types are derived from the XML type. All XML
1505 numeric types such as double, float, integer and int become a JSON
1506 Number. XML boolean and string become a JSON Boolean and String
1507 respectively. CBOR represents numeric values with a CBOR type that
1508 does not lose any information from the JSON value. EXI uses the XML
1509 types.
1511 New entries can be added to the registration by Expert Review as
1512 defined in [RFC8126]. Experts should exercise their own good
1513 judgment but need to consider that shorter labels should have more
1514 strict review. New entries should not be made that counteract the
1515 advice at the end of Section 4.5.4.
1517 All new SenML labels that have "base" semantics (see Section 4.1)
1518 MUST start with the character 'b'. Regular labels MUST NOT start
1519 with that character. All new SenML labels with Value semantics (see
1520 Section 4.2) MUST have "Value" in their (long form) name.
1522 Extensions that add a label that is intended for use with XML need to
1523 create a new RelaxNG scheme that includes all the labels in the IANA
1524 registry.
1526 Extensions that add a label that is intended for use with EXI need to
1527 create a new XSD Schema that includes all the labels in the IANA
1528 registry and then allocate a new EXI schemaId value. Moving to the
1529 next letter in the alphabet is the suggested way to create the new
1530 value for the EXI schemaId. Any labels with previously blank ID
1531 values SHOULD be updated in the IANA table to have their ID set to
1532 this new schemaId value.
1534 Extensions that are mandatory to understand to correctly process the
1535 Pack MUST have a label name that ends with the '_' character.
1537 12.3. Media Type Registrations
1539 The following registrations are done following the procedure
1540 specified in [RFC6838] and [RFC7303]. This document registers media
1541 types for each serialization format of SenML (JSON, CBOR, XML, and
1542 EXI) and also a corresponding set of media types for the streaming
1543 use (SensML, see Section 4.8). Clipboard formats are defined for the
1544 JSON and XML forms of SenML but not for streams or non-textual
1545 formats.
1547 The reason there are both SenML and the streaming SensML formats is
1548 that they are not the same data formats and they require separate
1549 negotiation to understand if they are supported and which one is
1550 being used. The non streaming format is required to have some sort
1551 of end of pack syntax which indicates there will be no more records.
1552 Many implementations that receive SenML wait for this end of pack
1553 marker before processing any of the records. On the other hand, with
1554 the streaming formats, it is explicitly not required to wait for this
1555 end of pack marker. Many implementations that produce streaming
1556 SensML will never send this end of pack marker so implementations
1557 that receive streaming SensML can not wait for the end of pack marker
1558 before they start processing the records. Given the SenML and
1559 streaming SenML are different data formats, and the requirement for
1560 separate negotiation, a media type for each one is needed.
1562 Note to RFC Editor - please remove this paragraph. Note that a
1563 request for media type review for senml+json was sent to the media-
1564 types@iana.org on Sept 21, 2010. A second request for all the types
1565 was sent on October 31, 2016. Please change all instances of RFC-
1566 AAAA with the RFC number of this document.
1568 12.3.1. senml+json Media Type Registration
1570 Type name: application
1572 Subtype name: senml+json
1574 Required parameters: none
1576 Optional parameters: none
1578 Encoding considerations: Must be encoded as using a subset of the
1579 encoding allowed in [RFC8259]. See RFC-AAAA for details. This
1580 simplifies implementation of very simple system and does not impose
1581 any significant limitations as all this data is meant for machine to
1582 machine communications and is not meant to be human readable.
1584 Security considerations: See Section 13 of RFC-AAAA.
1586 Interoperability considerations: Applications MUST ignore any JSON
1587 key value pairs that they do not understand unless the key ends with
1588 the '_' character in which case an error MUST be generated. This
1589 allows backwards compatible extensions to this specification. The
1590 "bver" field can be used to ensure the receiver supports a minimal
1591 level of functionality needed by the creator of the JSON object.
1593 Published specification: RFC-AAAA
1595 Applications that use this media type: The type is used by systems
1596 that report e.g., electrical power usage and environmental
1597 information such as temperature and humidity. It can be used for a
1598 wide range of sensor reporting systems.
1600 Fragment identifier considerations: Fragment identification for
1601 application/senml+json is supported by using fragment identifiers as
1602 specified by RFC-AAAA.
1604 Additional information:
1606 Magic number(s): none
1607 File extension(s): senml
1609 Windows Clipboard Name: "JSON Sensor Measurement List"
1611 Macintosh file type code(s): none
1613 Macintosh Universal Type Identifier code: org.ietf.senml-json
1614 conforms to public.text
1616 Person & email address to contact for further information: Cullen
1617 Jennings
1619 Intended usage: COMMON
1621 Restrictions on usage: None
1623 Author: Cullen Jennings
1625 Change controller: IESG
1627 12.3.2. sensml+json Media Type Registration
1629 Type name: application
1631 Subtype name: sensml+json
1633 Required parameters: none
1635 Optional parameters: none
1637 Encoding considerations: Must be encoded as using a subset of the
1638 encoding allowed in [RFC8259]. See RFC-AAAA for details. This
1639 simplifies implementation of very simple system and does not impose
1640 any significant limitations as all this data is meant for machine to
1641 machine communications and is not meant to be human readable.
1643 Security considerations: See Section 13 of RFC-AAAA.
1645 Interoperability considerations: Applications MUST ignore any JSON
1646 key value pairs that they do not understand unless the key ends with
1647 the '_' character in which case an error MUST be generated. This
1648 allows backwards compatible extensions to this specification. The
1649 "bver" field can be used to ensure the receiver supports a minimal
1650 level of functionality needed by the creator of the JSON object.
1652 Published specification: RFC-AAAA
1653 Applications that use this media type: The type is used by systems
1654 that report e.g., electrical power usage and environmental
1655 information such as temperature and humidity. It can be used for a
1656 wide range of sensor reporting systems.
1658 Fragment identifier considerations: Fragment identification for
1659 application/sensml+json is supported by using fragment identifiers as
1660 specified by RFC-AAAA.
1662 Additional information:
1664 Magic number(s): none
1666 File extension(s): sensml
1668 Macintosh file type code(s): none
1670 Person & email address to contact for further information: Cullen
1671 Jennings
1673 Intended usage: COMMON
1675 Restrictions on usage: None
1677 Author: Cullen Jennings
1679 Change controller: IESG
1681 12.3.3. senml+cbor Media Type Registration
1683 Type name: application
1685 Subtype name: senml+cbor
1687 Required parameters: none
1689 Optional parameters: none
1691 Encoding considerations: Must be encoded as using [RFC7049]. See
1692 RFC-AAAA for details.
1694 Security considerations: See Section 13 of RFC-AAAA.
1696 Interoperability considerations: Applications MUST ignore any key
1697 value pairs that they do not understand unless the key ends with the
1698 '_' character in which case an error MUST be generated. This allows
1699 backwards compatible extensions to this specification. The "bver"
1700 field can be used to ensure the receiver supports a minimal level of
1701 functionality needed by the creator of the CBOR object.
1703 Published specification: RFC-AAAA
1705 Applications that use this media type: The type is used by systems
1706 that report e.g., electrical power usage and environmental
1707 information such as temperature and humidity. It can be used for a
1708 wide range of sensor reporting systems.
1710 Fragment identifier considerations: Fragment identification for
1711 application/senml+cbor is supported by using fragment identifiers as
1712 specified by RFC-AAAA.
1714 Additional information:
1716 Magic number(s): none
1718 File extension(s): senmlc
1720 Macintosh file type code(s): none
1722 Macintosh Universal Type Identifier code: org.ietf.senml-cbor
1723 conforms to public.data
1725 Person & email address to contact for further information: Cullen
1726 Jennings
1728 Intended usage: COMMON
1730 Restrictions on usage: None
1732 Author: Cullen Jennings
1734 Change controller: IESG
1736 12.3.4. sensml+cbor Media Type Registration
1738 Type name: application
1740 Subtype name: sensml+cbor
1742 Required parameters: none
1744 Optional parameters: none
1746 Encoding considerations: Must be encoded as using [RFC7049]. See
1747 RFC-AAAA for details.
1749 Security considerations: See Section 13 of RFC-AAAA.
1751 Interoperability considerations: Applications MUST ignore any key
1752 value pairs that they do not understand unless the key ends with the
1753 '_' character in which case an error MUST be generated. This allows
1754 backwards compatible extensions to this specification. The "bver"
1755 field can be used to ensure the receiver supports a minimal level of
1756 functionality needed by the creator of the CBOR object.
1758 Published specification: RFC-AAAA
1760 Applications that use this media type: The type is used by systems
1761 that report e.g., electrical power usage and environmental
1762 information such as temperature and humidity. It can be used for a
1763 wide range of sensor reporting systems.
1765 Fragment identifier considerations: Fragment identification for
1766 application/sensml+cbor is supported by using fragment identifiers as
1767 specified by RFC-AAAA.
1769 Additional information:
1771 Magic number(s): none
1773 File extension(s): sensmlc
1775 Macintosh file type code(s): none
1777 Person & email address to contact for further information: Cullen
1778 Jennings
1780 Intended usage: COMMON
1782 Restrictions on usage: None
1784 Author: Cullen Jennings
1786 Change controller: IESG
1788 12.3.5. senml+xml Media Type Registration
1790 Type name: application
1792 Subtype name: senml+xml
1794 Required parameters: none
1796 Optional parameters: none
1797 Encoding considerations: Must be encoded as using
1798 [W3C.REC-xml-20081126]. See RFC-AAAA for details.
1800 Security considerations: See Section 13 of RFC-AAAA.
1802 Interoperability considerations: Applications MUST ignore any XML
1803 tags or attributes that they do not understand unless the attribute
1804 name ends with the '_' character in which case an error MUST be
1805 generated. This allows backwards compatible extensions to this
1806 specification. The "bver" attribute in the senml XML tag can be used
1807 to ensure the receiver supports a minimal level of functionality
1808 needed by the creator of the XML SenML Pack.
1810 Published specification: RFC-AAAA
1812 Applications that use this media type: The type is used by systems
1813 that report e.g., electrical power usage and environmental
1814 information such as temperature and humidity. It can be used for a
1815 wide range of sensor reporting systems.
1817 Fragment identifier considerations: Fragment identification for
1818 application/senml+xml is supported by using fragment identifiers as
1819 specified by RFC-AAAA.
1821 Additional information:
1823 Magic number(s): none
1825 File extension(s): senmlx
1827 Windows Clipboard Name: "XML Sensor Measurement List"
1829 Macintosh file type code(s): none
1831 Macintosh Universal Type Identifier code: org.ietf.senml-xml conforms
1832 to public.xml
1834 Person & email address to contact for further information: Cullen
1835 Jennings
1837 Intended usage: COMMON
1839 Restrictions on usage: None
1841 Author: Cullen Jennings
1843 Change controller: IESG
1845 12.3.6. sensml+xml Media Type Registration
1847 Type name: application
1849 Subtype name: sensml+xml
1851 Required parameters: none
1853 Optional parameters: none
1855 Encoding considerations: Must be encoded as using
1856 [W3C.REC-xml-20081126]. See RFC-AAAA for details.
1858 Security considerations: See Section 13 of RFC-AAAA.
1860 Interoperability considerations: Applications MUST ignore any XML
1861 tags or attributes that they do not understand unless the attribute
1862 name ends with the '_' character in which case an error MUST be
1863 generated. This allows backwards compatible extensions to this
1864 specification. The "bver" attribute in the senml XML tag can be used
1865 to ensure the receiver supports a minimal level of functionality
1866 needed by the creator of the XML SenML Pack.
1868 Published specification: RFC-AAAA
1870 Applications that use this media type: The type is used by systems
1871 that report e.g., electrical power usage and environmental
1872 information such as temperature and humidity. It can be used for a
1873 wide range of sensor reporting systems.
1875 Fragment identifier considerations: Fragment identification for
1876 application/sensml+xml is supported by using fragment identifiers as
1877 specified by RFC-AAAA.
1879 Additional information:
1881 Magic number(s): none
1883 File extension(s): sensmlx
1885 Macintosh file type code(s): none
1887 Person & email address to contact for further information: Cullen
1888 Jennings
1890 Intended usage: COMMON
1892 Restrictions on usage: None
1893 Author: Cullen Jennings
1895 Change controller: IESG
1897 12.3.7. senml-exi Media Type Registration
1899 Type name: application
1901 Subtype name: senml-exi
1903 Required parameters: none
1905 Optional parameters: none
1907 Encoding considerations: Must be encoded as using
1908 [W3C.REC-exi-20140211]. See RFC-AAAA for details.
1910 Security considerations: See Section 13 of RFC-AAAA.
1912 Interoperability considerations: Applications MUST ignore any XML
1913 tags or attributes that they do not understand unless the attribute
1914 name ends with the '_' character in which case an error MUST be
1915 generated. This allows backwards compatible extensions to this
1916 specification. The "bver" attribute in the senml XML tag can be used
1917 to ensure the receiver supports a minimal level of functionality
1918 needed by the creator of the XML SenML Pack. Further information on
1919 using schemas to guide the EXI can be found in RFC-AAAA.
1921 Published specification: RFC-AAAA
1923 Applications that use this media type: The type is used by systems
1924 that report e.g., electrical power usage and environmental
1925 information such as temperature and humidity. It can be used for a
1926 wide range of sensor reporting systems.
1928 Fragment identifier considerations: Fragment identification for
1929 application/senml-exi is supported by using fragment identifiers as
1930 specified by RFC-AAAA.
1932 Additional information:
1934 Magic number(s): none
1936 File extension(s): senmle
1938 Macintosh file type code(s): none
1939 Macintosh Universal Type Identifier code: org.ietf.senml-exi conforms
1940 to public.data
1942 Person & email address to contact for further information: Cullen
1943 Jennings
1945 Intended usage: COMMON
1947 Restrictions on usage: None
1949 Author: Cullen Jennings
1951 Change controller: IESG
1953 12.3.8. sensml-exi Media Type Registration
1955 Type name: application
1957 Subtype name: sensml-exi
1959 Required parameters: none
1961 Optional parameters: none
1963 Encoding considerations: Must be encoded as using
1964 [W3C.REC-exi-20140211]. See RFC-AAAA for details.
1966 Security considerations: See Section 13 of RFC-AAAA.
1968 Interoperability considerations: Applications MUST ignore any XML
1969 tags or attributes that they do not understand unless the attribute
1970 name ends with the '_' character in which case an error MUST be
1971 generated. This allows backwards compatible extensions to this
1972 specification. The "bver" attribute in the senml XML tag can be used
1973 to ensure the receiver supports a minimal level of functionality
1974 needed by the creator of the XML SenML Pack. Further information on
1975 using schemas to guide the EXI can be found in RFC-AAAA.
1977 Published specification: RFC-AAAA
1979 Applications that use this media type: The type is used by systems
1980 that report e.g., electrical power usage and environmental
1981 information such as temperature and humidity. It can be used for a
1982 wide range of sensor reporting systems.
1984 Fragment identifier considerations: Fragment identification for
1985 application/sensml-exi is supported by using fragment identifiers as
1986 specified by RFC-AAAA.
1988 Additional information:
1990 Magic number(s): none
1992 File extension(s): sensmle
1994 Macintosh file type code(s): none
1996 Person & email address to contact for further information: Cullen
1997 Jennings
1999 Intended usage: COMMON
2001 Restrictions on usage: None
2003 Author: Cullen Jennings
2005 Change controller: IESG
2007 12.4. XML Namespace Registration
2009 This document registers the following XML namespaces in the IETF XML
2010 registry defined in [RFC3688].
2012 URI: urn:ietf:params:xml:ns:senml
2014 Registrant Contact: The IESG.
2016 XML: N/A, the requested URIs are XML namespaces
2018 12.5. CoAP Content-Format Registration
2020 IANA is requested to assign CoAP Content-Format IDs for the SenML
2021 media types in the "CoAP Content-Formats" sub-registry, within the
2022 "CoRE Parameters" registry [RFC7252]. IDs for the JSON, CBOR, and
2023 EXI Content-Formats are assigned from the "Expert Review" (0-255)
2024 range and for the XML Content-Format from the "IETF Review or IESG
2025 Approval" range. The assigned IDs are shown in Table 8.
2027 +-------------------------+----------+---------+-----------+
2028 | Media type | Encoding | ID | Reference |
2029 +-------------------------+----------+---------+-----------+
2030 | application/senml+json | - | TBD:110 | RFC-AAAA |
2031 | application/sensml+json | - | TBD:111 | RFC-AAAA |
2032 | application/senml+cbor | - | TBD:112 | RFC-AAAA |
2033 | application/sensml+cbor | - | TBD:113 | RFC-AAAA |
2034 | application/senml-exi | - | TBD:114 | RFC-AAAA |
2035 | application/sensml-exi | - | TBD:115 | RFC-AAAA |
2036 | application/senml+xml | - | TBD:310 | RFC-AAAA |
2037 | application/sensml+xml | - | TBD:311 | RFC-AAAA |
2038 +-------------------------+----------+---------+-----------+
2040 Table 8: CoAP Content-Format IDs
2042 13. Security Considerations
2044 Sensor data presented with SenML can contain a wide range of
2045 information ranging from information that is very public, such as the
2046 outside temperature in a given city, to very private information that
2047 requires integrity and confidentiality protection, such as patient
2048 health information. When SenML is used for configuration or
2049 actuation, it can be used to change the state of systems and also
2050 impact the physical world, e.g., by turning off a heater or opening a
2051 lock.
2053 The SenML formats alone do not provide any security and instead rely
2054 on the protocol that carries them to provide security. Applications
2055 using SenML need to look at the overall context of how these formats
2056 will be used to decide if the security is adequate. In particular
2057 for sensitive sensor data and actuation use it is important to ensure
2058 that proper security mechanisms are used to provide, e.g.,
2059 confidentiality, data integrity, and authentication as appropriate
2060 for the usage.
2062 The SenML formats defined by this specification do not contain any
2063 executable content. However, future extensions could potentially
2064 embed application specific executable content in the data.
2066 SenML Records are intended to be interpreted in the context of any
2067 applicable base values. If records become separated from the record
2068 that establishes the base values, the data will be useless or, worse,
2069 wrong. Care needs to be taken in keeping the integrity of a Pack
2070 that contains unresolved SenML Records (see Section 4.6).
2072 See also Section 14.
2074 14. Privacy Considerations
2076 Sensor data can range from information with almost no privacy
2077 considerations, such as the current temperature in a given city, to
2078 highly sensitive medical or location data. This specification
2079 provides no security protection for the data but is meant to be used
2080 inside another container or transfer protocol such as S/MIME
2081 [RFC5751] or HTTP with TLS [RFC2818] that can provide integrity,
2082 confidentiality, and authentication information about the source of
2083 the data.
2085 The name fields need to uniquely identify the sources or destinations
2086 of the values in a SenML Pack. However, the use of long-term stable
2087 unique identifiers can be problematic for privacy reasons [RFC6973],
2088 depending on the application and the potential of these identifiers
2089 to be used in correlation with other information. They should be
2090 used with care or avoided as for example described for IPv6 addresses
2091 in [RFC7721].
2093 15. Acknowledgement
2095 We would like to thank Alexander Pelov, Alexey Melnikov, Andrew
2096 McClure, Andrew McGregor, Bjoern Hoehrmann, Christian Amsuess,
2097 Christian Groves, Daniel Peintner, Jan-Piet Mens, Jim Schaad, Joe
2098 Hildebrand, John Klensin, Karl Palsson, Lennart Duhrsen, Lisa
2099 Dusseault, Lyndsay Campbell, Martin Thomson, Michael Koster, Peter
2100 Saint-Andre, Roni Even, and Stephen Farrell, for their review
2101 comments.
2103 16. References
2105 16.1. Normative References
2107 [BIPM] Bureau International des Poids et Mesures, "The
2108 International System of Units (SI)", 8th edition, 2006.
2110 [IEEE.754.1985]
2111 Institute of Electrical and Electronics Engineers,
2112 "Standard for Binary Floating-Point Arithmetic",
2113 IEEE Standard 754, August 1985.
2115 [NIST811] Thompson, A. and B. Taylor, "Guide for the Use of the
2116 International System of Units (SI)", NIST Special
2117 Publication 811, 2008.
2119 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
2120 Requirement Levels", BCP 14, RFC 2119,
2121 DOI 10.17487/RFC2119, March 1997,
2122 .
2124 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO
2125 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November
2126 2003, .
2128 [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688,
2129 DOI 10.17487/RFC3688, January 2004,
2130 .
2132 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data
2133 Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006,
2134 .
2136 [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type
2137 Specifications and Registration Procedures", BCP 13,
2138 RFC 6838, DOI 10.17487/RFC6838, January 2013,
2139 .
2141 [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object
2142 Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049,
2143 October 2013, .
2145 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained
2146 Application Protocol (CoAP)", RFC 7252,
2147 DOI 10.17487/RFC7252, June 2014,
2148 .
2150 [RFC7303] Thompson, H. and C. Lilley, "XML Media Types", RFC 7303,
2151 DOI 10.17487/RFC7303, July 2014,
2152 .
2154 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for
2155 Writing an IANA Considerations Section in RFCs", BCP 26,
2156 RFC 8126, DOI 10.17487/RFC8126, June 2017,
2157 .
2159 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2160 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
2161 May 2017, .
2163 [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data
2164 Interchange Format", STD 90, RFC 8259,
2165 DOI 10.17487/RFC8259, December 2017,
2166 .
2168 [RNC] ISO/IEC, "Information technology -- Document Schema
2169 Definition Language (DSDL) -- Part 2: Regular-grammar-
2170 based validation -- RELAX NG", ISO/IEC 19757-2, Annex
2171 C: RELAX NG Compact syntax, December 2008.
2173 [TIME_T] The Open Group Base Specifications, "Vol. 1: Base
2174 Definitions, Issue 7", Section 4.15 'Seconds Since the
2175 Epoch', IEEE Std 1003.1, 2013 Edition, 2013,
2176 .
2179 [W3C.REC-exi-20140211]
2180 Schneider, J., Kamiya, T., Peintner, D., and R. Kyusakov,
2181 "Efficient XML Interchange (EXI) Format 1.0 (Second
2182 Edition)", World Wide Web Consortium Recommendation REC-
2183 exi-20140211, February 2014,
2184 .
2186 [W3C.REC-xml-20081126]
2187 Bray, T., Paoli, J., Sperberg-McQueen, M., Maler, E., and
2188 F. Yergeau, "Extensible Markup Language (XML) 1.0 (Fifth
2189 Edition)", World Wide Web Consortium Recommendation REC-
2190 xml-20081126, November 2008,
2191 .
2193 [W3C.REC-xmlschema-1-20041028]
2194 Thompson, H., Beech, D., Maloney, M., and N. Mendelsohn,
2195 "XML Schema Part 1: Structures Second Edition", World Wide
2196 Web Consortium Recommendation REC-xmlschema-1-20041028,
2197 October 2004,
2198 .
2200 [XPointerElement]
2201 Grosso, P., Maler, E., Marsh, J., and N. Walsh, "XPointer
2202 element() Scheme", W3C Recommendation REC-xptr-element,
2203 March 2003,
2204 .
2206 [XPointerFramework]
2207 Grosso, P., Maler, E., Marsh, J., and N. Walsh, "XPointer
2208 Framework", W3C Recommendation REC-XPointer-Framework,
2209 March 2003,
2210 .
2212 16.2. Informative References
2214 [AN1796] Linke, B., "Overview of 1-Wire Technology and Its Use",
2215 June 2008,
2216 .
2218 [I-D.ietf-cbor-cddl]
2219 Birkholz, H., Vigano, C., and C. Bormann, "Concise data
2220 definition language (CDDL): a notational convention to
2221 express CBOR data structures", draft-ietf-cbor-cddl-02
2222 (work in progress), February 2018.
2224 [I-D.ietf-core-dev-urn]
2225 Arkko, J., Jennings, C., and Z. Shelby, "Uniform Resource
2226 Names for Device Identifiers", draft-ietf-core-dev-urn-01
2227 (work in progress), March 2018.
2229 [I-D.ietf-core-interfaces]
2230 Shelby, Z., Vial, M., Koster, M., Groves, C., Zhu, J., and
2231 B. Silverajan, "Reusable Interface Definitions for
2232 Constrained RESTful Environments", draft-ietf-core-
2233 interfaces-11 (work in progress), March 2018.
2235 [IEEE802.1as-2011]
2236 IEEE, "IEEE Standard for Local and Metropolitan Area
2237 Networks - Timing and Synchronization for Time-Sensitive
2238 Applications in Bridged Local Area Networks", 2011.
2240 [IEEE802.1ba-2011]
2241 IEEE, "IEEE Standard for Local and metropolitan area
2242 networks--Audio Video Bridging (AVB) Systems", 2011.
2244 [ISO-80000-5]
2245 "Quantities and units - Part 5: Thermodynamics",
2246 ISO 80000-5, Edition 1.0, May 2007.
2248 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818,
2249 DOI 10.17487/RFC2818, May 2000,
2250 .
2252 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
2253 Resource Identifier (URI): Generic Syntax", STD 66,
2254 RFC 3986, DOI 10.17487/RFC3986, January 2005,
2255 .
2257 [RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally
2258 Unique IDentifier (UUID) URN Namespace", RFC 4122,
2259 DOI 10.17487/RFC4122, July 2005,
2260 .
2262 [RFC4151] Kindberg, T. and S. Hawke, "The 'tag' URI Scheme",
2263 RFC 4151, DOI 10.17487/RFC4151, October 2005,
2264 .
2266 [RFC4944] Montenegro, G., Kushalnagar, N., Hui, J., and D. Culler,
2267 "Transmission of IPv6 Packets over IEEE 802.15.4
2268 Networks", RFC 4944, DOI 10.17487/RFC4944, September 2007,
2269 .
2271 [RFC5751] Ramsdell, B. and S. Turner, "Secure/Multipurpose Internet
2272 Mail Extensions (S/MIME) Version 3.2 Message
2273 Specification", RFC 5751, DOI 10.17487/RFC5751, January
2274 2010, .
2276 [RFC5952] Kawamura, S. and M. Kawashima, "A Recommendation for IPv6
2277 Address Text Representation", RFC 5952,
2278 DOI 10.17487/RFC5952, August 2010,
2279 .
2281 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link
2282 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012,
2283 .
2285 [RFC6920] Farrell, S., Kutscher, D., Dannewitz, C., Ohlman, B.,
2286 Keranen, A., and P. Hallam-Baker, "Naming Things with
2287 Hashes", RFC 6920, DOI 10.17487/RFC6920, April 2013,
2288 .
2290 [RFC6973] Cooper, A., Tschofenig, H., Aboba, B., Peterson, J.,
2291 Morris, J., Hansen, M., and R. Smith, "Privacy
2292 Considerations for Internet Protocols", RFC 6973,
2293 DOI 10.17487/RFC6973, July 2013,
2294 .
2296 [RFC7111] Hausenblas, M., Wilde, E., and J. Tennison, "URI Fragment
2297 Identifiers for the text/csv Media Type", RFC 7111,
2298 DOI 10.17487/RFC7111, January 2014,
2299 .
2301 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
2302 Protocol (HTTP/1.1): Message Syntax and Routing",
2303 RFC 7230, DOI 10.17487/RFC7230, June 2014,
2304 .
2306 [RFC7721] Cooper, A., Gont, F., and D. Thaler, "Security and Privacy
2307 Considerations for IPv6 Address Generation Mechanisms",
2308 RFC 7721, DOI 10.17487/RFC7721, March 2016,
2309 .
2311 [RFC8141] Saint-Andre, P. and J. Klensin, "Uniform Resource Names
2312 (URNs)", RFC 8141, DOI 10.17487/RFC8141, April 2017,
2313 .
2315 [UCUM] Schadow, G. and C. McDonald, "The Unified Code for Units
2316 of Measure (UCUM)", Regenstrief Institute and Indiana
2317 University School of Informatics, 2013,
2318 .
2320 Authors' Addresses
2322 Cullen Jennings
2323 Cisco
2324 400 3rd Avenue SW
2325 Calgary, AB T2P 4H2
2326 Canada
2328 Email: fluffy@iii.ca
2330 Zach Shelby
2331 ARM
2332 150 Rose Orchard
2333 San Jose 95134
2334 USA
2336 Phone: +1-408-203-9434
2337 Email: zach.shelby@arm.com
2339 Jari Arkko
2340 Ericsson
2341 Jorvas 02420
2342 Finland
2344 Email: jari.arkko@piuha.net
2345 Ari Keranen
2346 Ericsson
2347 Jorvas 02420
2348 Finland
2350 Email: ari.keranen@ericsson.com
2352 Carsten Bormann
2353 Universitaet Bremen TZI
2354 Postfach 330440
2355 Bremen D-28359
2356 Germany
2358 Phone: +49-421-218-63921
2359 Email: cabo@tzi.org