Open Essavant opened 3 years ago
i would love to see this in Fahrenheit too
Has anyone rewritten it into Fahrenheit? I would convert my whole house to Celsius, but I think my wife would be frustrated. I am new to this type of programming (more of a ladder logic guy). I started converting everything to Fahrenheight, but due to uncommented code and not understanding all of what I am working with, I temporarily gave up. I do learn best by reverse engineering and have learned a lot about NodeRed from this code, but I wouldn't mind stealing someone else's code who has already done it just because I don't have enough time right now.
It reads whatever temp you have set up for your thermostat
Just need to update the UI with a new range in node red "Nest" line 234 and 235 need to be updated to whatever you like and it will automatically just work
I put 40 for the min and 100 for the max
I am still lost on how the schedule works so good luck
Under the "Settings Page" node, you will find this very easy to change code: function bar(mm,val) { if (val==12 || val==12.5) { $(mm).height("12%"); $(mm).css('background-color', '#1E88E5'); } //blue if (val==13 || val==13.5) { $(mm).height("16%"); $(mm).css('background-color', '#039BE5'); } if (val==14 || val==14.5) { $(mm).height("20%"); $(mm).css('background-color', '#00ACC1'); } if (val==15 || val==15.5) { $(mm).height("24%"); $(mm).css('background-color', '#039BE5'); } // cyan if (val==16 || val==16.5) { $(mm).height("28%"); $(mm).css('background-color', '#00ACC1'); } if (val==17 || val==17.5) { $(mm).height("32%"); $(mm).css('background-color', '#00897B'); } if (val==18 || val==18.5) { $(mm).height("36%"); $(mm).css('background-color', '#388E3C'); } // green if (val==19 || val==19.5) { $(mm).height("40%"); $(mm).css('background-color', '#689F38'); } if (val==20 || val==20.5) { $(mm).height("44%"); $(mm).css('background-color', '#C0CA33'); } if (val==21 || val==21.5) { $(mm).height("48%"); $(mm).css('background-color', '#FDD835'); } // yellow if (val==22 || val==22.5) { $(mm).height("52%"); $(mm).css('background-color', '#FBC02D'); } if (val==23 || val==23.5) { $(mm).height("56%"); $(mm).css('background-color', '#FFA000'); } if (val==24) { $(mm).height("60%"); $(mm).css('background-color','#E64A19'); } // red }
Later down the code are other functions that I am having a hard time reverse engineering to determine what (if anything) needs to be changed:
(function(scope){
scope.ID = ID;
scope.send({payload: '29'})
scope.$watch('msg', function(msg) {
selec(last,0); last=msg.selector; selec(last,1);
for (var x=0; x<24; x++)
{
var w="#t"+x+ID; bar(w,msg.timing[((msg.days-1)24)+x].toFixed(1));
var v="#v"+x+ID; $(v).text(msg.timing[((msg.days-1)24)+x].toFixed(1)+"°")
}
for (var x=0; x<2; x++) { var w="#s"+x+ID; $(w).text(msg.timing[168+x].toFixed(1)+"°"); }
$("#d0"+ID).text(thedays[msg.days-1]);
if ((last>4) &&(last<29))
$("#current"+ID).text(msg.timing[((msg.days-1)*24)+last-5].toFixed(1) + "°");
else
$("#current"+ID).text("-");
if (msg.foryou!="") { stat(msg.foryou); }
});
I too would love to see a Fahreneit solution! I'm a total layman, but playing with it. I too wonder about the function. For the moment, I'm leaving it because I think whatever it's doing would only be until the schedule sends the next update. We'll see.
Obviously, a first step, but here's my conversion: function bar(mm,val) { if (val==53.6 || val==54.5) { $(mm).height("12%"); $(mm).css('background-color', '#1E88E5'); } //blue if (val==55.4 || val==56.3) { $(mm).height("16%"); $(mm).css('background-color', '#039BE5'); } if (val==57.2 || val==58.1) { $(mm).height("20%"); $(mm).css('background-color', '#00ACC1'); } if (val==59 || val==59.9) { $(mm).height("24%"); $(mm).css('background-color', '#039BE5'); } // cyan if (val==60.8 || val==61.7) { $(mm).height("28%"); $(mm).css('background-color', '#00ACC1'); } if (val==62.6 || val==63.5) { $(mm).height("32%"); $(mm).css('background-color', '#00897B'); } if (val==64.4 || val==65.3) { $(mm).height("36%"); $(mm).css('background-color', '#388E3C'); } // green if (val==66.2 || val==67.1) { $(mm).height("40%"); $(mm).css('background-color', '#689F38'); } if (val==68 || val==68.9) { $(mm).height("44%"); $(mm).css('background-color', '#C0CA33'); } if (val==69.8 || val==70.7) { $(mm).height("48%"); $(mm).css('background-color', '#FDD835'); } // yellow if (val==71.6 || val==72.5) { $(mm).height("52%"); $(mm).css('background-color', '#FBC02D'); } if (val==73.4 || val==74.3) { $(mm).height("56%"); $(mm).css('background-color', '#FFA000'); } if (val==75.2) { $(mm).height("60%"); $(mm).css('background-color','#E64A19'); } // red } Later in the same settings node, I converted the send({payload: numbers as well.
Other than changing the hardcoded values in the Settings Page node, is there any way to change to a °F scale?