Skip to content

Commit

Permalink
Merge pull request #45 from ultrasuperpingu/master
Browse files Browse the repository at this point in the history
Fix #44
  • Loading branch information
999LV committed Jan 28, 2021
2 parents b76e6ec + 5679f2c commit 77672ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions viewer/Smart Thermostats.html
Expand Up @@ -67,11 +67,11 @@
data: data.heater.historic.map(function (item) {
return {
x: +(new Date(item.Date)),
y: (item.Data=="On" || item.Data.startsWith("Set Level"))?((item.Level==undefined)?100:(item.Level>100?100:item.Level)):0
y: (item.Data=="On" || item.Data.startsWith("Set Level"))?((!data.heater.isDimmer)?100:(item.Level>100?100:item.Level)):0
}
})
});
console.log(series);
//console.log(series);
chartElement.highcharts({
chart: {
zoomType: 'x'
Expand Down
8 changes: 6 additions & 2 deletions viewer/svt_viewer.js
Expand Up @@ -15,6 +15,7 @@ class Thermostat {
class Heater {
constructor() {
this.historic=undefined;
this.isDimmer=false;
}
}
Date.prototype.yyyymmdd_hhmm = function() {
Expand Down Expand Up @@ -90,8 +91,9 @@ function getThermostats() {
$.ajax({url: request,
async: false,
success: function(resultTemp){
console.log(resultTemp);
//console.log(resultTemp);
thermostat.heater = new Heater();
//thermostat.heater.isDimmer = resultTemp.HaveDimmer; // not working, HaveDimmer always true
thermostat.heater.historic = resultTemp.result.filter(item => new Date(item.Date).getTime() >= minDate).sort((a,b)=>new Date(a.Date).getTime()>new Date(b.Date).getTime());
}
});
Expand All @@ -109,7 +111,9 @@ function getThermostats() {
thermostat.setpoint = resultTemp2.result;
}
});

}
if(heatIdxs[0] == resultTemp.result[j].idx) {
thermostat.heater.isDimmer = resultTemp.result[j].SwitchType == "Dimmer";
}
}
}
Expand Down

0 comments on commit 77672ed

Please sign in to comment.