Change the unit of temperature in the DustLink Dashboard

The DustLink dashboard shows the temperature of the different motes in C. This recipe shows you how to change this to raw 1/100 C readings.

This howto applies to DustLink REL-1.0.2.

beforeafter

You only need to make 2 changes:

First change

In DataConnector/MirrorEngine.py, line 159, change

temperature_C = float(data['fields']['temperature'])/100.0

to

temperature_C = data['fields']['temperature']

MirrorEngine.py is the Python module on the server which contains the data to be displayed on the dashboard. The original line turns the raw temperature (an integer in units of 1/100 C) into a floating point value in C.

Second change

In views/web/dustWeb/static/dashboard/dashboard.js, line 492, change

$('#viz_'+this.vizId).html(parseFloat(this.lastvalue).toFixed(2)+'°C');

to

$('#viz_'+this.vizId).html(this.lastvalue);

dashboard.js is the Javascript code running on the browser which creates the graphical dashboard. The original line formats the temperature data received from the server as a float with 2 digits following the decimal point, and appends the "C" unit.