Index: logic/trunk/src/init/devicelist.c
===================================================================
--- logic/trunk/src/init/devicelist.c	(revision 18)
+++ logic/trunk/src/init/devicelist.c	(revision 19)
@@ -1,10 +1,11 @@
 #include "devicelist.h"
+//#include "buf.h"
 #include <string.h>
 #include <mxml.h>
 
 device *hDevice; //device list
 
-void setDeviceList()
+int setDeviceList()
 {
     device *curr, *head;
     head = NULL;
@@ -12,7 +13,13 @@
     FILE *fp;
     mxml_node_t *tree, *node;
 
-	fp = fopen("devicetree.xml", "r"); //TODO !hardcoded
+	if(fp = fopen("./src/init/devicetree.xml", "r")) //TODO !hardcoded
+	{
+        printf("File read!\n");
+	}
+	else
+        printf("Error!");
+
 	tree = mxmlLoadFile(NULL, fp, MXML_IGNORE_CALLBACK);
 	node = tree;
 	fclose(fp);
@@ -30,10 +37,10 @@
     /**/
     //getting to the correct level of the xml tree (descend 2 levels)
     node=node->child->child;
-    printf("hDevice %d\n", hDevice);
+    // printf("hDevice %d\n", hDevice);
 
     // fill the list of known devices
-    // sorry for the ugly chunk of code, but I had to allocate memory
+    //      sorry for the ugly chunk of code, but I had to allocate memory
     // for each string separately in order to keep it scalable
     while(node!=NULL)
     {
@@ -50,12 +57,9 @@
         strcpy(curr->name, mxml_deviceNode->value.element.attrs->value);
             mxml_deviceNode= mxml_deviceNode->next;
 
-        curr->minval= atoi(mxml_deviceNode->value.element.attrs->value);
+        curr->readitv = atoi(mxml_deviceNode->value.element.attrs->value);
             mxml_deviceNode= mxml_deviceNode->next;
 
-        curr->maxval= atoi(mxml_deviceNode->value.element.attrs->value);
-            mxml_deviceNode= mxml_deviceNode->next;
-
         curr->action = (char *)malloc(sizeof(mxml_deviceNode->value.element.attrs->value));
         strcpy(curr->action, mxml_deviceNode->value.element.attrs->value);
             mxml_deviceNode= mxml_deviceNode->next;
@@ -63,6 +67,19 @@
         curr->param = (char *)malloc(sizeof(mxml_deviceNode->value.element.attrs->value));
         strcpy(curr->param, mxml_deviceNode->value.element.attrs->value);
         // done
+        // TODO create buffer
+        curr->buf = init_buf((int)(HISTORY_LENGTH/curr->readitv));
+
+        //printf("curr buf_size %d\n", curr->buf->buffer_size);
+        //printf("curr buf_load %d\n", curr->buf->buffer_load);
+        //printf("buf_pos %d\n", &curr->buf);
+        //*
+        int num;
+        buf_put(10, curr->buf);
+        //printf("num %d\n",*curr->buf->start_el );
+        buf_get(&num, curr->buf);
+        printf("num %d\n",num);
+        /**/
         // moving to the next XML node
         node=node->next;
 
@@ -72,23 +89,24 @@
     //delete obsolete xml tree
     mxmlDelete(tree);
     mxmlDelete(node);
-    /*
+    //*
     // TODO delete - test
     hDevice=head;
     curr=head;
     printf("test device list\n");
-    //*
+    /*
+    // DEBUG
     while(curr)
     {
         printf("name:\t %s\n", curr->name );
         printf("id:\t %s\n", curr->id );
-        printf("minval:\t %d\n", curr->minval );
-        printf("maxval:\t %d\n", curr->maxval );
+        printf("readitv:\t %d s\n", curr->readitv );
         printf("action:\t %s\n", curr->action );
         printf("param:\t %s\n", curr->param );
         curr=curr->nxt;
     }
     /**/
+    return 1;
 }
 
 /*
Index: logic/trunk/src/init/devicetree.xml
===================================================================
--- logic/trunk/src/init/devicetree.xml	(revision 18)
+++ logic/trunk/src/init/devicetree.xml	(revision 19)
@@ -2,36 +2,31 @@
 <devicetree>
     <device id="thermometer_01">
         <name nam="Thermometer"></name>
-        <minvalue minval="18"></minvalue>
-        <maxvalue maxval="27"></maxvalue>
+        <read_interval rditv="10"/>
         <action act="testAction_1"></action>
         <param par="testParam_1"></param>
     </device>
     <device id="barometer_01">
         <name nam="Barometer"></name>
-        <minvalue minval="18"></minvalue>
-        <maxvalue maxval="27"></maxvalue>
+        <read_interval rditv="20"/>
         <action act="testAction_2"></action>
         <param par="testParam_2"></param>
     </device>
     <device id="hygrometer_01">
         <name nam="Hygrometer"></name>
-        <minvalue minval="18"></minvalue>
-        <maxvalue maxval="27"></maxvalue>
+        <read_interval rditv="30"/>
         <action act="testAction_3"></action>
         <param par="testParam_3"></param>
     </device>
     <device id="light_sensor_01">
         <name nam="Light sensor"></name>
-        <minvalue minval="18"></minvalue>
-        <maxvalue maxval="27"></maxvalue>
+        <read_interval rditv="1"/>
         <action act="testAction_4"></action>
         <param par="testParam_4"></param>
     </device>
     <device id="smart_meter_01">
         <name nam="Smart meter"></name>
-        <minvalue minval="18"></minvalue>
-        <maxvalue maxval="27"></maxvalue>
+        <read_interval rditv="3"/>
         <action act="testAction_5"></action>
         <param par="testParam_5"></param>
     </device>
Index: logic/trunk/src/init/devicelist.h
===================================================================
--- logic/trunk/src/init/devicelist.h	(revision 18)
+++ logic/trunk/src/init/devicelist.h	(revision 19)
@@ -1,5 +1,11 @@
 #ifndef DEVICELIST_H_INCLUDED
 #define DEVICELIST_H_INCLUDED
+
+// in seconds, history for each sensor is at most 600 seconds old
+// TODO maybe this isn't the best idea, perhaps every sensor needs different length of history
+#define HISTORY_LENGTH 600
+
+#include "buf.h"
 
 //struct device_d ; /* Forward declaration */
 
@@ -7,15 +13,15 @@
 {
     char    *name;
     char    *id;
-    int     minval;
-    int     maxval;
+    int     readitv; //in seconds
     char    *action;
     char    *param;
+    d_bufr  *buf;
     //TODO add circular buffer for each device
     struct  device_d *nxt;
 }device;
 
-void setNewDeviceList(); // ony called on startup
+int setNewDeviceList(); // ony called on startup
 /*
 void updateDeviceList(device_d *deviceList); // called on HMI change
 char *getDeviceName();
