Hi All!
Thank you for all the work you have been doing!
It resulted in a great frontpage for my Domoticz system.
I've been following this forum for quiet some time now...
Time to give something back!
As I am the owner of an OpenTherm Gateway, just like jkimmel and floris74, I wanted to be able to set my Setpoint with the buttons used for dimming.
I own an opentherm Remeha Avanta in combination with an Remeha iSense thermostat.
It resulted in some hacking into the code already created but I managed to get it working the correct way.
Now you can adapt your setpoint from the couch! My thermostat gets changed from changing the setpoint...
My solution is integrated into the last release from 17 Feb by mvveelen.
Also I changed some hardcoded idx settings to look for the variable in the frontpage_settings.js. (Might be wise to keep idx nr's out of other files but settings.js)
For more overview I changed some of the folderpaths, so install the attached zip in the correct directories (under www)
Could somebody check this and possibly the correct functioning of the dimmers? (I don't own one yet, so can't test)
Hope we continue on creating the best frontpage ever!
Download the new frontpage file from:
HERE!
Short change overview for thermostat:
New variable to function Refreshdata in frontpage.js
Code: Select all
var viType= item["Type"]; // What type is it
Changed Dimmer and added Thermostat in function refreshdata in frontpage.js
Code: Select all
//Dimmer
if(viType == 'Dimmer' && vplusmin > 0) {
if (vdata == txt_off) {
var hlp = '<span onclick="SwitchToggle('+item.idx+',\'On\')"; style='+alarmcss+'>'+ vdata+'</span>';
var plus = "<img src=images/monitor/up_off.png align=right onclick=ChangeStatus('plus',txt_off," + item.idx + ","+ vdimmercurrent+")>";
var min = "<img src=images/monitor/down_off.png align=left onclick=ChangeStatus('min',txt_off," + item.idx + ","+ vdimmercurrent+")>"
}
else
{
var hlp = '<span onclick="SwitchToggle('+item.idx+',\'Off\')"; style='+alarmcss+'>'+ vdata+'</span>';
var plus = "<img src=images/monitor/up.png align=right onclick=ChangeStatus('plus'," + vdata + "," + item.idx + ","+ vdimmercurrent+")>";
var min = "<img src=images/monitor/down.png align=left onclick=ChangeStatus('min'," + vdata + "," + item.idx + ","+ vdimmercurrent+")>"
}
vdata = min.concat(hlp,plus);
//console.log(vdata);
}
//Thermostat
if(viType == 'Thermostat' && vplusmin > 0) {
if (vdata == txt_off) {
var hlp = '<span onclick="SwitchToggle('+idx_Thermostat+',\'On\')"; style='+alarmcss+'>'+ vdata+'</span>';
var plus = "<img src=images/monitor/up_off.png align=right onclick=ChangeTherm('plus',txt_off," + idx_Thermostat + ","+ vdimmercurrent+")>";
var min = "<img src=images/monitor/down_off.png align=left onclick=ChangeTherm('min',txt_off," + idx_Thermostat + ","+ vdimmercurrent+")>"
}
else
{
var hlp = '<span onclick="SwitchToggle('+idx_Thermostat+',\'Off\')"; style='+alarmcss+'>'+ vdata+'</span>';
var plus = "<img src=images/monitor/up.png align=right onclick=ChangeTherm('plus'," +vplusmin+ "," + idx_Thermostat + ","+ vdata+")>";
var min = "<img src=images/monitor/down.png align=left onclick=ChangeTherm('min'," +vplusmin+ "," + idx_Thermostat + ","+ vdata+")>"
}
vdata = min.concat(hlp,plus);
//console.log(vdata);
}
Added a new function under changestatus function at bottom of frontpage.js
Code: Select all
function ChangeTherm(dimtype,stepsize,idx,currentvalue)
{
newvalue='';
thermmax=ThermostatMaxTemp;
//console.log(dimtype,stepsize,idx,currentvalue,thermmax)
if (dimtype == 'plus') {
if ((currentvalue + stepsize) > thermmax){
newvalue = thermmax;
} else {
newvalue = currentvalue + stepsize;
}
}
else if (dimtype == 'min'){
if (currentvalue < stepsize){
newvalue = 1;
} else {
newvalue = currentvalue - stepsize;
}
}
$.ajax({
url: "json.htm?type=command¶m=udevice" + "&idx=" + idx + "&nvalue=0&svalue=" + newvalue,
async: false,
dataType: 'json',
success: function(){
console.log('SUCCES');
},
error: function(){
console.log('ERROR');
}
});
RefreshData();
}