Device attribute metrics

devices

#1

Dear all,

what about phsical units (I suppose, this would be called the “metrics” of a device attribute). A room sensor may send temperature and humidity. How to tell losant, that one is °C, the other %?

Is there any way to put the data into a dashboard and let Losant recognize, that the unit is different?

Best regards, Eckehard


Sensor Correction strategy
#2

Hi @Eckehard_Fiedler and welcome to the Losant Forum!

Typically, people represent different metrics with different attributes. For example, if I had a temperature device reporting Celsius, but I also wanted Fahrenheit. I would make two attributes on that device:

  • tempC
  • tempF

When my device reports data, it will report tempC. The state would look something like this:

{
  "data": {
    "tempC": 24
  }
}

Then you can use a workflow to do this:

When my device reports, do some math ( calculate Fahrenheit ) and save that as tempF using the Device State node.

Then, you can specify in your dashboard weather you want to display Celsius or Fahrenheit by using tempC or tempF respectfully.


#3

Hy anaptfox,

thank you for the quick answer.

Just to verify: this means, the user has to care for the sensor metrics, because Losant cannot, right? Isn´t this a source of errors, if the device just sends numbers and the user has to know, if this is W, kW or °C??

Data metrics are very handy:

  • they allows to check calculations, it prevents you from adding things that cannot be added (like kW and °C)
  • they can be used to choose diagram axis automatically

There are a lot of other information that could be related to data sources, like

  • sensor number
  • sensor location
  • calibration date
  • valid data range

These information are related to sensors, not to devices. Does this mean, we have to set up a separate device for every sensor to use tags??

Sorry for the many questions…

Best regards, Eckehard


#4

No problem! Ask as many questions as you want, that’s why we are here.

It depends on who you would qualify as the user in this case. Generally, it’s the Losant User’s job to very that the devices are sending the proper data to Losant. This way, you know that tempC is Celsius, and you can ensure the proper conversions are made.

As far as the other information you are referring to, I would indeed store those as device tags. The information you mentioned ( like sensor number ) are generally what tags are used for.

If the data is time-series data that you would like to display on a dashboard, use attributes. Any static or semi-static information should be stored as device tags.

If you have different sensors reporting different data types, it could be wise for you to set up each sensor type as it’s own device.