Caloriosa / caloriosa

Documentation, Wiki, Analysis, issues and reports for Caloriosa
https://caloriosa.com
0 stars 0 forks source link

Measuring #5

Open purrplingcat opened 6 years ago

purrplingcat commented 6 years ago

Measuring

For measuring is used devices. Every device has a sensors for measumerent. User can configure following atributes:

Device

Device name is generated by system. As device owner is assigned device author. Only admin or device owner can manage that device.

Sensor

Sensor automaticaly assigned to a device. User can't change assigned device.

Management

Devices

User can create a device in Web-UI (admins in Admin-UI or via CLI). User must fill form with devices information and click button create. Then user has redirected to device details with device information. This page has 3 tabs: Summary, Sensors, Token.

Summary tab (default)

This tab shows a information about device, buttons for edit or for delete device. Data is read-only. If user want change data, then must click to 'edit'. This view has been showed after enter to device (by redirect form device create/edit form or click to device on devices table)

Sensors tab

This tab has a table with sensors (after device creation table is empty), button for create sensor and combo-box for setup featured sensor. Next to combo-box is button for set and button for clear featured sensor.

Token tab

This tab show a valid a read-only field with token for device authentization. If no token generated or no token is valid, then field has a text: 'Please generate new access token'. This text has formated as cursive. If in field is a token, then text formated as bold.

After token field has 2 buttons: 'Generate new' and 'Revoke'. Revoke button is disabled if no token generated or valid.

Sensors

Every users can create sensor for a device by clicking to button 'Create sensor' at top side sensor table. Then view a form for fill information about sensor and buttons 'Save' and 'Cancel'. By clicking to 'Save' sensor was created. 'Cancel' discards data nad returns to device summary. After sensor was created user redirected to device summary and in sensor table see created sensor with summary data: Title, Alias and Type. At last column on sensor row is buttons edit and delete a sensor.

In sensor create/edit form user must specify a type of sensor. Types is defined in service and user can't create, edit or delete it.

Sensor types

we will gradually expand the other types

Measure&Send

Measuring process execute a physical measurement device. This device must be connected with our service and authentizated by token.

After measure device send a measured values to our service via REST API. Device coll our service API url ends with /measure via method POST with measurement data:

[
  { 
    "sensorAlias": "home",
    "value": 295.65
  },
  {
    "sensorAlias": "outside",
    "value": 275.95
  }
]

Key is a sensor alias and value is a value of measure. Value type is float.

If process was sucess, then server returns a result:

{
  "status": {
    "code": "OK",
    "message": "OK",
  },
  "content": [
    { 
      "_id": "4a26f9c325a15c3d0c2cf6b9",
      "_created": "2017-12-05T20:55:47.108+01:00",
      "_modified": "2017-12-05T20:55:47.108+01:00",
      "deviceName": "Dzhiz4527i",
      "sensorAlias": "home",
      "value": 295.65
    },
    {
      "_id": "2cbf6f9c325a8df3d0abd0d3c",
      "_created": "2017-12-05T20:55:47.109+01:00",
      "_modified": "2017-12-05T20:55:47.109+01:00",
      "deviceName": "Dzhiz4527i",
      "sensorAlias": "outside",
      "value": 275.95
    }
  ]
}

Measure was added to database In cause of failure server returns a status with error code and message.

View

TODO: write it


Related: Following: Source: