Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:mervis-scada:82-iot-api [2019/05/17 14:05]
m.chlupac
en:mervis-scada:82-iot-api [2021/04/08 13:04] (current)
Line 1: Line 1:
 ====== IoT API ====== ====== IoT API ======
 +
 +You can send measured data to Mervis via several APIs. The IoT API is the most flexible one - you can define custom Levels and Tags to be used for later data processing and Mervis SCADA project generation.
  
 ===== Simple Example ===== ===== Simple Example =====
Line 10: Line 12:
    "timestamp": "2019-04-18T15:58:59Z",    "timestamp": "2019-04-18T15:58:59Z",
    "period": "PT5M",    "period": "PT5M",
-   "variable": [{ +   "variables": [{ 
-     "id": "xxxxxxxzzzzzzz",+     "id": "temperature_1",
      "name": "Temperature",      "name": "Temperature",
      "dataType": "float64",      "dataType": "float64",
Line 19: Line 21:
       }       }
      ],      ],
-     "level1_txt": "Area 52", +     "level_1_txt": "Area 52", 
-     "level2_txt": "Building A", +     "level_2_txt": "Building A", 
-     "level3_txt": "AHU 89", +     "level_3_txt": "AHU 89", 
-     "level4_txt": "Floor 7", +     "level_4_txt": "Floor 7", 
-     "level5_txt": "Room 12"+     "level_5_txt": "Room 12"
     }, {     }, {
-     "id": "xxxxxxxzzzzzzz",+     "id": "relative_humidity_25",
      "name": "RelativeHumidity",      "name": "RelativeHumidity",
      "dataType": "float64",      "dataType": "float64",
Line 33: Line 35:
       }       }
      ],      ],
-     "level1_txt": "Area 52", +     "level_1_txt": "Area 52", 
-     "level2_txt": "Building A", +     "level_2_txt": "Building A", 
-     "level3_txt": "AHU 89", +     "level_3_txt": "AHU 89", 
-     "level4_txt": "Floor 7", +     "level_4_txt": "Floor 7", 
-     "level5_txt": "Room 12"+     "level_5_txt": "Room 12"
     }     }
    ]    ]
Line 45: Line 47:
 </code> </code>
  
 +  * Use always UTC form of the timestamp. Otherwise a default conversion will occurr. Default conversion can depend on many factors and is not reliable. Even if it works right now for your time zone it can change in the future as we upgrade/update/move the IT infrastructure.
 +  * Available data types:
 +    * float64
 +    * string
 +    * int64
 +    * uint64
 +    * bool
 +    * datetime
  
  
Line 53: Line 63:
 { {
  "controllers": [{  "controllers": [{
-   "id": "AAABBBCCCDDDDDDAAAABBBSFSDFSFSFSDFSDFS", //Unique ID that you can get from sales@mervis.info +   "id": "AAABBBCCCDDDDDDAAAABBBSFSDFSF",  //Unique ID that you can get from sales@mervis.info 
-   "name": "Mervis Av., Building A",               //User description of the site or controller +   "name": "Mervis Av., Building A",       //User description of the site or controller 
-   "timestamp": "2019-04-18T15:58:59Z",            //Default timestamp of the values. May be overridden in the "Values" section +   "timestamp": "2019-04-18T15:58:59Z",    //Default timestamp of the values. May be overridden in the "Values" section 
-   "period": "PT5M",                               //Default sample interval. May be overridden in the "Values" section +   "period": "PT5M",                       //Default sample interval. May be overridden in the "Values" section. https://en.wikipedia.org/wiki/ISO_8601#Time_intervals 
-   "levels": [{                                    //Levels are used to further identify data +   "levels": [{                            //Levels are used to further identify data 
-     "id": 1,                                      //Here is a list of "known" Levels that can be later +     "id": 1,                              //Here is a list of "known" Levels that can be later 
-     "name": "AHU 89"                              //referenced from each variable.+     "name": "AHU 89"                      //referenced from each variable.
     }, {     }, {
      "id": 2,      "id": 2,
Line 68: Line 78:
     }     }
    ],    ],
-   "variable": [{ +   "variables": [{ 
-     "id": "xxxxxxxzzzzzzz",                       //Inique ID of the variable within this controller ID +     "id": "xxxxxxxzzzzzzz",               //Inique ID of the variable within this controller ID 
-     "name": "Outside temperature",                //User description of the variable +     "name": "Outside temperature",        //User description of the variable 
-     "dataType": "float64",                        //float64, string, int64, uint64, bool, datetime+     "dataType": "float64",                //float64, string, int64, uint64, bool, datetime
      "unit": "°C",      "unit": "°C",
-     "values": [{                                  //One or more measured value records +     "values": [{                          //One or more measured value records 
-       "timestamp": "2019-04-18T15:55:59Z",        //Overrides default timestamp +       "timestamp": "2019-04-18T15:55:59Z",//Overrides default timestamp 
-       "period": "PT10M",                          //Overrides default interval +       "period": "PT10M",                  //Overrides default interval 
-       "value": 23.0                               //measured value of "dataType" type+       "value": 23.0                       //measured value of "dataType" type
       }, {       }, {
        "timestamp": "2019-04-18T15:58:59Z",        "timestamp": "2019-04-18T15:58:59Z",
Line 82: Line 92:
       }       }
      ],      ],
-     "level1_idx": 3,                              //you can either use Level index to previously defined Levels +     "level_1_idx": 3,                      //you can either use Level index to previously defined Levels 
-     "level2_idx": 2, +     "level_2_idx": 2, 
-     "levelX_idx": 1, +     "level_X_idx": 1, 
-     "level1_txt": "Area 52",                      //or directly define the Level name +     "level_1_txt": "Area 52",              //or directly define the Level name 
-     "level2_txt": "AHU 89",                        +     "level_2_txt": "AHU 89",                
-     "levelX_txt": "Building A", +     "level_X_txt": "Building A", 
-     "tags": [{                                    //arbitrary array of tags +     "tags": [{                            //arbitrary array of tags 
-       "name": "technology_id",                    //tag name - string +       "name": "technology_id",            //tag name - string 
-       "value": "VZT1",                            //tag value - string +       "value": "VZT1",                    //tag value - string 
-       "type": "string"                            //string, bool+       "type": "string"                    //string, bool
       }, {       }, {
        "name": "area",        "name": "area",
  • © Energocentrum Plus, s.r.o. 2017 - 2024