XEP-xxxx: Simple Internet of Things

Abstract
Specifies a simple XMPP Extension Protocol for the Internet of Things.
Author
Florian Schmaus
Copyright
© 1999 – 2020 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

ProtoXEP

WARNING: This document has not yet been accepted for consideration or approved in any official manner by the XMPP Standards Foundation, and this document is not yet an XMPP Extension Protocol (XEP). If this document is accepted as a XEP by the XMPP Council, it will be published at <http://xmpp.org/extensions/> and announced on the <standards@xmpp.org> mailing list.
Type
Standards Track
Version
0.0.1 (2016-09-04)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Draft
  4. Final

1. Introduction

This XEP specifies an simple and easy to implement XMPP extension protocol for the Internet of Things. At is core, the IoT protocol defined herein defines, amoungst others, the terms Thing, Owner, Requestor and Provisioning Service and the interaction between those. A fundamental permission concept is Friendship, which is based on XMPP presence subscriptions state. Since a thing can't decide on it's own if another entity should be a friend or not, a proxy mechanism for XMPP subscription states is also specified.

2. Glossary

2.1 Thing

A thing is a physical or virtual entity which provides data and/or can be controlled in some way. Typical examples include a temperature sensor, a light bulb or a door lock. A thing is mapped into XMPP to a bare JID. No bare JID shall represent more than one thing.

2.2 Requestor

A requestor is an XMPP entity which makes a request to a thing. Typical examples for requests include reading out the current temperature, turning the light bulb on, or opening the door lock. A requestor also be a thing, but this is not necessary.

2.3 Friendship

Friendship is the basic mechanism upon which things decide if another XMPP entity is allowed to interact with them. If the requestor is a friend of the thing, then the thing must try to fullfil the request (if no other limitations are in effect).

Friendship is defined on XMPP level as follows: A requestor R is a friend of thing T, if T's roster has an item for R's bare JID with a subscription state of either 'From' or 'Both'.

2.4 Provisioning Service

The provisioning service acts as link between a thing and its owner. It acts as manager between those two types: Things ask the provisioning service if it should accept a friendship request. Owners inform the provisioning service if an XMPP entity is a friend of a thing or not.

Provisioning services may act as as registry for things. Or they could forward their knowledge about existing things and owners to such registries. IoT registry services are not within the scope of this XEP (but may be specified by another XEP).

2.5 Owner

A owner is an XMPP entity. represented as bare JID, owning a thing. The ownership of a thing is noted in the provisioning service used by the thing. Ownership gives full control over thing and allows to decide about the thing's friends. The owner of thing is always also a friend of the thing.

3. IoT Product and Customer Story

This section explains how the story of an IoT product and its customer could look like. Note that the manufacturer needs to decide which parameters are pre-configured for the thing. The recommendation is that a thing only has a valid and unique JID and the corresponding credentials shipped, and is able to to generate and show a key to the user.

During the initial setup of the thing, e.g. after customer has unpacked the thing, the thing creates a new random key, presents the key to the customer, connects to the XMPP network and registers itself with the provisioning service.

Now the customer can claim ownership of the thing, just by using the provisining server, the product name and the key of the thing.

The ting can be at any point reset to factory settings. For example when the customer wants to sell it. Doing so will make the thing forget the generated key, but not its XMPP account credentials, so that a new initial setup can be performed

Derivations from this approach, e.g. using the same key all the time, are possible but come with their own drawbacks (and advantages).

4. Thing Registration

A thing registers with the provisioning service by sending an IQ of type 'set' with the <register/> element qualified by the 'urn:xmpp:siot:1' namespace. The element must have an 'name' attribute with the description of the thing, and a 'key' attribute containing a unique key for the thing.

Example 1. Thing registers
<iq type='set'
    from='thing@example.org/f65dece8'
    to='provisioning.example.org'
    id='register-1'>
    <register xmlns='urn:xmpp:siot:1'
              key='TWNK-KD5Y-MT3T-E1GS-DRDB-KVTW'>
      <name>Futuretec Light Bulb 10X'</name>
      <name xml:lang='de'>Futuretec Glühbirne 10X</name>
    </register>
</iq>

The value of the key element must be a string consiting of at least TODO entropy. It is suggested that it consists of 24 upper case characters from the Latin alphabet and numbers without 'O' ("LATIN CAPITAL LETTER O") and '0' ("DIGIT ZERO") (alphabet: 123456789ABCDEFGHIJKLMNPQRSTUVWXYZ) grouped into 4-character chunks

If the registration was successful, then the provisioning service replies with a empty result response.

Example 2. Thing registration successful
<iq type='result'
    from='provisioning.example.org'
    to='thing@example.org/f65dece8-4d69-4b71-80ed-da9562882a61'
    id='register-1'>
</iq>

After the provisioning service has acknowledged the registration, it MUST send send a presence subscription request to thing in order to subscribe to the thing's presence.

Example 3. The Provisioning Services requests to subscribe to the thing"s presence
<presence from='provisioning.example.org'
          to='thing@example.org'
          id='subscription-request-1'
		  type='subscribe'/>

A thing MUST approve any presence subscription request from the provisioning service.

Example 4. Thing approves subscription request
<presence from='thing@example.org'
          to='provisioning.example.org'  
          id='subscription-request-1'
		  type='subscribed'/>

5. Claiming Things

A XMPP entity claims a thing by sending an IQ of type 'set' with a <claim/> child element qualified by the 'urn:xmpp:siot:1' namespace to a provisioning service.

Example 5. Owner claims thing
<iq type='set'
    from='owner@example.com/76a60ed0'
    to='provisioning.example.org'
    id='claim-1'>
  <claim xmlns='urn:xmpp:siot:1'
         name='Futuretec Light Bulb 10X'
         key='TWNK-KD5Y-MT3T-E1GS-DRDB-KVTW'/>
</iq>
Example 6. Claim success
<iq type='result'
    from='provisioning.example.org'
    to='owner@example.com/76a60ed0-4f54-4ef7-9589-642ea25d354b'
    id='claim-1'>
  <claimed xmlns='urn:xmpp:siot:1'
          jid='thing@exampe.org'/>
</iq>

The provisioning service may now also send a owner update message to the thing, informing the thing about the changed ownership state. The 'jid' attribute must contain the owners bare JID.

Example 7. Owner update notification
<message from='provisioning.example.org'
         to='thing@example.org/f65dece8'
         id='owner-update-1'>
  <owner xmlns='urn:xmpp:siot:1'
         jid='owner@example.com'/>
</messaage>

6. Establishing Friendship

A requestor first sends a presence subscription request to the thing in order to establish friendship (see RFC 6121 § 3.1.1).

Example 8. Presence subscription request
<presence from='requestor@example.net/10b798d6'
          to='thing@example.org'
          type='subscribe'
          id='subscribe-1'>
</presence>

If the thing is unaware wether the requestor is a friend or not (the usual case), then upon receiving a presence subscription request, it must ask the provisioning service about the friendship status.

Example 9. Is Friend Query
<iq from='thing@example.org/f65dece8'
    to='provisioning.example.org'
    type='get'
    id='is-friend-1'>
  <is-friend-query jid='requestor@example.net'/>
</iq>
Example 10. Positive Is Friend Query Result
<iq from='provisioning.example.org'
    to='thing@example.org/f65dece8'
    type='result'
    id='is-friend-1'>
  <is-friend-result friend='yes'/>
</iq>
Example 11. Negative Is Friend Query Result
<iq from='provisioning.example.org'
    to='thing@example.org/f65dece8'
    type='result'
    id='is-friend-1'>
  <is-friend-result friend='no'/>
</iq>
Example 12. Pending Is Friend Query Result
<iq from='provisioning.example.org'
    to='thing@example.org/f65dece8'
    type='result'
    id='is-friend-1'>
  <is-friend-result friend='pending'/>
</iq>

7. Pending Friend Requests

Example 13. Pending Friend Request Notification
<message from='provisioning.example.org'
         to='owner@example.net'
         id='pending-friend-notification-1'>
  <pending-friend-notification xmlns='urn:xmpp:siot:1'/>
</message>
Example 14. Pending Friend Requests Query
<iq from='owner@example.com/76a60ed0'
    to='provisioning.example.org'
    type='get'
    id='pending-friend-requests-query-1'>
    <pending-friend-query xmlns='urn:xmpp:siot:1'/>
</iq>
Example 15. Pending Friend Requests List
<iq from='provisioning.example.org'
    to='owner@example.com/76a60ed0'
    type='result'
    id='pending-friend-requests-query-1'>
  <pending-friend-requests xmlns='urn:xmpp:siot:1'>
    <pending-friend jid='possibleFriend@example.net'/>
    <pending-friend jid='anotherPossibleFriend@example.net'/>
  </pending-friend-requests>
</iq>

8. Friend state updates

To inform the provisioning service about a change in the friendship state, the owner sends a friend state update <iq/>. This is typically done by the owner after he became aware of pending friendship requests, if he wants to remove an existing friend, or if he wants to add a new friend.

Example 16. Friend state update
<iq from='owner@example.com/76a60ed0'
    to='provisioning.example.org'
    type='set'
    id='friend-state-update-1'>
  <friend-state-update xmlns='urn:xmpp:siot:1'>
    <non-friend jid='possibleFriend@example.net'/>
    <friend jid='anotherPossibleFriend@example.net'/>
  </friend-state-update>
</iq>
Example 17. Friend state update result
<iq from='provisioning.example.org'
    to='owner@example.com/76a60ed0'
    type='set'
    id='friend-state-update-1'/>

9. Friendship State Changed Notifications

In order to inform a thing about changed friendship state, the provisioning service sends a notification to the thing.

TODO: Make this an IQ? Would require mandating the provisioning service to subscribe to the things presence and that the thing allowing it.

Example 18. Friendship State Changed Notifications
<message from='provisioning.example.org'
         to='thing@example.org'
         id='friendship-state-changed-1'>
  <friendship-states xmlns='urn:xmpp:siot:1'>
    <item jid='rommeo@example.com' friend='yes'/>
    <item jid='julia@example.com' friend='no'/>
  </friendship-states>
</message>

10. Security Considerations

Involved entities, in particular but not only things, MUST verify the sender of the received messages: Things MUST verify that stanzas send by provisining services have the correct JID set in the 'from' attribute of the stanza.

11. IANA Considerations

REQUIRED.

12. XMPP Registrar Considerations

REQUIRED.

13. XML Schema

REQUIRED for protocol specifications.


Appendices

Appendix A: Document Information

Series
XEP
Number
xxxx
Publisher
XMPP Standards Foundation
Status
ProtoXEP
Type
Standards Track
Version
0.0.1
Last Updated
2016-09-04
Approving Body
XMPP Council
Dependencies
XMPP Core, XMPP IM
Supersedes
None
Superseded By
None
Short Name
siot

This document in other formats: XML  PDF

Appendix B: Author Information

Florian Schmaus
Email
flo@geekplace.eu
JabberID
flo@geekplace.eu

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2020 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.

Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".

Appendix G: Notes

Appendix H: Revision History

Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/

  1. Version 0.0.1 (2016-09-04)

    First draft.

    fs

END