Network Working Group                                        C. Jennings
Internet-Draft                                                     Cisco
Intended status:  Standards Track                              Z. Shelby
Expires:  May 4, 2012                                          Sensinode
                                                                J. Arkko
                                                                Ericsson
                                                             Nov 1, 2011


             Media Types for Sensor Markup Language (SENML)
                        draft-jennings-senml-07

Abstract

   This specification defines media types for representing simple sensor
   measurements and device parameters in the Sensor Markup Language
   (SenML).  Representations are defined in JavaScript Object Notation
   (JSON), 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.

Status of this Memo

   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 http://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 May 4, 2012.

Copyright Notice

   Copyright (c) 2011 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
   (http://trustee.ietf.org/license-info) in effect on the date of



Jennings, et al.           Expires May 4, 2012                  [Page 1]


Internet-Draft                Sensor Markup                     Nov 2011


   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.


Table of Contents

   1.  Overview . . . . . . . . . . . . . . . . . . . . . . . . . . .  3
   2.  Requirements and Design Goals  . . . . . . . . . . . . . . . .  3
   3.  Terminology  . . . . . . . . . . . . . . . . . . . . . . . . .  4
   4.  Semantics  . . . . . . . . . . . . . . . . . . . . . . . . . .  4
   5.  Associating Meta-data  . . . . . . . . . . . . . . . . . . . .  7
   6.  JSON Representation (application/senml+json) . . . . . . . . .  7
     6.1.  Examples . . . . . . . . . . . . . . . . . . . . . . . . .  9
       6.1.1.  Single Datapoint . . . . . . . . . . . . . . . . . . .  9
       6.1.2.  Multiple Datapoints  . . . . . . . . . . . . . . . . .  9
       6.1.3.  Multiple Measurements  . . . . . . . . . . . . . . . . 10
       6.1.4.  Collection of Resources  . . . . . . . . . . . . . . . 10
   7.  XML Representation (application/senml+xml) . . . . . . . . . . 11
   8.  EXI Representation (application/senml+exi) . . . . . . . . . . 12
   9.  Usage Considerations . . . . . . . . . . . . . . . . . . . . . 14
   10. IANA Considerations  . . . . . . . . . . . . . . . . . . . . . 15
     10.1. Units Registry . . . . . . . . . . . . . . . . . . . . . . 15
     10.2. Media Type Registration  . . . . . . . . . . . . . . . . . 17
       10.2.1. senml+json Media Type Registration . . . . . . . . . . 17
       10.2.2. senml+xml Media Type Registration  . . . . . . . . . . 18
       10.2.3. senml+exi Media Type Registration  . . . . . . . . . . 19
   11. Security Considerations  . . . . . . . . . . . . . . . . . . . 20
   12. Privacy Considerations . . . . . . . . . . . . . . . . . . . . 20
   13. Acknowledgement  . . . . . . . . . . . . . . . . . . . . . . . 20
   14. References . . . . . . . . . . . . . . . . . . . . . . . . . . 20
     14.1. Normative References . . . . . . . . . . . . . . . . . . . 20
     14.2. Informative References . . . . . . . . . . . . . . . . . . 21
   Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 22














Jennings, et al.           Expires May 4, 2012                  [Page 2]


Internet-Draft                Sensor Markup                     Nov 2011


1.  Overview

   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[I-D.ietf-core-coap] called the Sensor Markup
   Language (SenML).  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.  There are many types of more complex measurements and
   measurements that this media type would not be suitable for.  A
   decision was made not to carry most of the meta data about the sensor
   in this media type to help reduce the size of the data and improve
   efficiency in decoding.  Instead meta-data about a sensor resource
   can be described out-of-band using the CoRE Link Format
   [I-D.ietf-core-link-format].  The markup language 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 (GET /sensor/temperature).

   SenML is defined by a data model for measurements and simple meta-
   data about measurements and devices.  The data is structured as a
   single object (with attributes) that contains an array of entries.
   Each entry is an object that has attributes such as a unique
   identifier for the sensor, the time the measurement was made, and the
   current value.  Serializations for this data model are defined for
   JSON [RFC4627], XML and Efficient XML Interchange (EXI).

   For example, the following shows a measurement from a temperature
   gauge encoded in the JSON syntax.
   {"e":[{ "n": "urn:dev:ow:10e2073a01080063", "v":23.5, "u":"degC" }]}

   In the example above, the array in the object has a single
   measurement for a sensor named "urn:dev:ow:10e2073a01080063" with a
   temperature of 23.5 degrees Celsius.


2.  Requirements and Design Goals

   The design goal is to be able to send simple sensor measurements in
   small packets on mesh networks from large numbers of constrained
   devices.  Keeping the total size under 80 bytes makes this easy to
   use on a wireless mesh network.  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 Google power meter and large scale deployments has indicated
   that the solution needs to support allowing multiple measurements to



Jennings, et al.           Expires May 4, 2012                  [Page 3]


Internet-Draft                Sensor Markup                     Nov 2011


   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.


3.  Terminology

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in RFC 2119 [RFC2119].


4.  Semantics

   Each representation caries a single SenML object that represents a
   set of measurements and/or parameters.  This object contains several
   optional attributes described below and a mandatory array of one or
   more entries.

   Base Name

      This is a string that is prepended to the names found in the
      entries.  This attribute is optional.

   Base Time

      A base time that is added to the time found in an entry.  This
      attribute is optional.

   Base Units

      A base unit that is assumed for all entries, unless otherwise
      indicated.  This attribute is optional.  Acceptable values are
      specified in Section 10.1.

   Version

      Version number of media type format.  This attribute is optional
      positive integer and defaults to 1 if not present.








Jennings, et al.           Expires May 4, 2012                  [Page 4]


Internet-Draft                Sensor Markup                     Nov 2011


   Measurement or Parameter Entries

      Array of values for sensor measurements or other generic
      parameters (such as configuration parameters).  If present there
      must be at least one entry in the array.


   Each array entry contains several attributes, some of which are
   optional and some of which are mandatory.

   Name

      Name of the sensor or parameter.  When appended to the Base Name
      attribute, this must result in a globally unique identifier for
      the resource.  The name is optional, if the Base Name is present.
      If the name is missing Base Name must uniquely identify the
      resource.  This can be used to represent a large array of
      measurements from the same sensor without having to repeat its
      identifier on every measurement.

   Units

      Units for a measurement value.  Optional, if Base Unit is present
      or if not required for a parameter.  Acceptable values are
      specified in Section 10.1.

   Value

      Value of the entry.  Optional if a Sum value is present, otherwise
      required.  Values are represented using three basic data types,
      Floating point numbers ("v" field for "Value"), Booleans ("bv" for
      "Boolean Value") and Strings ("sv" for "String Value").  Exactly
      one of these three fields MUST appear.

   Sum

      Integrated sum of the values over time.  Optional.  This attribute
      is in the units specified in the Unit value multiplied by seconds.

   Time

      Time when value was recorded.  Optional.

   Update Time

      Update time.  A time in seconds that represents the maximum time
      before this sensor will provide an updated reading for a
      measurement.  This can be used to detect the failure of sensors or



Jennings, et al.           Expires May 4, 2012                  [Page 5]


Internet-Draft                Sensor Markup                     Nov 2011


      communications path from the sensor.  Optional.


   The SenML format can be extended with further custom attributes
   placed in the base object, or in an entry.  Extensions in the base
   object pertain to all entries, whereas extensions in an entry object
   only pertain to that.

   Systems reading one of the objects MUST check for the Version
   attribute.  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
   mandatory to understand attributes.  New version numbers can only be
   defined in RFC which updates this specification or it successors.

   The Name value is concatenated to the Base Name value to get the name
   of the sensor.  The resulting name needs to uniquely identify and
   differentiate the sensor from all others.  If the object is a
   representation resulting from the request of a URI [RFC3986], then in
   the absence of the Base Name attribute, this URI is used as the
   default value of Base Name.  Thus in this case the Name field needs
   to be unique for that URI, for example an index or subresource name
   of sensors handled by the URI.

   Alternatively, for objects not related to a URI, a unique name is
   required.  In any case, it is RECOMMENDED that the full names are
   represented as URIs or URNs [RFC2141].  One way to create a unique
   name is to include a EUI-48 or EUI-64 identifier (A MAC address) or
   some other bit string that is guaranteed uniqueness (such as a 1-wire
   address) that is assigned to the device.  Some of the examples in
   this draft use the device URN type as specified in
   [I-D.arkko-core-dev-urn].  UUIDs [RFC4122] are another way to
   generate a unique name.

   The resulting concatenated name MUST consist only of characters out
   of the set "A" to "Z", "a" to "z", "0" to "9", "-", ":", ".", or "_"
   and 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
   these names can be directly used as in other types of URI including
   segments of an HTTP path with no special encoding.  [RFC5952]
   contains advice on encoding an IPv6 address in a name.

   If either the Base Time or Time value is missing, the missing
   attribute 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



Jennings, et al.           Expires May 4, 2012                  [Page 6]


Internet-Draft                Sensor Markup                     Nov 2011


   value is used to indicate the number of seconds, excluding leap
   seconds, since the start of the year 1970 in UTC .

   Representing the statistical characteristics of measurements can be
   very complex.  Future specification may add new attributes to provide
   better information about the statistical properties of the
   measurement.


5.  Associating Meta-data

   SenML is designed to carry the minimum dynamic information about
   measurements, and for efficiency reasons does not carry more 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 representations, this meta-data can be made
   available using the CoRE Link Format [I-D.ietf-core-link-format].

   The CoRE Link Format provides a simple way to describe Web Links, and
   in particular allows a web server to describe resources it is
   hosting.  The list of links that a web server has available, can be
   discovered by retrieving the /.well-known/core resource, which
   returns the list of links in the CoRE Link Format.  Each link may
   contain attributes, for example title, resource type, interface
   description and content-type.

   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=)
   attribute.

   Further semantics about a resource can be included in the Resource
   Type and Interface Description attributes.  The Resource Type (rt=)
   attribute is meant to give a semantic meaning to that resource.  For
   example rt="OutdoorTemperature" would indicate static semantic
   meaning in addition to the unit information included in SenML.  The
   Interface Description (if=) attribute is used to describe the REST
   interface of a resource, and may include e.g. a reference to a WADL
   description [WADL].


6.  JSON Representation (application/senml+json)

   Root variables:







Jennings, et al.           Expires May 4, 2012                  [Page 7]


Internet-Draft                Sensor Markup                     Nov 2011


               +---------------------------+------+--------+
               |                     SenML | JSON | Type   |
               +---------------------------+------+--------+
               |                 Base Name | bn   | String |
               |                 Base Time | bt   | Number |
               |                Base Units | bu   | Number |
               |                   Version | ver  | Number |
               | Measurement or Parameters | e    | Array  |
               +---------------------------+------+--------+

   Measurement or Parameter Entries:

                 +---------------+------+----------------+
                 |         SenML | JSON | Notes          |
                 +---------------+------+----------------+
                 |          Name | n    | String         |
                 |         Units | u    | String         |
                 |         Value | v    | Floating point |
                 |  String Value | sv   | String         |
                 | Boolean Value | bv   | Boolean        |
                 |     Value Sum | s    | Floating point |
                 |          Time | t    | Number         |
                 |   Update Time | ut   | Number         |
                 +---------------+------+----------------+

   All of the data is UTF-8, but since this is for machine to machine
   communications on constrained systems, only characters with code
   points between U+0001 and U+007F are allowed which corresponds to the
   ASCII[RFC0020] subset of UTF-8.

   The root contents MUST consist of exactly one JSON object as
   specified by [RFC4627].  This object MAY contain a "bn" attribute
   with a value of type string.  This object MAY contain a "bt"
   attribute with a value of type number.  The object MAY contain a "bu"
   attribute with a value of type string.  The object MAY contain a
   "ver" attribute with a value of type number.  The object MAY contain
   other attribute value pairs, and the object MUST contain exactly one
   "e" attribute with a value of type array.  The array MUST have one or
   more measurement or parameter objects.

   Inside each measurement or parameter object the "n", "u", and "sv"
   attributes are of type string, the "t" and "ut" attributes are of
   type number, the "bv" attribute is of type boolean, and the "v" and
   "s" attributes are of type floating point.  All the attributes are
   optional, but as specified in Section 4, one of the "v", "sv", or
   "bv" attributes MUST appear unless the "s" attribute is also present.
   The "v", and "sv", and "bv" attributes MUST NOT appear together.




Jennings, et al.           Expires May 4, 2012                  [Page 8]


Internet-Draft                Sensor Markup                     Nov 2011


   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.

6.1.  Examples

6.1.1.  Single Datapoint

   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:

   {"m":[{ "n": "urn:dev:ow:10e2073a01080063", "v":23.5 }]}

6.1.2.  Multiple Datapoints

   The following example shows voltage and current now, i.e., at an
   unspecified time.  The device has an EUI-64 MAC address of
   0024befffe804ff1.

   {"e":[
        { "n": "voltage", "t": 0, "u": "V", "v": 120.1 },
        { "n": "current", "t": 0, "u": "A", "v": 1.2 }],
    "bn": "urn:dev:mac:0024befffe804ff1/"
   }

   The next example is similar to the above one, but shows current at
   Tue Jun 8 18:01:16 UTC 2010 and at each second for the previous 5
   seconds.

   {"e":[
        { "n": "voltage", "u": "V", "v": 120.1 },
        { "n": "current", "t": -5, "v": 1.2 },
        { "n": "current", "t": -4, "v": 1.30 },
        { "n": "current", "t": -3, "v": 0.14e1 },
        { "n": "current", "t": -2, "v": 1.5 },
        { "n": "current", "t": -1, "v": 1.6 },
        { "n": "current", "t": 0,   "v": 1.7 }],
    "bn": "urn:dev:mac:0024befffe804ff1/",
    "bt": 1276020076,
    "ver": 1,
    "bu": "A"



Jennings, et al.           Expires May 4, 2012                  [Page 9]


Internet-Draft                Sensor Markup                     Nov 2011


   }

6.1.3.  Multiple Measurements

   The following example shows humidity measurements from a mobile
   device with an IPv6 address 2001:db8::1, starting at Mon Oct 31 13:
   24:24 UTC 2011.  The device also provide 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.

   {"e":[
        { "v": 20.0, "t": 0 },
        { "sv": "E 24' 30.621", "u": "lon", "t": 0 },
        { "sv": "N 60' 7.965", "u": "lat", "t": 0 },
        { "v": 20.3, "t": 60 },
        { "sv": "E 24' 30.622", "u": "lon", "t": 60 },
        { "sv": "N 60' 7.965", "u": "lat", "t": 60 },
        { "v": 20.7, "t": 120 },
        { "sv": "E 24' 30.623", "u": "lon", "t": 120 },
        { "sv": "N 60' 7.966", "u": "lat", "t": 120 },
        { "v": 98.0, "u": "%EL", "t": 150 },
        { "v": 21.2, "t": 180 },
        { "sv": "E 24' 30.628", "u": "lon", "t": 180 },
        { "sv": "N 60' 7.967", "u": "lat", "t": 180 }],
    "bn": "http://[2001:db8::1]",
    "bt": 1320067464,
    "bu": "%RH"
   }

6.1.4.  Collection of Resources

   The following example shows how to query one device that can provide
   multiple measurements.  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.

   {"e":[
        { "n": "temperature", "v": 27.2, "u": "degC" },
        { "n": "humidity", "v": 80, "u": "%RH" }],
    "bn": "http://[2001:db8::2]/",
    "bt": 1320078429,
    "ver": 1
   }



Jennings, et al.           Expires May 4, 2012                 [Page 10]


Internet-Draft                Sensor Markup                     Nov 2011


7.  XML Representation (application/senml+xml)

   A SenML object can also be represented in XML format as defined in
   this section.  The following example shows an XML example for the
   same sensor measurement as in Section 6.1.2.

   <?xml version="1.0" encoding="UTF-8"?>
   <senml xmlns="urn:ietf:params:xml:ns:senml"
          bn="urn:dev:mac:0024befffe804ff1/"
          bt="1276020076"
          ver="1" bu="A">

     <e n="voltage" u="V" v="120.1" />

     <e n="current" t="-5" v="1.2" />

     <e n="current" t="-4" v="1.30" />

     <e n="current" t="-3" v="0.14e1" />

     <e n="current" t="-2" v="1.5" />

     <e n="current" t="-1" v="1.6" />

     <e n="current" t="0" v="1.7" />

   </senml>

   The RelaxNG schema for the XML is:






















Jennings, et al.           Expires May 4, 2012                 [Page 11]


Internet-Draft                Sensor Markup                     Nov 2011


   default namespace = "urn:ietf:params:xml:ns:senml"
   namespace rng = "http://relaxng.org/ns/structure/1.0"

   e = element e {
     attribute n { xsd:string }?,
     attribute u { xsd:string }?,
     attribute v { xsd:float }?,
     attribute sv { xsd:string }?,
     attribute bv { xsd:boolean }?,
     attribute s { xsd:decimal }?,
     attribute t { xsd:integer }?,
     attribute ut { xsd:integer }?,
     p*
   }

   senml =
     element senml {
       attribute bn { xsd:string }?,
       attribute bt { xsd:integer }?,
       attribute bu { xsd:string }?,
       attribute ver { xsd:integer }?,
       e*
     }

   start = senml


8.  EXI Representation (application/senml+exi)

   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 following XSD Schema is generated from the RelaxNG and used for
   strict schema guided EXI processing.  (TODO:  define a better schema
   that include the common strings.  I'd like to have something where
   the stream ended up defined in a way that it was trivial to encode
   sensor measurement into EXI in a small amount of C code. )








Jennings, et al.           Expires May 4, 2012                 [Page 12]


Internet-Draft                Sensor Markup                     Nov 2011


   <?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="e">
       <xs:complexType>
         <xs:attribute name="n" type="xs:string"/>
         <xs:attribute name="u" type="xs:string"/>
         <xs:attribute name="v" type="xs:float"/>
         <xs:attribute name="sv" type="xs:string"/>
         <xs:attribute name="bv" type="xs:boolean"/>
         <xs:attribute name="s" type="xs:decimal"/>
         <xs:attribute name="t" type="xs:integer"/>
         <xs:attribute name="ut" type="xs:integer"/>
       </xs:complexType>
     </xs:element>
     <xs:element name="senml">
       <xs:complexType>
         <xs:sequence>
           <xs:element minOccurs="0" maxOccurs="unbounded" ref="ns1:e"/>
         </xs:sequence>
         <xs:attribute name="bn" type="xs:string"/>
         <xs:attribute name="bt" type="xs:integer"/>
         <xs:attribute name="bu" type="xs:string"/>
         <xs:attribute name="ver" type="xs:integer"/>
       </xs:complexType>
     </xs:element>
   </xs:schema>

   The following shows a hexdump of the EXI produced from encoding the
   following XML example.  Note that while this example is similar to
   the the first example in Section 6.1.2 in JSON format, it has been
   simplified by omitting the URNs and units.

   <?xml version="1.0" encoding="UTF-8"?>

   <senml xmlns="urn:ietf:params:xml:ns:senml">
     <e n="voltage" t="0" v="120.1" />
     <e n="current" t="0" v="1.2" />
   </senml>


   Result:

   0000000  90 60 84 bb 37 b6 3a 30 b3 b2 a0 02 58 84 c0 00
   0000020  84 b1 ba b9 39 32 b7 3a 20 02 06 40 08



Jennings, et al.           Expires May 4, 2012                 [Page 13]


Internet-Draft                Sensor Markup                     Nov 2011


9.  Usage Considerations

   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 units set to watts, but it would put the sum of energy used in
   the "s" attribute of the measurement.  It might optionally include
   the current power in the "v" attribute.

   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.
   Implementors 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:

   1.  Many sensors will allow the cumulative sums to "wrap" back to
       zero after the value gets sufficiently large.
   2.  Some sensors will reset the cumulative sum back to zero when the
       device is reset, loses power, or is replaced with a different
       sensor.
   3.  Applications cannot make assumptions about when the device
       started accumulating values into the sum.

   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.







Jennings, et al.           Expires May 4, 2012                 [Page 14]


Internet-Draft                Sensor Markup                     Nov 2011


10.  IANA Considerations

   Note to RFC Editor:  Please replace all occurrences of "RFC-AAAA"
   with the RFC number of this specification.

10.1.  Units Registry

   IANA will create a registry of 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
   [NIST822] and [BIPM].

   +--------+----------------------------------------------+-----------+
   | Symbol | Description                                  | Reference |
   +--------+----------------------------------------------+-----------+
   |      m | meter                                        | RFC-AAAA  |
   |     kg | kilogram                                     | RFC-AAAA  |
   |      s | second                                       | RFC-AAAA  |
   |      A | ampere                                       | RFC-AAAA  |
   |      K | kelvin                                       | RFC-AAAA  |
   |     cd | candela                                      | RFC-AAAA  |
   |    mol | mole                                         | RFC-AAAA  |
   |     Hz | hertz                                        | RFC-AAAA  |
   |    rad | radian                                       | RFC-AAAA  |
   |     sr | steradian                                    | RFC-AAAA  |
   |      N | newton                                       | RFC-AAAA  |
   |     Pa | pascal                                       | RFC-AAAA  |
   |      J | joule                                        | RFC-AAAA  |
   |      W | watt                                         | RFC-AAAA  |
   |      C | coulomb                                      | RFC-AAAA  |
   |      V | volt                                         | RFC-AAAA  |
   |      F | farad                                        | RFC-AAAA  |
   |    Ohm | ohm                                          | RFC-AAAA  |
   |      S | siemens                                      | RFC-AAAA  |
   |     Wb | weber                                        | RFC-AAAA  |
   |      T | tesla                                        | RFC-AAAA  |
   |      H | henry                                        | RFC-AAAA  |
   |   degC | degrees Celsius                              | RFC-AAAA  |
   |     lm | lumen                                        | RFC-AAAA  |
   |     lx | lux                                          | RFC-AAAA  |
   |     Bq | becquerel                                    | RFC-AAAA  |
   |     Gy | gray                                         | RFC-AAAA  |
   |     Sv | sievert                                      | RFC-AAAA  |
   |    kat | katal                                        | RFC-AAAA  |
   |     pH | pH acidity                                   | RFC-AAAA  |
   |      % | Value of a switch. A value of 0.0 indicates  | RFC-AAAA  |
   |        | the switch is off while 100.0 indicates on.  |           |
   |  count | counter value                                | RFC-AAAA  |



Jennings, et al.           Expires May 4, 2012                 [Page 15]


Internet-Draft                Sensor Markup                     Nov 2011


   |    %RH | Relative Humidity                            | RFC-AAAA  |
   |     m2 | area                                         | RFC-AAAA  |
   |      l | volume in liters                             | RFC-AAAA  |
   |    m/s | velocity                                     | RFC-AAAA  |
   |   m/s2 | acceleration                                 | RFC-AAAA  |
   |    l/s | flow rate in liters per second               | RFC-AAAA  |
   |   W/m2 | irradiance                                   | RFC-AAAA  |
   |  cd/m2 | luminance                                    | RFC-AAAA  |
   |   Bspl | bel sound pressure level                     | RFC-AAAA  |
   |  bit/s | bits per second                              | RFC-AAAA  |
   |    lat | degrees latitude. Assumed to be in WGS84     | RFC-AAAA  |
   |        | unless another reference frame is known for  |           |
   |        | the sensor.                                  |           |
   |    lon | degrees longitude. Assumed to be in WGS84    | RFC-AAAA  |
   |        | unless another reference frame is known for  |           |
   |        | the sensor.                                  |           |
   |    %EL | remaining battery energy level in percents   | RFC-AAAA  |
   +--------+----------------------------------------------+-----------+

   New entries can be added to the registration by either Expert Review
   or IESG Approval as defined in [RFC5226].  Experts should exercise
   their own good judgment but need to consider the following
   guidelines:

   1.   There needs to be a real and compelling use for any new unit to
        be added.
   2.   Units should define the semantic information and be chosen
        carefully.  Implementors need to remember that the same word may
        be used in different real-life contexts.  For example, degrees
        when measuring latitude have no semantic relation to degrees
        when measuring temperature; thus two different units are needed.
   3.   These measurements are produced by computers for consumption by
        computers.  The principle is that conversion has to be easily be
        done when both reading and writing the media type.  The value of
        a single canonical representation outweighs the convenience of
        easy human representations or loss of precision in a conversion.
   4.   Use of SI prefixes such as "k" before the unit is not allowed.
        Instead one can represent the value using scientific notation
        such a 1.2e3.
   5.   For a given type of measurement, there will only be one unit
        type defined.  So for length, meters are defined and other
        lengths such as mile, foot, light year are not allowed.  For
        most cases, the SI unit is preferred.
   6.   Symbol names that could be easily confused with existing common
        units or units combined with prefixes should be avoided.  For
        example, selecting a unit name of "mph" to indicate something
        that had nothing to do with velocity would be a bad choice, as
        "mph" is commonly used to mean miles per hour.



Jennings, et al.           Expires May 4, 2012                 [Page 16]


Internet-Draft                Sensor Markup                     Nov 2011


   7.   The following should not be used because the are common SI
        prefixes:  Y, Z, E, P, T, G, M, k, h, da, d, c, n, u, p, f, a,
        z, y, Ki, Mi, Gi, Ti, Pi, Ei, Zi, Yi.
   8.   The following units should not be used as they are commonly used
        to represent other measurements Ky, Gal, dyn, etg, P, St, Mx, G,
        Oe, Gb, sb, Lmb, ph, Ci, R, RAD, REM, gal, bbl, qt, degF, Cal,
        BTU, HP, pH, B/s, psi, Torr, atm, at, bar, kWh.
   9.   The unit names are case sensitive and the correct case needs to
        be used, but symbols that differ only in case should not be
        allocated.
   10.  A number after a unit typically indicates the previous unit
        raised to that power, and the / indicates that the units that
        follow are the reciprocal.  A unit should have only one / in the
        name.

10.2.  Media Type Registration

   The following registrations are done following the procedure
   specified in [RFC4288] and [RFC3023].

   Note to RFC Editor:  Please replace all occurrences of "RFC-AAAA"
   with the RFC number of this specification.

10.2.1.  senml+json Media Type Registration

   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 [RFC4627].  Specifically, only the ASCII[RFC0020]
   subset of the UTF-8 characters are allowed.  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:  Sensor data can contain a wide range of
   information ranging from information that is very public, such the
   outside temperature in a given city, to very private information that
   requires integrity and confidentiality protection, such as patient
   health information.  This format does not provide any security and
   instead relies on the transport protocol that carries it to provide
   security.  Given applications need to look at the overall context of
   how this media type will be used to decide if the security is



Jennings, et al.           Expires May 4, 2012                 [Page 17]


Internet-Draft                Sensor Markup                     Nov 2011


   adequate.

   Interoperability considerations:  Applications should ignore any JSON
   key value pairs that they do not understand.  This allows backwards
   compatibility extensions to this specification.  The "ver" 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 electrical power usage and environmental information such
   as temperature and humidity.  It can be used for a wide range of
   sensor reporting systems.

   Additional information:

   Magic number(s):  none

   File extension(s):  senml

   Macintosh file type code(s):  none

   Person & email address to contact for further information:  Cullen
   Jennings <c.jennings@ieee.org>

   Intended usage:  COMMON

   Restrictions on usage:  None

   Author:  Cullen Jennings <c.jennings@ieee.org>

   Change controller:  IESG

10.2.2.  senml+xml Media Type Registration

   Type name:  application

   Subtype name:  senml+xml

   Required parameters:  none

   Optional parameters:  none

   Encoding considerations:  TBD

   Security considerations:  TBD




Jennings, et al.           Expires May 4, 2012                 [Page 18]


Internet-Draft                Sensor Markup                     Nov 2011


   Interoperability considerations:  TBD

   Published specification:  RFC-AAAA

   Applications that use this media type:  TBD

   Additional information:

   Magic number(s):  none

   File extension(s):  senml

   Macintosh file type code(s):  none

   Person & email address to contact for further information:  Cullen
   Jennings <c.jennings@ieee.org>

   Intended usage:  COMMON

   Restrictions on usage:  None

   Author:  Cullen Jennings <c.jennings@ieee.org>

   Change controller:  IESG

10.2.3.  senml+exi Media Type Registration

   Type name:  application

   Subtype name:  senml+exi

   Required parameters:  none

   Optional parameters:  none

   Encoding considerations:  TBD

   Security considerations:  TBD

   Interoperability considerations:  TBD

   Published specification:  RFC-AAAA

   Applications that use this media type:  TBD

   Additional information:

   Magic number(s):  none



Jennings, et al.           Expires May 4, 2012                 [Page 19]


Internet-Draft                Sensor Markup                     Nov 2011


   File extension(s):  senml

   Macintosh file type code(s):  none

   Person & email address to contact for further information:  Cullen
   Jennings <c.jennings@ieee.org>

   Intended usage:  COMMON

   Restrictions on usage:  None

   Author:  Cullen Jennings <c.jennings@ieee.org>

   Change controller:  IESG


11.  Security Considerations

   See Section 12.Further discussion of security proprieties can be
   found in Section 10.2.


12.  Privacy Considerations

   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.


13.  Acknowledgement

   We would like to thank Lisa Dusseault, Joe Hildebrand, Lyndsay
   Campbell, Martin Thomson, John Klensin, Bjoern Hoehrmann, and Carsten
   Bormann for their review comments.


14.  References

14.1.  Normative References

   [RFC4627]  Crockford, D., "The application/json Media Type for
              JavaScript Object Notation (JSON)", RFC 4627, July 2006.

   [RFC3023]  Murata, M., St. Laurent, S., and D. Kohn, "XML Media



Jennings, et al.           Expires May 4, 2012                 [Page 20]


Internet-Draft                Sensor Markup                     Nov 2011


              Types", RFC 3023, January 2001.

   [RFC4288]  Freed, N. and J. Klensin, "Media Type Specifications and
              Registration Procedures", BCP 13, RFC 4288, December 2005.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

   [IEEE.754.1985]
              Institute of Electrical and Electronics Engineers,
              "Standard for Binary Floating-Point Arithmetic",
              IEEE Standard 754, August 1985.

   [RFC5226]  Narten, T. and H. Alvestrand, "Guidelines for Writing an
              IANA Considerations Section in RFCs", BCP 26, May 2008.

14.2.  Informative References

   [RFC2141]  Moats, R., "URN Syntax", RFC 2141, May 1997.

   [RFC3986]  Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
              Resource Identifier (URI): Generic Syntax", STD 66,
              RFC 3986, January 2005.

   [I-D.ietf-core-coap]
              Shelby, Z. and B. Frank, "Constrained Application Protocol
              (CoAP)", draft-ietf-core-coap-07 (work in progress),
              January 2011.

   [I-D.ietf-core-link-format]
              Shelby, Z., "Constrained Application Protocol (CoAP)",
              draft-ietf-core-link-format-07 (work in progress),
              January 2011.

   [BIPM]     Bureau International des Poids et Mesures, "The
              International System of Units (SI)", 8th edition, 2006 .

   [NIST822]  Thompson, A. and B. Taylor, "Guide for the Use of the
              International System of Units (SI)", NIST Special
              Publication 811, 2008 Edition .

   [RFC5952]  Kawamura, S. and M. Kawashima, "A Recommendation for IPv6
              Address Text Representation", RFC 5952, August 2010.

   [RFC4122]  Leach, P., Mealling, M., and R. Salz, "A Universally
              Unique IDentifier (UUID) URN Namespace", RFC 4122,
              July 2005.




Jennings, et al.           Expires May 4, 2012                 [Page 21]


Internet-Draft                Sensor Markup                     Nov 2011


   [RFC0020]  Cerf, V., "ASCII format for network interchange", RFC 20,
              October 1969.

   [I-D.arkko-core-dev-urn]
              Arkko, J., Jennings, C., and Z. Shelby, "Uniform Resource
              Names for Device Identifiers", draft-arkko-core-dev-urn-00
              (work in progress), October 2011.

   [WADL]     Hadley, M., "Web Application Description Language (WADL)",
              2009, <http://java.net/projects/wadl/sources/svn/content/
              trunk/www/wadl20090202.pdf>.


Authors' Addresses

   Cullen Jennings
   Cisco
   170 West Tasman Drive
   San Jose, CA  95134
   USA

   Phone:  +1 408 421-9990
   Email:  fluffy@cisco.com


   Zach Shelby
   Sensinode
   Kidekuja 2
   Vuokatti  88600
   FINLAND

   Phone:  +358407796297
   Email:  zach@sensinode.com


   Jari Arkko
   Ericsson
   Jorvas  02420
   Finland

   Email:  jari.arkko@piuha.net










Jennings, et al.           Expires May 4, 2012                 [Page 22]