<commit_before>---
layout: article
title:  "Read a value from a device"
categories: basics
modified: 2014-11-04T02:02:02
tags: [basics]
toc: true
comments: false
share: false
ads: false
---

The first you would like to do in an Internet of Things environment is to read values from your Thing. The device can of course have several available values here we show the first read out getting all available values that you as a peer has access to 

##Read all fields available

Readout of all momentary fields from a Thing (device) 

**Request to another peer**
{% highlight xml %}
<iq type='get'
    from='<EMAIL>/amr'
    to='<EMAIL>'
    id='S0001'>
    <req xmlns='urn:xmpp:iot:sensordata' seqnr='1' momentary='true'/>
</iq>
{% endhighlight %}

**The respons confirming the readout**
{% highlight xml %}
<iq type='result'
	from='<EMAIL>'
	to='<EMAIL>.com/amr'
	id='S0001'>
	<accepted xmlns='urn:xmpp:iot:sensordata' seqnr='1'/>
</iq>
{% endhighlight %}

**next respons with the data contained**
{% highlight xml %}
<message from='<EMAIL>'
    to='<EMAIL>/amr'>
    <fields xmlns='urn:xmpp:iot:sensordata' seqnr='1' done='true'>
	    <node nodeId='Device01'>
            <timestamp value='2013-03-07T16:24:30'>
                <numeric name='Temperature' momentary='true' automaticReadout='true' value='23.4' unit='°C'/>
			    <numeric name='load level' momentary='true' automaticReadout='true' value='75' unit='%'/> 
            </timestamp>
        </node>
    </fields>
</message>
{% endhighlight %}<commit_msg>work on articles<commit_after>---
layout: article
title:  "Read a value from a device"
categories: basics
modified: 2014-11-04T02:02:02
tags: [basics]
toc: true
comments: false
share: false
ads: false
---

The first you would like to do in an Internet of Things environment is to read values from your Thing. The device can of course have several available values here we show the first read out getting all available values that you as a peer has access to 

##Read all fields available

Readout of all momentary fields from a Thing (device) 

**Request to another peer**
{% highlight xml %}
<iq type='get'
  from='<EMAIL>/amr'
  to='<EMAIL>'
  id='S0001'>
  <req xmlns='urn:xmpp:iot:sensordata' seqnr='1' momentary='true'/>
</iq>
{% endhighlight %}

**The respons confirming the readout**
{% highlight xml %}
<iq type='result'
  from='<EMAIL>'
  to='<EMAIL>/amr'
  id='S0001'>
  <accepted xmlns='urn:xmpp:iot:sensordata' seqnr='1'/>
</iq>
{% endhighlight %}

**next respons with the data contained**
{% highlight xml %}
<message from='<EMAIL>'
  to='<EMAIL>/amr'>
  <fields xmlns='urn:xmpp:iot:sensordata' seqnr='1' done='true'>
    <node nodeId='Device01'>
      <timestamp value='2013-03-07T16:24:30'>
        <numeric name='Temperature' momentary='true' automaticReadout='true' value='23.4' unit='°C'/>
        <numeric name='load level' momentary='true' automaticReadout='true' value='75' unit='%'/> 
      </timestamp>
    </node>
  </fields>
</message>
{% endhighlight %}
{'fraction_non_alphanumeric': 0.1540260608085533, 'fraction_numerical': 0.030738389575676577, 'mean_word_length': 4.3464285714285715, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4319273', 'n_tokens_mistral': 1084, 'n_tokens_neox': 966, 'n_words': 314}