Network Working Group | C. Jennings |
Internet-Draft | Cisco |
Intended status: Standards Track | Z. Shelby |
Expires: June 17, 2018 | ARM |
J. Arkko | |
A. Keranen | |
Ericsson | |
C. Bormann | |
Universitaet Bremen TZI | |
December 14, 2017 |
Media Types for Sensor Measurement Lists (SenML)
draft-ietf-core-senml-12
This specification defines media types for representing simple sensor measurements and device parameters in the Sensor Measurement Lists (SenML). Representations are defined in JavaScript Object Notation (JSON), Concise Binary Object Representation (CBOR), eXtensible Markup Language (XML), and Efficient XML Interchange (EXI), which share the common SenML data model. A simple sensor, such as a temperature sensor, could use this media type in protocols such as HTTP or CoAP to transport the measurements of the sensor or to be configured.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on June 17, 2018.
Copyright (c) 2017 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
Connecting sensors to the Internet is not new, and there have been many protocols designed to facilitate it. This specification defines new media types for carrying simple sensor information in a protocol such as HTTP or CoAP. This format was designed so that processors with very limited capabilities could easily encode a sensor measurement into the media type, while at the same time a server parsing the data could relatively efficiently collect a large number of sensor measurements. SenML can be used for a variety of data flow models, most notably data feeds pushed from a sensor to a collector, and the web resource model where the sensor is requested as a resource representation (e.g., “GET /sensor/temperature”).
There are many types of more complex measurements and measurements that this media type would not be suitable for. SenML strikes a balance between having some information about the sensor carried with the sensor data so that the data is self describing but it also tries to make that a fairly minimal set of auxiliary information for efficiency reason. Other information about the sensor can be discovered by other methods such as using the CoRE Link Format [RFC6690].
SenML is defined by a data model for measurements and simple meta-data about measurements and devices. The data is structured as a single array that contains a series of SenML Records which can each contain fields such as an unique identifier for the sensor, the time the measurement was made, the unit the measurement is in, and the current value of the sensor. Serializations for this data model are defined for JSON [RFC7159], CBOR [RFC7049], XML, and Efficient XML Interchange (EXI) [W3C.REC-exi-20140211].
For example, the following shows a measurement from a temperature gauge encoded in the JSON syntax.
[ {"n":"urn:dev:ow:10e2073a01080063","u":"Cel","v":23.1} ]
In the example above, the array has a single SenML Record with a measurement for a sensor named “urn:dev:ow:10e2073a01080063” with a current value of 23.1 degrees Celsius.
The design goal is to be able to send simple sensor measurements in small packets from large numbers of constrained devices. Keeping the total size of payload small makes it easy to use SenML also in constrained networks, e.g., in a 6LoWPAN [RFC4944]. It is always difficult to define what small code is, but there is a desire to be able to implement this in roughly 1 KB of flash on a 8 bit microprocessor. Experience with power meters and other large scale deployments has indicated that the solution needs to support allowing multiple measurements to be batched into a single HTTP or CoAP request. This “batch” upload capability allows the server side to efficiently support a large number of devices. It also conveniently supports batch transfers from proxies and storage devices, even in situations where the sensor itself sends just a single data item at a time. The multiple measurements could be from multiple related sensors or from the same sensor but at different times.
The basic design is an array with a series of measurements. The following example shows two measurements made at different times. The value of a measurement is given by the “v” field, the time of a measurement is in the “t” field, the “n” field has a unique sensor name, and the unit of the measurement is carried in the “u” field.
[ {"n":"urn:dev:ow:10e2073a01080063","u":"Cel","t":1.276020076e+09, "v":23.5}, {"n":"urn:dev:ow:10e2073a01080063","u":"Cel","t":1.276020091e+09, "v":23.6} ]
To keep the messages small, it does not make sense to repeat the “n” field in each SenML Record so there is a concept of a Base Name which is simply a string that is prepended to the Name field of all elements in that record and any records that follow it. So a more compact form of the example above is the following.
[ {"bn":"urn:dev:ow:10e2073a01080063","u":"Cel","t":1.276020076e+09, "v":23.5}, {"u":"Cel","t":1.276020091e+09, "v":23.6} ]
In the above example the Base Name is in the “bn” field and the “n” fields in each Record are the empty string so they are omitted.
Some devices have accurate time while others do not so SenML supports absolute and relative times. Time is represented in floating point as seconds and values greater than zero represent an absolute time relative to the Unix epoch while values of 0 or less represent a relative time in the past from the current time. A simple sensor with no absolute wall clock time might take a measurement every second, batch up 60 of them, and then send the batch to a server. It would include the relative time each measurement was made compared to the time the batch was sent in each SenML Record. The server might have accurate NTP time and use the time it received the data, and the relative offset, to replace the times in the SenML with absolute times before saving the SenML Pack in a document database.
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC2119].
This document also uses the following terms:
This document uses the terms “attribute” and “tag” where they occur with the underlying technologies (XML, CBOR [RFC7049], and Link Format [RFC6690]), not for SenML concepts per se. Note that “attribute” has been widely used previously as a synonym for SenML “field”, though.
Each SenML Pack carries a single array that represents a set of measurements and/or parameters. This array contains a series of SenML Records with several fields described below. There are two kinds of fields: base and regular. The base fields can be included in any SenML Record and they apply to the entries in the Record. Each base field also applies to all Records after it up to, but not including, the next Record that has that same base field. All base fields are optional. Regular fields can be included in any SenML Record and apply only to that Record.
Table 1 provides an overview of all SenML fields defined by this document with their respective labels and data types.
Name | Label | CBOR Label | JSON Type | XML Type |
---|---|---|---|---|
Base Name | bn | -2 | String | string |
Base Time | bt | -3 | Number | double |
Base Unit | bu | -4 | String | string |
Base Value | bv | -5 | Number | double |
Base Sum | bs | -6 | Number | double |
Version | bver | -1 | Number | int |
Name | n | 0 | String | string |
Unit | u | 1 | String | string |
Value | v | 2 | Number | double |
String Value | vs | 3 | String | string |
Boolean Value | vb | 4 | Boolean | boolean |
Data Value | vd | 8 | String (*) | string (*) |
Value Sum | s | 5 | Number | double |
Time | t | 6 | Number | double |
Update Time | ut | 7 | Number | double |
Data Value is base64 encoded string with URL safe alphabet as defined in Section 5 of [RFC4648], with padding omitted.
For details of the JSON representation see Section 5, for the CBOR Section 6, and for the XML Section 7.
The SenML format can be extended with further custom fields. Both new base and regular fields are allowed. See Section 12.2 for details. Implementations MUST ignore fields they don’t recognize unless that field has a label name that ends with the ‘_’ character in which case an error MUST be generated.
All SenML Records in a Pack MUST have the same version number. This is typically done by adding a Base Version field to only the first Record in the Pack.
Systems reading one of the objects MUST check for the Version field. If this value is a version number larger than the version which the system understands, the system SHOULD NOT use this object. This allows the version number to indicate that the object contains structure or semantics that is different from what is defined in the present document beyond just making use of the extension points provided here. New version numbers can only be defined in an RFC that updates this specification or it successors.
The Name value is concatenated to the Base Name value to yield the name of the sensor. The resulting concatenated name needs to uniquely identify and differentiate the sensor from all others. The concatenated name MUST consist only of characters out of the set “A” to “Z”, “a” to “z”, “0” to “9”, “-“, “:”, “.”, “/”, and “_”; furthermore, it MUST start with a character out of the set “A” to “Z”, “a” to “z”, or “0” to “9”. This restricted character set was chosen so that concatenated names can be used directly within various URI schemes (including segments of an HTTP path with no special encoding) and can be used directly in many databases and analytic systems. [RFC5952] contains advice on encoding an IPv6 address in a name. See Section 14 for privacy considerations that apply to the use of long-term stable unique identifiers.
Although it is RECOMMENDED that concatenated names are represented as URIs [RFC3986] or URNs [RFC8141], the restricted character set specified above puts strict limits on the URI schemes and URN namespaces that can be used. As a result, implementers need to take care in choosing the naming scheme for concatenated names, because such names both need to be unique and need to conform to the restricted character set. One approach is to include a bit string that has guaranteed uniqueness (such as a 1-wire address). Some of the examples within this document use the device URN namespace as specified in [I-D.arkko-core-dev-urn]. UUIDs [RFC4122] are another way to generate a unique name. However, the restricted character set does not allow the use of many URI schemes in names as such. The use of URIs with characters incompatible with this set, and possible mapping rules between the two, are outside of the scope of the present document.
If the Record has no Unit, the Base Unit is used as the Unit. Having no Unit and no Base Unit is allowed.
If either the Base Time or Time value is missing, the missing field is considered to have a value of zero. The Base Time and Time values are added together to get the time of measurement. A time of zero indicates that the sensor does not know the absolute time and the measurement was made roughly “now”. A negative value is used to indicate seconds in the past from roughly “now”. A positive value is used to indicate the number of seconds, excluding leap seconds, since the start of the year 1970 in UTC.
If only one of the Base Sum or Sum value is present, the missing field is considered to have a value of zero. The Base Sum and Sum values are added together to get the sum of measurement. If neither the Base Sum or Sum are present, then the measurement does not have a sum value.
If the Base Value or Value is not present, the missing field(s) are considered to have a value of zero. The Base Value and Value are added together to get the value of the measurement.
Representing the statistical characteristics of measurements, such as accuracy, can be very complex. Future specification may add new fields to provide better information about the statistical properties of the measurement.
In summary, the structure of a SenML record is laid out to support a single measurement per record. If multiple data values are measured at the same time (e.g., air pressure and altitude), they are best kept as separate records linked through their Time value; this is even true where one of the data values is more “meta” than others (e.g., describes a condition that influences other measurements at the same time).
Sometimes it is useful to be able to refer to a defined normalized format for SenML records. This normalized format tends to get used for big data applications and intermediate forms when converting to other formats.
A SenML Record is referred to as “resolved” if it does not contain any base values, i.e., labels starting with the character ‘b’, except for Version fields (see below), and has no relative times. To resolve the records, the base values of the SenML Pack (if any) are applied to the Record. That is, name and base name are concatenated, base time is added to the time of the Record, if the Record did not contain Unit the Base Unit is applied to the record, etc. In addition the records need to be in chronological order. An example of this is show in Section 5.1.4.
The Version field MUST NOT be present in resolved records if the SenML version defined in this document is used and MUST be present otherwise in all the resolved SenML Records.
Future specification that defines new base fields need to specify how the field is resolved.
SenML is designed to carry the minimum dynamic information about measurements, and for efficiency reasons does not carry significant static meta-data about the device, object or sensors. Instead, it is assumed that this meta-data is carried out of band. For web resources using SenML Packs, this meta-data can be made available using the CoRE Link Format [RFC6690]. The most obvious use of this link format is to describe that a resource is available in a SenML format in the first place. The relevant media type indicator is included in the Content-Type (ct=) link attribute (which is defined for the Link Format in Section 7.2.1 of [RFC7252]).
SenML can also be used for configuring parameters and controlling actuators. When a SenML Pack is sent (e.g., using a HTTP/CoAP POST or PUT method) and the semantics of the target are such that SenML is interpreted as configuration/actuation, SenML Records are interpreted as a request to change the values of given (sub)resources (given as names) to given values at the given time(s). The semantics of the target resource supporting this usage can be described, e.g., using [I-D.ietf-core-interfaces]. Examples of actuation usage are shown in Section 5.1.7.
For the SenML fields shown in Table 2, the SenML labels are used as the JSON object member names within JSON objects representing the JSON SenML Records.
Name | label | Type |
---|---|---|
Base Name | bn | String |
Base Time | bt | Number |
Base Unit | bu | String |
Base Value | bv | Number |
Base Sum | bs | Number |
Version | bver | Number |
Name | n | String |
Unit | u | String |
Value | v | Number |
String Value | vs | String |
Boolean Value | vb | Boolean |
Data Value | vd | String |
Value Sum | s | Number |
Time | t | Number |
Update Time | ut | Number |
The root JSON value consists of an array with one JSON object for each SenML Record. All the fields in the above table MAY occur in the records with member values of the type specified in the table.
Only the UTF-8 form of JSON is allowed. Characters in the String Value are encoded using the escape sequences defined in [RFC7159]. Octets in the Data Value are base64 encoded with URL safe alphabet as defined in Section 5 of [RFC4648], with padding omitted.
Systems receiving measurements MUST be able to process the range of floating point numbers that are representable as an IEEE double precision floating point numbers [IEEE.754.1985]. The number of significant digits in any measurement is not relevant, so a reading of 1.1 has exactly the same semantic meaning as 1.10. If the value has an exponent, the “e” MUST be in lower case. The mantissa SHOULD be less than 19 characters long and the exponent SHOULD be less than 5 characters long. This allows time values to have better than micro second precision over the next 100 years.
The following shows a temperature reading taken approximately “now” by a 1-wire sensor device that was assigned the unique 1-wire address of 10e2073a01080063:
[ {"n":"urn:dev:ow:10e2073a01080063","u":"Cel","v":23.1} ]
The following example shows voltage and current now, i.e., at an unspecified time.
[ {"bn":"urn:dev:ow:10e2073a01080063:","n":"voltage","u":"V","v":120.1}, {"n":"current","u":"A","v":1.2} ]
The next example is similar to the above one, but shows current at Tue Jun 8 18:01:16.001 UTC 2010 and at each second for the previous 5 seconds.
[ {"bn":"urn:dev:ow:10e2073a0108006:","bt":1.276020076001e+09, "bu":"A","bver":5, "n":"voltage","u":"V","v":120.1}, {"n":"current","t":-5,"v":1.2}, {"n":"current","t":-4,"v":1.3}, {"n":"current","t":-3,"v":1.4}, {"n":"current","t":-2,"v":1.5}, {"n":"current","t":-1,"v":1.6}, {"n":"current","v":1.7} ]
Note that in some usage scenarios of SenML the implementations MAY store or transmit SenML in a stream-like fashion, where data is collected over time and continuously added to the object. This mode of operation is optional, but systems or protocols using SenML in this fashion MUST specify that they are doing this. SenML defines a separate media type to indicate Sensor Streaming Measurement Lists (SensML) for this usage (see Section 12.3.2). In this situation the SensML stream can be sent and received in a partial fashion, i.e., a measurement entry can be read as soon as the SenML Record is received and not have to wait for the full SensML Stream to be complete.
For instance, the following stream of measurements may be sent via a long lived HTTP POST from the producer of a SensML to the consumer of that, and each measurement object may be reported at the time it was measured:
[ {"bn":"urn:dev:ow:10e2073a01080063","bt":1.320067464e+09, "bu":"%RH","v":21.2}, {"t":10,"v":21.3}, {"t":20,"v":21.4}, {"t":30,"v":21.4}, {"t":40,"v":21.5}, {"t":50,"v":21.5}, {"t":60,"v":21.5}, {"t":70,"v":21.6}, {"t":80,"v":21.7}, ...
The following example shows humidity measurements from a mobile device with a 1-wire address 10e2073a01080063, starting at Mon Oct 31 13:24:24 UTC 2011. The device also provides position data, which is provided in the same measurement or parameter array as separate entries. Note time is used to for correlating data that belongs together, e.g., a measurement and a parameter associated with it. Finally, the device also reports extra data about its battery status at a separate time.
[ {"bn":"urn:dev:ow:10e2073a01080063","bt":1.320067464e+09, "bu":"%RH","v":20}, {"u":"lon","v":24.30621}, {"u":"lat","v":60.07965}, {"t":60,"v":20.3}, {"u":"lon","t":60,"v":24.30622}, {"u":"lat","t":60,"v":60.07965}, {"t":120,"v":20.7}, {"u":"lon","t":120,"v":24.30623}, {"u":"lat","t":120,"v":60.07966}, {"u":"%EL","t":150,"v":98}, {"t":180,"v":21.2}, {"u":"lon","t":180,"v":24.30628}, {"u":"lat","t":180,"v":60.07967} ]
The size of this example represented in various forms, as well as that form compressed with gzip is given in the following table.
Encoding | Size | Compressed Size |
---|---|---|
JSON | 573 | 206 |
XML | 649 | 235 |
CBOR | 254 | 196 |
EXI | 161 | 184 |
The following shows the example from the previous section show in resolved format.
[ {"n":"urn:dev:ow:10e2073a01080063","u":"%RH","t":1.320067464e+09, "v":20}, {"n":"urn:dev:ow:10e2073a01080063","u":"lon","t":1.320067464e+09, "v":24.30621}, {"n":"urn:dev:ow:10e2073a01080063","u":"lat","t":1.320067464e+09, "v":60.07965}, {"n":"urn:dev:ow:10e2073a01080063","u":"%RH","t":1.320067524e+09, "v":20.3}, {"n":"urn:dev:ow:10e2073a01080063","u":"lon","t":1.320067524e+09, "v":24.30622}, {"n":"urn:dev:ow:10e2073a01080063","u":"lat","t":1.320067524e+09, "v":60.07965}, {"n":"urn:dev:ow:10e2073a01080063","u":"%RH","t":1.320067584e+09, "v":20.7}, {"n":"urn:dev:ow:10e2073a01080063","u":"lon","t":1.320067584e+09, "v":24.30623}, {"n":"urn:dev:ow:10e2073a01080063","u":"lat","t":1.320067584e+09, "v":60.07966}, {"n":"urn:dev:ow:10e2073a01080063","u":"%EL","t":1.320067614e+09, "v":98}, {"n":"urn:dev:ow:10e2073a01080063","u":"%RH","t":1.320067644e+09, "v":21.2}, {"n":"urn:dev:ow:10e2073a01080063","u":"lon","t":1.320067644e+09, "v":24.30628}, {"n":"urn:dev:ow:10e2073a01080063","u":"lat","t":1.320067644e+09, "v":60.07967} ]
The following example shows a sensor that returns different data types.
[ {"bn":"urn:dev:ow:10e2073a01080063:","n":"temp","u":"Cel","v":23.1}, {"n":"label","vs":"Machine Room"}, {"n":"open","vb":false}, {"n":"nfv-reader","vd":"aGkgCg"} ]
The following example shows the results from a query to one device that aggregates multiple measurements from another devices. The example assumes that a client has fetched information from a device at 2001:db8::2 by performing a GET operation on http://[2001:db8::2] at Mon Oct 31 16:27:09 UTC 2011, and has gotten two separate values as a result, a temperature and humidity measurement as well as the results from another device at http://[2001:db8::1] that also had a temperature and humidity. Note that the last record would use the Base Name from the 3rd record but the Base Time from the first record.
[ {"bn":"2001:db8::2/","bt":1.320078429e+09, "n":"temperature","u":"Cel","v":25.2}, {"n":"humidity","u":"%RH","v":30}, {"bn":"2001:db8::1/","n":"temperature","u":"Cel","v":12.3}, {"n":"humidity","u":"%RH","v":67} ]
The following example show the SenML that could be used to set the current set point of a typical residential thermostat which has a temperature set point, a switch to turn on and off the heat, and a switch to turn on the fan override.
[ {"bn":"urn:dev:ow:10e2073a01080063:"}, {"n":"temp","u":"Cel","v":23.1}, {"n":"heat","u":"/","v":1}, {"n":"fan","u":"/","v":0} ]
In the following example two different lights are turned on. It is assumed that the lights are on a network that can guarantee delivery of the messages to the two lights within 15 ms (e.g. a network using 802.1BA [IEEE802.1ba-2011] and 802.1AS [IEEE802.1as-2011] for time synchronization). The controller has set the time of the lights coming on to 20 ms in the future from the current time. This allows both lights to receive the message, wait till that time, then apply the switch command so that both lights come on at the same time.
[ {"bt":1.320078429e+09,"bu":"/","n":"2001:db8::3","v":1}, {"n":"2001:db8::4","v":1} ]
The following shows two lights being turned off using a non deterministic network that has a high odds of delivering a message in less than 100 ms and uses NTP for time synchronization. The current time is 1320078429. The user has just turned off a light switch which is turning off two lights. Both lights are dimmed to 50% brightness immediately to give the user instant feedback that something is changing. However given the network, the lights will probably dim at somewhat different times. Then 100 ms in the future, both lights will go off at the same time. The instant but not synchronized dimming gives the user the sensation of quick responses and the timed off 100 ms in the future gives the perception of both lights going off at the same time.
[ {"bt":1.320078429e+09,"bu":"/","n":"2001:db8::3","v":0.5}, {"n":"2001:db8::4","v":0.5}, {"n":"2001:db8::3","t":0.1,"v":0}, {"n":"2001:db8::4","t":0.1,"v":0} ]
The CBOR [RFC7049] representation is equivalent to the JSON representation, with the following changes:
Name | Label | CBOR Label |
---|---|---|
Version | bver | -1 |
Base Name | bn | -2 |
Base Time | bt | -3 |
Base Unit | bu | -4 |
Base Value | bv | -5 |
Base Sum | bs | -6 |
Name | n | 0 |
Unit | u | 1 |
Value | v | 2 |
String Value | vs | 3 |
Boolean Value | vb | 4 |
Value Sum | s | 5 |
Time | t | 6 |
Update Time | ut | 7 |
Data Value | vd | 8 |
The following example shows a dump of the CBOR example for the same sensor measurement as in Section 5.1.2.
0000 87 a7 21 78 1b 75 72 6e 3a 64 65 76 3a 6f 77 3a |..!x.urn:dev:ow:| 0010 31 30 65 32 30 37 33 61 30 31 30 38 30 30 36 3a |10e2073a0108006:| 0020 22 fb 41 d3 03 a1 5b 00 10 62 23 61 41 20 05 00 |".A...[..b#aA ..| 0030 67 76 6f 6c 74 61 67 65 01 61 56 02 fb 40 5e 06 |gvoltage.aV..@^.| 0040 66 66 66 66 66 a3 00 67 63 75 72 72 65 6e 74 06 |fffff..gcurrent.| 0050 24 02 fb 3f f3 33 33 33 33 33 33 a3 00 67 63 75 |$..?.333333..gcu| 0060 72 72 65 6e 74 06 23 02 fb 3f f4 cc cc cc cc cc |rrent.#..?......| 0070 cd a3 00 67 63 75 72 72 65 6e 74 06 22 02 fb 3f |...gcurrent."..?| 0080 f6 66 66 66 66 66 66 a3 00 67 63 75 72 72 65 6e |.ffffff..gcurren| 0090 74 06 21 02 f9 3e 00 a3 00 67 63 75 72 72 65 6e |t.!..>...gcurren| 00a0 74 06 20 02 fb 3f f9 99 99 99 99 99 9a a3 00 67 |t. ..?.........g| 00b0 63 75 72 72 65 6e 74 06 00 02 fb 3f fb 33 33 33 |current....?.333| 00c0 33 33 33 |333| 00c3
In CBOR diagnostic notation (Section 6 of [RFC7049]), this is:
[{-2: "urn:dev:ow:10e2073a0108006:", -3: 1276020076.001, -4: "A", -1: 5, 0: "voltage", 1: "V", 2: 120.1}, {0: "current", 6: -5, 2: 1.2}, {0: "current", 6: -4, 2: 1.3}, {0: "current", 6: -3, 2: 1.4}, {0: "current", 6: -2, 2: 1.5}, {0: "current", 6: -1, 2: 1.6}, {0: "current", 6: 0, 2: 1.7}]
A SenML Pack or Stream can also be represented in XML format as defined in this section.
Only the UTF-8 form of XML is allowed. Characters in the String Value are encoded using the escape sequences defined in [RFC7159]. Octets in the Data Value are base64 encoded with URL safe alphabet as defined in Section 5 of [RFC4648].
The following example shows an XML example for the same sensor measurement as in Section 5.1.2.
<sensml xmlns="urn:ietf:params:xml:ns:senml"> <senml bn="urn:dev:ow:10e2073a0108006:" bt="1.276020076001e+09" bu="A" bver="5" n="voltage" u="V" v="120.1"></senml> <senml n="current" t="-5" v="1.2"></senml> <senml n="current" t="-4" v="1.3"></senml> <senml n="current" t="-3" v="1.4"></senml> <senml n="current" t="-2" v="1.5"></senml> <senml n="current" t="-1" v="1.6"></senml> <senml n="current" v="1.7"></senml> </sensml>
The SenML Stream is represented as a sensml element that contains a series of senml elements for each SenML Record. The SenML fields are represented as XML attributes. For each field defined in this document, the following table shows the SenML labels, which are used for the XML attribute name, as well as the according restrictions on the XML attribute values (“type”) as used in the XML senml elements.
Name | Label | Type |
---|---|---|
Base Name | bn | string |
Base Time | bt | double |
Base Unit | bu | string |
Base Value | bv | double |
Base Sum | bs | double |
Base Version | bver | int |
Name | n | string |
Unit | u | string |
Value | v | double |
String Value | vs | string |
Data Value | vd | string |
Boolean Value | vb | boolean |
Value Sum | s | double |
Time | t | double |
Update Time | ut | double |
The RelaxNG schema for the XML is:
default namespace = "urn:ietf:params:xml:ns:senml" namespace rng = "http://relaxng.org/ns/structure/1.0" senml = element senml { attribute bn { xsd:string }?, attribute bt { xsd:double }?, attribute bv { xsd:double }?, attribute bs { xsd:double }?, attribute bu { xsd:string }?, attribute bver { xsd:int }?, attribute n { xsd:string }?, attribute s { xsd:double }?, attribute t { xsd:double }?, attribute u { xsd:string }?, attribute ut { xsd:double }?, attribute v { xsd:double }?, attribute vb { xsd:boolean }?, attribute vs { xsd:string }?, attribute vd { xsd:string }? } sensml = element sensml { senml+ } start = sensml
For efficient transmission of SenML over e.g. a constrained network, Efficient XML Interchange (EXI) can be used. This encodes the XML Schema structure of SenML into binary tags and values rather than ASCII text. An EXI representation of SenML SHOULD be made using the strict schema-mode of EXI. This mode however does not allow tag extensions to the schema, and therefore any extensions will be lost in the encoding. For uses where extensions need to be preserved in EXI, the non-strict schema mode of EXI MAY be used.
The EXI header MUST include an “EXI Options”, as defined in [W3C.REC-exi-20140211], with an schemaId set to the value of “a” indicating the schema provided in this specification. Future revisions to the schema can change the value of the schemaId to allow for backwards compatibility. When the data will be transported over CoAP or HTTP, an EXI Cookie SHOULD NOT be used as it simply makes things larger and is redundant to information provided in the Content-Type header.
The following is the XSD Schema to be used for strict schema guided EXI processing. It is generated from the RelaxNG.
<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:ietf:params:xml:ns:senml" xmlns:ns1="urn:ietf:params:xml:ns:senml"> <xs:element name="senml"> <xs:complexType> <xs:attribute name="bn" type="xs:string" /> <xs:attribute name="bt" type="xs:double" /> <xs:attribute name="bv" type="xs:double" /> <xs:attribute name="bs" type="xs:double" /> <xs:attribute name="bu" type="xs:string" /> <xs:attribute name="bver" type="xs:int" /> <xs:attribute name="n" type="xs:string" /> <xs:attribute name="s" type="xs:double" /> <xs:attribute name="t" type="xs:double" /> <xs:attribute name="u" type="xs:string" /> <xs:attribute name="ut" type="xs:double" /> <xs:attribute name="v" type="xs:double" /> <xs:attribute name="vb" type="xs:boolean" /> <xs:attribute name="vs" type="xs:string" /> <xs:attribute name="vd" type="xs:string" /> </xs:complexType> </xs:element> <xs:element name="sensml"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" ref="ns1:senml" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
The following shows a hexdump of the EXI produced from encoding the following XML example. Note this example is the same information as the first example in Section 5.1.2 in JSON format.
<sensml xmlns="urn:ietf:params:xml:ns:senml"> <senml bn="urn:dev:ow:10e2073a01080063:" n="voltage" u="V" v="120.1"></senml> <senml n="current" u="A" v="1.2"></senml> </sensml>
Which compresses with EXI to the following displayed in hexdump:
0000 a0 30 0d 84 80 f3 ab 93 71 d3 23 2b b1 d3 7b b9 |.0......q.#+..{.| 0010 d1 89 83 29 91 81 b9 9b 09 81 89 81 c1 81 81 b1 |...)............| 0020 99 d2 84 bb 37 b6 3a 30 b3 b2 90 1a b1 58 84 c0 |....7.:0.....X..| 0030 33 04 b1 ba b9 39 32 b7 3a 10 1a 09 06 40 38 |3....92.:....@8| 003f
The above example used the bit packed form of EXI but it is also possible to use a byte packed form of EXI which can makes it easier for a simple sensor to produce valid EXI without really implementing EXI. Consider the example of a temperature sensor that produces a value in tenths of degrees Celsius over a range of 0.0 to 55.0. It would produce an XML SenML file such as:
<sensml xmlns="urn:ietf:params:xml:ns:senml"> <senml n="urn:dev:ow:10e2073a01080063" u="Cel" v="23.1"></senml> </sensml>
The compressed form, using the byte alignment option of EXI, for the above XML is the following:
0000 a0 00 48 80 6c 20 01 06 1d 75 72 6e 3a 64 65 76 |..H.l ...urn:dev| 0010 3a 6f 77 3a 31 30 65 32 30 37 33 61 30 31 30 38 |:ow:10e2073a0108| 0020 30 30 36 33 02 05 43 65 6c 01 00 e7 01 01 00 03 |0063..Cel.......| 0030 01 |.| 0031
A small temperature sensor device that only generates this one EXI file does not really need an full EXI implementation. It can simply hard code the output replacing the 1-wire device ID starting at byte 0x20 and going to byte 0x2F with it’s device ID, and replacing the value “0xe7 0x01” at location 0x37 and 0x38 with the current temperature. The EXI Specification [W3C.REC-exi-20140211] contains the full information on how floating point numbers are represented, but for the purpose of this sensor, the temperature can be converted to an integer in tenths of degrees (231 in this example). EXI stores 7 bits of the integer in each byte with the top bit set to one if there are further bytes. So the first bytes at is set to low 7 bits of the integer temperature in tenths of degrees plus 0x80. In this example 231 & 0x7F + 0x80 = 0xE7. The second byte is set to the integer temperature in tenths of degrees right shifted 7 bits. In this example 231 » 7 = 0x01.
A SenML Pack typically consists of multiple SenML Records and for some applications it may be useful to be able to refer with a Fragment Identifier to a single record, or a set of records, in a Pack. The fragment identifier is only interpreted by a client and does not impact retrieval of a representation. The SenML Fragment Identification is modeled after CSV Fragment Identifiers [RFC7111].
To select a single SenML Record, the “rec” scheme followed by a single number is used. For the purpose of numbering records, the first record is at position 1. A range of records can be selected by giving the first and the last record number separated by a ‘-‘ character. Instead of the second number, the ‘*’ character can be used to indicate the last SenML Record in the Pack. A set of records can also be selected using a comma separated list of record positions or ranges.
(We use the term “selecting a record” for identifying it as part of the fragment, not in the sense of isolating it from the Pack — the record still needs to be interpreted as part of the Pack, e.g., using the base values defined in earlier records)
The 3rd SenML Record from “coap://example.com/temp” resource can be selected with:
coap://example.com/temp#rec=3
Records from 3rd to 6th can be selected with:
coap://example.com/temp#rec=3-6
Records from 19th to the last can be selected with:
coap://example.com/temp#rec=19-*
The 3rd and 5th record can be selected with:
coap://example.com/temp#rec=3,5
To select the Records from third to fifth, the 10th record, and all from 19th to the last:
coap://example.com/temp#rec=3-5,10,19-*
The measurements support sending both the current value of a sensor as well as the an integrated sum. For many types of measurements, the sum is more useful than the current value. For example, an electrical meter that measures the energy a given computer uses will typically want to measure the cumulative amount of energy used. This is less prone to error than reporting the power each second and trying to have something on the server side sum together all the power measurements. If the network between the sensor and the meter goes down over some period of time, when it comes back up, the cumulative sum helps reflect what happened while the network was down. A meter like this would typically report a measurement with the unit set to watts, but it would put the sum of energy used in the “s” field of the measurement. It might optionally include the current power in the “v” field.
While the benefit of using the integrated sum is fairly clear for measurements like power and energy, it is less obvious for something like temperature. Reporting the sum of the temperature makes it easy to compute averages even when the individual temperature values are not reported frequently enough to compute accurate averages. Implementers are encouraged to report the cumulative sum as well as the raw value of a given sensor.
Applications that use the cumulative sum values need to understand they are very loosely defined by this specification, and depending on the particular sensor implementation may behave in unexpected ways. Applications should be able to deal with the following issues:
Typically applications can make some assumptions about specific sensors that will allow them to deal with these problems. A common assumption is that for sensors whose measurement values are always positive, the sum should never get smaller; so if the sum does get smaller, the application will know that one of the situations listed above has happened.
For reference, the JSON and CBOR representations can be described with the common CDDL [I-D.ietf-cbor-cddl] specification in Figure 1.
SenML-Pack = [1* record] record = { ? bn => tstr, ; Base Name ? bt => numeric, ; Base Time ? bu => tstr, ; Base Units ? bv => numeric, ; Base Value ? bs => numeric, ; Base Sum ? bver => uint, ; Base Version ? n => tstr, ; Name ? u => tstr, ; Units ? s => numeric, ; Value Sum ? t => numeric, ; Time ? ut => numeric, ; Update Time ? ( v => numeric // ; Numeric Value vs => tstr // ; String Value vb => bool // ; Boolean Value vd => binary-value ) ; Data Value * key-value-pair } ; now define the generic versions key-value-pair = ( label => value ) label = non-b-label / b-label non-b-label = tstr .regexp "[A-Zac-z0-9][-_:.A-Za-z0-9]*" / uint b-label = tstr .regexp "b[-_:.A-Za-z0-9]+" / nint value = tstr / binary-value / numeric / bool numeric = number / decfrac
Figure 1: Common CDDL specification for CBOR and JSON SenML
For JSON, we use text labels and base64url-encoded binary data (Figure 2).
bver = "bver" n = "n" s = "s" bn = "bn" u = "u" t = "t" bt = "bt" v = "v" ut = "ut" bu = "bu" vs = "vs" vd = "vd" bv = "bv" vb = "vb" bs = "bs" binary-value = tstr ; base64url encoded
Figure 2: JSON-specific CDDL specification for SenML
For CBOR, we use integer labels and native binary data (Figure 3).
bver = -1 n = 0 s = 5 bn = -2 u = 1 t = 6 bt = -3 v = 2 ut = 7 bu = -4 vs = 3 vd = 8 bv = -5 vb = 4 bs = -6 binary-value = bstr
Figure 3: CBOR-specific CDDL specification for SenML
Note to RFC Editor: Please replace all occurrences of “RFC-AAAA” with the RFC number of this specification.
IANA will create a registry of SenML unit symbols. The primary purpose of this registry is to make sure that symbols uniquely map to give type of measurement. Definitions for many of these units can be found in location such as [NIST811] and [BIPM]. Units marked with an asterisk are NOT RECOMMENDED to be produced by new implementations, but are in active use and SHOULD be implemented by consumers that can use the related base units.
Symbol | Description | Type | Reference |
---|---|---|---|
m | meter | float | RFC-AAAA |
kg | kilogram | float | RFC-AAAA |
g | gram* | float | RFC-AAAA |
s | second | float | RFC-AAAA |
A | ampere | float | RFC-AAAA |
K | kelvin | float | RFC-AAAA |
cd | candela | float | RFC-AAAA |
mol | mole | float | RFC-AAAA |
Hz | hertz | float | RFC-AAAA |
rad | radian | float | RFC-AAAA |
sr | steradian | float | RFC-AAAA |
N | newton | float | RFC-AAAA |
Pa | pascal | float | RFC-AAAA |
J | joule | float | RFC-AAAA |
W | watt | float | RFC-AAAA |
C | coulomb | float | RFC-AAAA |
V | volt | float | RFC-AAAA |
F | farad | float | RFC-AAAA |
Ohm | ohm | float | RFC-AAAA |
S | siemens | float | RFC-AAAA |
Wb | weber | float | RFC-AAAA |
T | tesla | float | RFC-AAAA |
H | henry | float | RFC-AAAA |
Cel | degrees Celsius | float | RFC-AAAA |
lm | lumen | float | RFC-AAAA |
lx | lux | float | RFC-AAAA |
Bq | becquerel | float | RFC-AAAA |
Gy | gray | float | RFC-AAAA |
Sv | sievert | float | RFC-AAAA |
kat | katal | float | RFC-AAAA |
m2 | square meter (area) | float | RFC-AAAA |
m3 | cubic meter (volume) | float | RFC-AAAA |
l | liter (volume)* | float | RFC-AAAA |
m/s | meter per second (velocity) | float | RFC-AAAA |
m/s2 | meter per square second (acceleration) | float | RFC-AAAA |
m3/s | cubic meter per second (flow rate) | float | RFC-AAAA |
l/s | liter per second (flow rate)* | float | RFC-AAAA |
W/m2 | watt per square meter (irradiance) | float | RFC-AAAA |
cd/m2 | candela per square meter (luminance) | float | RFC-AAAA |
bit | bit (information content) | float | RFC-AAAA |
bit/s | bit per second (data rate) | float | RFC-AAAA |
lat | degrees latitude (note 1) | float | RFC-AAAA |
lon | degrees longitude (note 1) | float | RFC-AAAA |
pH | pH value (acidity; logarithmic quantity) | float | RFC-AAAA |
dB | decibel (logarithmic quantity) | float | RFC-AAAA |
dBW | decibel relative to 1 W (power level) | float | RFC-AAAA |
Bspl | bel (sound pressure level; logarithmic quantity)* | float | RFC-AAAA |
count | 1 (counter value) | float | RFC-AAAA |
/ | 1 (Ratio e.g., value of a switch, note 2) | float | RFC-AAAA |
% | 1 (Ratio e.g., value of a switch, note 2)* | float | RFC-AAAA |
%RH | Percentage (Relative Humidity) | float | RFC-AAAA |
%EL | Percentage (remaining battery energy level) | float | RFC-AAAA |
EL | seconds (remaining battery energy level) | float | RFC-AAAA |
1/s | 1 per second (event rate) | float | RFC-AAAA |
1/min | 1 per minute (event rate, “rpm”)* | float | RFC-AAAA |
beat/min | 1 per minute (Heart rate in beats per minute)* | float | RFC-AAAA |
beats | 1 (Cumulative number of heart beats)* | float | RFC-AAAA |
S/m | Siemens per meter (conductivity) | float | RFC-AAAA |
New entries can be added to the registration by Expert Review as defined in [RFC8126]. Experts should exercise their own good judgment but need to consider the following guidelines:
IANA will create a new registry for SenML labels. The initial content of the registry is:
Name | Label | CL | JSON Type | XML Type | EI | Reference |
---|---|---|---|---|---|---|
Base Name | bn | -2 | String | string | a | RFCXXXX |
Base Time | bt | -3 | Number | double | a | RFCXXXX |
Base Unit | bu | -4 | String | string | a | RFCXXXX |
Base Value | bv | -5 | Number | double | a | RFCXXXX |
Base Sum | bs | -6 | Number | double | a | RFCXXXX |
Base Version | bver | -1 | Number | int | a | RFCXXXX |
Name | n | 0 | String | string | a | RFCXXXX |
Unit | u | 1 | String | string | a | RFCXXXX |
Value | v | 2 | Number | double | a | RFCXXXX |
String Value | vs | 3 | String | string | a | RFCXXXX |
Boolean Value | vb | 4 | Boolean | boolean | a | RFCXXXX |
Data Value | vd | 8 | String | string | a | RFCXXXX |
Value Sum | s | 5 | Number | double | a | RFCXXXX |
Time | t | 6 | Number | double | a | RFCXXXX |
Update Time | ut | 7 | Number | double | a | RFCXXXX |
This is the same table as Table 1, with notes removed, and with columns added for the information that is all the same for this initial set of registrations, but will need to be supplied with a different value for new registrations.
Note to RFC Editor. Please replace RFCXXXX with the number for this RFC.
All new entries must define the Label Name, Label, and XML Type but the CBOR labels SHOULD be left empty as CBOR will use the string encoding for any new labels. The EI column contains the EXI schemaId value of the first Schema which includes this label or is empty if this label was not intended for use with EXI. The Note field SHOULD contain information about where to find out more information about this label.
The JSON, CBOR, and EXI types are derived from the XML type. All XML numeric types such as double, float, integer and int become a JSON Number. XML boolean and string become a JSON Boolean and String respectively. CBOR represents numeric values with a CBOR type that does not lose any information from the JSON value. EXI uses the XML types.
New entries can be added to the registration by Expert Review as defined in [RFC8126]. Experts should exercise their own good judgment but need to consider that shorter labels should have more strict review. New entries should not be made that counteract the advice at the end of Section 4.4.
All new SenML labels that have “base” semantics (see Section 4.1) MUST start with the character ‘b’. Regular labels MUST NOT start with that character.
Extensions that add a label that is intended for use with XML need to create a new RelaxNG scheme that includes all the labels in the IANA registry.
Extensions that add a label that is intended for use with EXI need to create a new XSD Schema that includes all the labels in the IANA registry and then allocate a new EXI schemaId value. Moving to the next letter in the alphabet is the suggested way to create the new value for the EXI schemaId. Any labels with previously blank ID values SHOULD be updated in the IANA table to have their ID set to this new schemaId value.
Extensions that are mandatory to understand to correctly process the Pack MUST have a label name that ends with the ‘_’ character.
The following registrations are done following the procedure specified in [RFC6838] and [RFC7303]. Clipboard formats are defined for the JSON and XML form of lists but do not make sense for streams or other formats.
Note to RFC Editor - please remove this paragraph. Note that a request for media type review for senml+json was sent to the media-types@iana.org on Sept 21, 2010. A second request for all the types was sent on October 31, 2016. Please change all instances of RFC-AAAA with the RFC number of this document.
Type name: application
Subtype name: senml+json
Required parameters: none
Optional parameters: none
Encoding considerations: Must be encoded as using a subset of the encoding allowed in [RFC7159]. See RFC-AAAA for details. This simplifies implementation of very simple system and does not impose any significant limitations as all this data is meant for machine to machine communications and is not meant to be human readable.
Security considerations: See Section 13 of RFC-AAAA.
Interoperability considerations: Applications should ignore any JSON key value pairs that they do not understand. This allows backwards compatibility extensions to this specification. The “bver” field can be used to ensure the receiver supports a minimal level of functionality needed by the creator of the JSON object.
Published specification: RFC-AAAA
Applications that use this media type: The type is used by systems that report e.g., electrical power usage and environmental information such as temperature and humidity. It can be used for a wide range of sensor reporting systems.
Fragment identifier considerations: Fragment identification for application/senml+json is supported by using fragment identifiers as specified by RFC-AAAA.
Additional information:
Magic number(s): none
File extension(s): senml
Windows Clipboard Name: “JSON Sensor Measurement List”
Macintosh file type code(s): none
Macintosh Universal Type Identifier code: org.ietf.senml-json conforms to public.text
Person & email address to contact for further information: Cullen Jennings <fluffy@iii.ca>
Intended usage: COMMON
Restrictions on usage: None
Author: Cullen Jennings <fluffy@iii.ca>
Change controller: IESG
Type name: application
Subtype name: sensml+json
Required parameters: none
Optional parameters: none
Encoding considerations: Must be encoded as using a subset of the encoding allowed in [RFC7159]. See RFC-AAAA for details. This simplifies implementation of very simple system and does not impose any significant limitations as all this data is meant for machine to machine communications and is not meant to be human readable.
Security considerations: See Section 13 of RFC-AAAA.
Interoperability considerations: Applications should ignore any JSON key value pairs that they do not understand. This allows backwards compatibility extensions to this specification. The “bver” field can be used to ensure the receiver supports a minimal level of functionality needed by the creator of the JSON object.
Published specification: RFC-AAAA
Applications that use this media type: The type is used by systems that report e.g., electrical power usage and environmental information such as temperature and humidity. It can be used for a wide range of sensor reporting systems.
Fragment identifier considerations: Fragment identification for application/senml+json is supported by using fragment identifiers as specified by RFC-AAAA.
Additional information:
Magic number(s): none
File extension(s): sensml
Macintosh file type code(s): none
Person & email address to contact for further information: Cullen Jennings <fluffy@iii.ca>
Intended usage: COMMON
Restrictions on usage: None
Author: Cullen Jennings <fluffy@iii.ca>
Change controller: IESG
Type name: application
Subtype name: senml+cbor
Required parameters: none
Optional parameters: none
Encoding considerations: Must be encoded as using [RFC7049]. See RFC-AAAA for details.
Security considerations: See Section 13 of RFC-AAAA.
Interoperability considerations: Applications should ignore any key value pairs that they do not understand. This allows backwards compatibility extensions to this specification. The “bver” field can be used to ensure the receiver supports a minimal level of functionality needed by the creator of the CBOR object.
Published specification: RFC-AAAA
Applications that use this media type: The type is used by systems that report e.g., electrical power usage and environmental information such as temperature and humidity. It can be used for a wide range of sensor reporting systems.
Fragment identifier considerations: Fragment identification for application/senml+cbor is supported by using fragment identifiers as specified by RFC-AAAA.
Additional information:
Magic number(s): none
File extension(s): senmlc
Macintosh file type code(s): none
Macintosh Universal Type Identifier code: org.ietf.senml-cbor conforms to public.data
Person & email address to contact for further information: Cullen Jennings <fluffy@iii.ca>
Intended usage: COMMON
Restrictions on usage: None
Author: Cullen Jennings <fluffy@iii.ca>
Change controller: IESG
Type name: application
Subtype name: sensml+cbor
Required parameters: none
Optional parameters: none
Encoding considerations: Must be encoded as using [RFC7049]. See RFC-AAAA for details.
Security considerations: See Section 13 of RFC-AAAA.
Interoperability considerations: Applications should ignore any key value pairs that they do not understand. This allows backwards compatibility extensions to this specification. The “bver” field can be used to ensure the receiver supports a minimal level of functionality needed by the creator of the CBOR object.
Published specification: RFC-AAAA
Applications that use this media type: The type is used by systems that report e.g., electrical power usage and environmental information such as temperature and humidity. It can be used for a wide range of sensor reporting systems.
Fragment identifier considerations: Fragment identification for application/senml+cbor is supported by using fragment identifiers as specified by RFC-AAAA.
Additional information:
Magic number(s): none
File extension(s): sensmlc
Macintosh file type code(s): none
Person & email address to contact for further information: Cullen Jennings <fluffy@iii.ca>
Intended usage: COMMON
Restrictions on usage: None
Author: Cullen Jennings <fluffy@iii.ca>
Change controller: IESG
Type name: application
Subtype name: senml+xml
Required parameters: none
Optional parameters: none
Encoding considerations: Must be encoded as using [W3C.REC-xml-20081126]. See RFC-AAAA for details.
Security considerations: See Section 13 of RFC-AAAA.
Interoperability considerations: Applications should ignore any XML tags or attributes that they do not understand. This allows backwards compatibility extensions to this specification. The “bver” attribute in the senml XML tag can be used to ensure the receiver supports a minimal level of functionality needed by the creator of the XML.
Published specification: RFC-AAAA
Applications that use this media type: The type is used by systems that report e.g., electrical power usage and environmental information such as temperature and humidity. It can be used for a wide range of sensor reporting systems.
Fragment identifier considerations: Fragment identification for application/senml+xml is supported by using fragment identifiers as specified by RFC-AAAA.
Additional information:
Magic number(s): none
File extension(s): senmlx
Windows Clipboard Name: “XML Sensor Measurement List”
Macintosh file type code(s): none
Macintosh Universal Type Identifier code: org.ietf.senml-xml conforms to public.xml
Person & email address to contact for further information: Cullen Jennings <fluffy@iii.ca>
Intended usage: COMMON
Restrictions on usage: None
Author: Cullen Jennings <fluffy@iii.ca>
Change controller: IESG
Type name: application
Subtype name: sensml+xml
Required parameters: none
Optional parameters: none
Encoding considerations: Must be encoded as using [W3C.REC-xml-20081126]. See RFC-AAAA for details.
Security considerations: See Section 13 of RFC-AAAA.
Interoperability considerations: Applications should ignore any XML tags or attributes that they do not understand. This allows backwards compatibility extensions to this specification. The “bver” attribute in the senml XML tag can be used to ensure the receiver supports a minimal level of functionality needed by the creator of the XML.
Published specification: RFC-AAAA
Applications that use this media type: The type is used by systems that report e.g., electrical power usage and environmental information such as temperature and humidity. It can be used for a wide range of sensor reporting systems.
Fragment identifier considerations: Fragment identification for application/senml+xml is supported by using fragment identifiers as specified by RFC-AAAA.
Additional information:
Magic number(s): none
File extension(s): sensmlx
Macintosh file type code(s): none
Person & email address to contact for further information: Cullen Jennings <fluffy@iii.ca>
Intended usage: COMMON
Restrictions on usage: None
Author: Cullen Jennings <fluffy@iii.ca>
Change controller: IESG
Type name: application
Subtype name: senml+exi
Required parameters: none
Optional parameters: none
Encoding considerations: Must be encoded as using [W3C.REC-exi-20140211]. See RFC-AAAA for details.
Security considerations: See Section 13 of RFC-AAAA.
Interoperability considerations: Applications should ignore any XML tags or attributes that they do not understand. This allows backwards compatibility extensions to this specification. The “bver” attribute in the senml XML tag can be used to ensure the receiver supports a minimal level of functionality needed by the creator of the XML. Further information on using schemas to guide the EXI can be found in RFC-AAAA.
Published specification: RFC-AAAA
Applications that use this media type: The type is used by systems that report e.g., electrical power usage and environmental information such as temperature and humidity. It can be used for a wide range of sensor reporting systems.
Fragment identifier considerations: Fragment identification for application/senml+exi is supported by using fragment identifiers as specified by RFC-AAAA.
Additional information:
Magic number(s): none
File extension(s): senmle
Macintosh file type code(s): none
Macintosh Universal Type Identifier code: org.ietf.senml-exi conforms to public.data
Person & email address to contact for further information: Cullen Jennings <fluffy@iii.ca>
Intended usage: COMMON
Restrictions on usage: None
Author: Cullen Jennings <fluffy@iii.ca>
Change controller: IESG
Type name: application
Subtype name: sensml+exi
Required parameters: none
Optional parameters: none
Encoding considerations: Must be encoded as using [W3C.REC-exi-20140211]. See RFC-AAAA for details.
Security considerations: See Section 13 of RFC-AAAA.
Interoperability considerations: Applications should ignore any XML tags or attributes that they do not understand. This allows backwards compatibility extensions to this specification. The “bver” attribute in the senml XML tag can be used to ensure the receiver supports a minimal level of functionality needed by the creator of the XML. Further information on using schemas to guide the EXI can be found in RFC-AAAA.
Published specification: RFC-AAAA
Applications that use this media type: The type is used by systems that report e.g., electrical power usage and environmental information such as temperature and humidity. It can be used for a wide range of sensor reporting systems.
Fragment identifier considerations: Fragment identification for application/senml+exi is supported by using fragment identifiers as specified by RFC-AAAA.
Additional information:
Magic number(s): none
File extension(s): sensmle
Macintosh file type code(s): none
Person & email address to contact for further information: Cullen Jennings <fluffy@iii.ca>
Intended usage: COMMON
Restrictions on usage: None
Author: Cullen Jennings <fluffy@iii.ca>
Change controller: IESG
This document registers the following XML namespaces in the IETF XML registry defined in [RFC3688].
URI: urn:ietf:params:xml:ns:senml
Registrant Contact: The IESG.
XML: N/A, the requested URIs are XML namespaces
IANA is requested to assign CoAP Content-Format IDs for the SenML media types in the “CoAP Content-Formats” sub-registry, within the “CoRE Parameters” registry [RFC7252]. All IDs are assigned from the “Expert Review” (0-255) range. The assigned IDs are show in Table 8.
Media type | ID |
---|---|
application/senml+json | TBD |
application/sensml+json | TBD |
application/senml+cbor | TBD |
application/sensml+cbor | TBD |
application/senml+xml | TBD |
application/sensml+xml | TBD |
application/senml+exi | TBD |
application/sensml+exi | TBD |
Sensor data can contain a wide range of information ranging from information that is very public, such as the outside temperature in a given city, to very private information that requires integrity and confidentiality protection, such as patient health information. The SenML format does not provide any security and instead relies on the protocol that carries it to provide security. Applications using SenML need to look at the overall context of how this media type will be used to decide if the security is adequate.
See also Section 14.
Sensor data can range from information with almost no security considerations, such as the current temperature in a given city, to highly sensitive medical or location data. This specification provides no security protection for the data but is meant to be used inside another container or transport protocol such as S/MIME or HTTP with TLS that can provide integrity, confidentiality, and authentication information about the source of the data.
The name fields need to uniquely identify the sources or destinations of the values in a SenML Pack. However, the use of long-term stable unique identifiers can be problematic for privacy reasons [RFC6973], depending on the application and the potential of these identifiers to be used in correlation with other information. They should be used with care or avoided as for example described for IPv6 addresses in [RFC7721].
We would like to thank Alexander Pelov, Andrew McClure, Andrew McGregor, Bjoern Hoehrmann, Christian Amsuess, Christian Groves, Daniel Peintner, Jan-Piet Mens, Jim Schaad, Joe Hildebrand, John Klensin, Karl Palsson, Lennart Duhrsen, Lisa Dusseault, Lyndsay Campbell, Martin Thomson, Michael Koster, Peter Saint-Andre, and Stephen Farrell, for their review comments.