From a167da2230558c49526c75ac563fe19a23cf9cd1 Mon Sep 17 00:00:00 2001 From: Mike Shoup Date: Thu, 25 Oct 2018 14:48:44 -0600 Subject: [PATCH] Always display by alias of sensor --- html/js/thermostat.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/html/js/thermostat.js b/html/js/thermostat.js index d51013c..d6ce63c 100644 --- a/html/js/thermostat.js +++ b/html/js/thermostat.js @@ -180,8 +180,16 @@ function renderThermostats() { beforeSend: authHeaders }).then(function(data) { $("#thermostats").empty(); - for (var key in data) { - appendData(data[key]) + + // Sort by sensor alias + var sorted = []; + for(var key in data) { + sorted[sorted.length] = key; + } + sorted.sort(); + + for (var i in sorted) { + appendData(data[sorted[i]]) }; }); };