Write a value to a device

The next you would like to do in an Internet of Things environment is to write values to your Thing. The device can of course have several available fields that can be written. Here we show a simple write of a value to one field that you as a peer has access to. More details on the write process is in the xmpp specification

##Write a value to a field

Write tha value true to the field relay on a Thing (device)

Request to another peer

<iq type='set'
  from='client@clayster.com/amr'
  to='device@clayster.com'
  id='S0001'>
  <req xmlns='urn:xmpp:iot:sensordata' seqnr='1' momentary='true'/>
</iq>

The respons confirming the write

<iq type='result'
  from='device@clayster.com'
  to='client@clayster.com/amr'
  id='S0001'>
  <accepted xmlns='urn:xmpp:iot:sensordata' seqnr='1'/>
</iq>

##Writing to several fields

##Parent restricting the access For every request the device should ask it’s parent the trusted party if the request is allowed the trusted party can reject the request and the device can cache that information for later use.

Parent: A parent is an optional peer being the device Best friend or trusted party and is responsible for providing the device with the access priviliges for different peers.

Node: A Thing can model it’s content in several “nodes” for example a heatpump can model it’s content as the nodes Pump, WaterHeater, Compressor which all can have several fields.

Field: A Thing can have several fields every field is a low level value having some type of SI unit such as kWh, temp in F,C or K.


Joachim Lindborg

Written by

Updated