Publishing data from sensors

When a sensor changes it’s state it emits event informing application that it’s state has changed. When application receives this information it serializes it to format similar to format used in XEP-0323: Internet of Things - Sensor Data for data representation and publishes this data as a payload to device’s state PubSub node, ie. for iot-1 measuring light intensity in lm following payload will be published at devices/iot-1/state:

<timestamp value="2016-12-10T19:56:26.460Z">
    <numeric unit="lm" automaticReadout="true" value="37" momentary="true" name="Light"/>
</timestamp>