SmartThings: Smooth Out and Pretty Up Temperature Tiles

Overview

Several SmartThings temperature sensors, such as those found in Multi sensors, produce temperature readings with a +/- 1°F accuracy. The resulting line graph is noisy, thick, and difficult to see small trend changes. Applying a smoothing filter on a temperature data stream cleans up the line graph. Units and/or emojis can be added to the smoothed dataset.

*This operation uses real-time expressions, available in the Personal and Pro tiers.

Syntax


Default smoothing (assumes a smoothFactor = 0.7)
=smooth([data stream])

Specific smoothFactor (0 to 1; 0 = no smoothing; 1 = maximum smoothing to a flat line)
=smooth([data stream], smoothFactor)

Example



In the example above, a Multi sensor is sending a noisy temperature stream. The following expression is used to smooth out the line graph:

=(smooth([Backdoor Multi(temperature_F)])

The filtered result produces data values with several digits to the right of the decimal point. To round the resulting values to two decimal places, a math.round function is applied:

=math.round(smooth([Backdoor Multi(temperature_F)]),2)

To append units and/or emojis to the end of the data values, the concatenate operator, &, is used:

=math.round(smooth([Backdoor Multi(temperature_F)]),2) & "°F"


In the example above, a thermometer emoji was used. This emoji can be copied/pasted from http://emojipedia.org/thermometer/. 


Feedback and Knowledge Base